修复 png9 bug

This commit is contained in:
onvia 2023-12-22 17:48:53 +08:00
parent de9596375e
commit 0d90c0b6dd
5 changed files with 29 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{
"name": "ccc-tnt-psd2ui",
"version": "1.0.4",
"version": "1.0.5",
"description": "",
"main": "index.js",
"scripts": {

6
psd2ui-tools/cmd.bat Normal file
View File

@ -0,0 +1,6 @@
@echo off
echo psd2ui:: Drag and drop a file or folder
set /p var=
node ./dist/index.js --engine-version v342 --pinyin --input %var%
pause

16
psd2ui-tools/cmd.sh Normal file
View File

@ -0,0 +1,16 @@
# node ./dist/index.js
# exec /bin/bash
#!/bin/sh
#============ get the file name ===========
echo -e "导出表格数据:拖拽想要处理的文件和文件夹到此"
read InputDir
echo "导出数据"
node dist/index.js --engine-version v342 --pinyin --input "${InputDir}"
exec /bin/bash

View File

@ -1457,7 +1457,9 @@
console.log(`Texture9Utils-> 设置的九宫格 bottom top 数据不合理,请重新设置`);
return _canvas;
}
let newCanvas = canvas__default["default"].createCanvas(Math.min(cw, border.l + border.r + space) || cw, Math.min(ch, border.b + border.t + space) || ch);
let imgW = border.l + border.r == 0 ? cw : Math.min(cw, border.l + border.r + space);
let imgH = border.b + border.t == 0 ? ch : Math.min(ch, border.b + border.t + space);
let newCanvas = canvas__default["default"].createCanvas(imgW, imgH);
let ctx = newCanvas.getContext("2d");
// 左上
ctx.drawImage(_canvas, 0, 0, left + space, top + space, 0, 0, left + space, top + space);

View File

@ -40,7 +40,9 @@ export class Texture9Utils {
return _canvas;
}
let newCanvas = canvas.createCanvas(Math.min(cw, border.l + border.r + space) || cw, Math.min(ch, border.b + border.t + space) || ch);
let imgW = border.l + border.r == 0 ? cw : Math.min(cw, border.l + border.r + space);
let imgH = border.b + border.t == 0 ? ch : Math.min(ch, border.b + border.t + space);
let newCanvas = canvas.createCanvas(imgW, imgH);
let ctx = newCanvas.getContext("2d");
// 左上