Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 288dc2c

Browse files
committed
Constrain width of media in large mode
1 parent b706551 commit 288dc2c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/settings/enums/ImageSize.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export function suggestedSize(size: ImageSize, contentSize: Dimensions, maxHeigh
5050
h: maxHeight ? Math.min(maxSize.h, contentSize.h, maxHeight) : Math.min(maxSize.h, contentSize.h),
5151
};
5252

53-
if (constrainedSize.h * aspectRatio < constrainedSize.w || size === ImageSize.Large) {
53+
if (constrainedSize.h * aspectRatio < constrainedSize.w) {
5454
// Height dictates width
5555
return { w: constrainedSize.h * aspectRatio, h: constrainedSize.h };
5656
} else {

test/settings/enums/ImageSize-test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ describe("ImageSize", () => {
2626
const size = suggestedSize(ImageSize.Normal, { w: 162, h: 648 });
2727
expect(size).toStrictEqual({ w: 81, h: 324 });
2828
});
29-
it("does not constrain width in large mode", () => {
29+
it("constrains width in large mode", () => {
3030
const size = suggestedSize(ImageSize.Large, { w: 2400, h: 1200 });
31-
expect(size).toStrictEqual({ w: 1200, h: 600 });
31+
expect(size).toStrictEqual({ w: 800, h: 400 });
3232
});
3333
it("returns max values if content size is not specified", () => {
3434
const size = suggestedSize(ImageSize.Normal, { w: null, h: null });

0 commit comments

Comments
 (0)