From 39dd59b062607771abb861495884fe219f790bf0 Mon Sep 17 00:00:00 2001 From: Stephen Zhou <38493346+hyoban@users.noreply.github.com> Date: Tue, 22 Oct 2024 15:07:30 +0800 Subject: [PATCH] fix: preview media width --- apps/renderer/src/components/ui/media/preview-media.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/renderer/src/components/ui/media/preview-media.tsx b/apps/renderer/src/components/ui/media/preview-media.tsx index 74442a8ee..b4427d516 100644 --- a/apps/renderer/src/components/ui/media/preview-media.tsx +++ b/apps/renderer/src/components/ui/media/preview-media.tsx @@ -304,7 +304,10 @@ const FallbackableImage: FC< className={cn("relative", width < height && "h-full")} style={{ // px-20 pb-8 pt-10 - width: width > height ? (windowHeight - 32 - 40) * (width / height) : undefined, + width: + width && height && width > height + ? Math.min((windowHeight - 32 - 40) * (width / height), width) + : undefined, maxWidth: width > height ? windowWidth - 80 - 80 - 400 : undefined, }} >