From dbef180d51c153a0adad080f2453cd979005cc5a Mon Sep 17 00:00:00 2001 From: onvia <272493431@qq.com> Date: Thu, 14 Sep 2023 17:06:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=A9=BA=E7=BB=84=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=20cocos=20creator=20=E7=BC=96=E8=BE=91=E5=99=A8?= =?UTF-8?q?=E5=B4=A9=E6=BA=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- psd2ui-tools/dist/index.js | 3 +++ psd2ui-tools/package.json | 2 +- psd2ui-tools/src/psd/PsdGroup.ts | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/psd2ui-tools/dist/index.js b/psd2ui-tools/dist/index.js index ec851f4..ddfc7ff 100644 --- a/psd2ui-tools/dist/index.js +++ b/psd2ui-tools/dist/index.js @@ -1359,6 +1359,9 @@ return true; } resize() { + if (!this.children.length) { + return; + } let left = Number.MAX_SAFE_INTEGER; let right = Number.MIN_SAFE_INTEGER; let top = Number.MAX_SAFE_INTEGER; diff --git a/psd2ui-tools/package.json b/psd2ui-tools/package.json index 7ad9856..093d265 100644 --- a/psd2ui-tools/package.json +++ b/psd2ui-tools/package.json @@ -7,7 +7,7 @@ "build": "tsc -b", "watch": "tsc -w", "rollup": "rollup -c", - "test": "ts-node src/index.ts --force-img --input ./test/scale-demo.psd --project-assets ./out/ --cache ./cache/cache.json --output ./out/", + "test": "ts-node src/index.ts --engine-version v342 --force-img --input ./test/blank.psd --project-assets ./out/ --cache ./cache/cache.json --output ./out/", "help": "node dist/index.js --h", "test-init": "node dist/index.js --init --project-assets ./out/ --cache E:\\Git\\ccc-framework-3d\\tools\\psd2ui\\cache\\cache.json", "test-png9": "ts-node src/index.ts --engine-version v342 --pinyin --input ./test/png9.psd --output ./out/", diff --git a/psd2ui-tools/src/psd/PsdGroup.ts b/psd2ui-tools/src/psd/PsdGroup.ts index df3ac2c..16dab89 100644 --- a/psd2ui-tools/src/psd/PsdGroup.ts +++ b/psd2ui-tools/src/psd/PsdGroup.ts @@ -24,6 +24,9 @@ export class PsdGroup extends PsdLayer { } resize() { + if(!this.children.length){ + return; + } let left = Number.MAX_SAFE_INTEGER; let right = Number.MIN_SAFE_INTEGER; let top = Number.MAX_SAFE_INTEGER;