From 1ab7fa9991fbb952edfaceb0b18783e50b57f781 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Fri, 18 Sep 2026 17:09:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=A1=E9=AA=8C=E9=A2=84=E8=A7=88=E7=94=BB?= =?UTF-8?q?=E5=B8=83=E5=83=8F=E7=B4=A0=E6=AF=94=E4=BE=8B=20=E9=81=BF?= =?UTF-8?q?=E5=85=8D=E6=97=A0=E6=95=88=20pixels=5Fper=5Funit=20=E4=BA=A7?= =?UTF-8?q?=E7=94=9F=E6=97=A0=E9=99=90=E5=B0=BA=E5=AF=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui-editor/components/preview/PreviewWorkspace.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/ai-game-creator-shell/src/view/ui-editor/components/preview/PreviewWorkspace.tsx b/apps/ai-game-creator-shell/src/view/ui-editor/components/preview/PreviewWorkspace.tsx index a8b5bfa59..3d93b5212 100644 --- a/apps/ai-game-creator-shell/src/view/ui-editor/components/preview/PreviewWorkspace.tsx +++ b/apps/ai-game-creator-shell/src/view/ui-editor/components/preview/PreviewWorkspace.tsx @@ -122,8 +122,14 @@ export function PreviewWorkspace({ uiTrees.map((item) => { const image = images[item.src_ui_design]; const ppu = image?.pixels_per_unit ?? 0; - const width = image ? image.pixel_size[0] / ppu : 0; - const height = image ? image.pixel_size[1] / ppu : 0; + const width = + image && Number.isFinite(ppu) && ppu > 0 + ? image.pixel_size[0] / ppu + : 0; + const height = + image && Number.isFinite(ppu) && ppu > 0 + ? image.pixel_size[1] / ppu + : 0; return { tree: item, image,