校验预览画布像素比例
避免无效 pixels_per_unit 产生无限尺寸
This commit is contained in:
+8
-2
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user