mirror of
https://gitee.com/onvia/ccc-tnt-psd2ui
synced 2025-08-20 23:58:22 +00:00
适配 3.8.6
This commit is contained in:
parent
0d90c0b6dd
commit
64603ad87e
52
psd2ui-tools/dist/index.js
vendored
52
psd2ui-tools/dist/index.js
vendored
@ -2011,12 +2011,20 @@
|
|||||||
this._isItalic = false;
|
this._isItalic = false;
|
||||||
this._isBold = false;
|
this._isBold = false;
|
||||||
this._isUnderline = false;
|
this._isUnderline = false;
|
||||||
|
this._enableOutline = false;
|
||||||
|
this._outlineColor = new CCColor(255, 255, 255, 255);
|
||||||
|
this._outlineWidth = 0;
|
||||||
}
|
}
|
||||||
updateWithLayer(psdLayer) {
|
updateWithLayer(psdLayer) {
|
||||||
this._fontSize = psdLayer.fontSize;
|
this._fontSize = psdLayer.fontSize;
|
||||||
// this._actualFontSize = this._fontSize;
|
// this._actualFontSize = this._fontSize;
|
||||||
this._string = this._N$string = psdLayer.text;
|
this._string = this._N$string = psdLayer.text;
|
||||||
this._lineHeight = this._fontSize + config.textLineHeightOffset;
|
this._lineHeight = this._fontSize + config.textLineHeightOffset;
|
||||||
|
if (psdLayer.outline) {
|
||||||
|
this._enableOutline = true;
|
||||||
|
this._outlineColor.set(psdLayer.outline.color);
|
||||||
|
this._outlineWidth = psdLayer.outline.width;
|
||||||
|
}
|
||||||
if (config.editorVersion >= EditorVersion.v342) {
|
if (config.editorVersion >= EditorVersion.v342) {
|
||||||
this._srcBlendFactor = 2;
|
this._srcBlendFactor = 2;
|
||||||
this._dstBlendFactor = 4;
|
this._dstBlendFactor = 4;
|
||||||
@ -2113,31 +2121,19 @@
|
|||||||
__decorate([
|
__decorate([
|
||||||
ccversion(EditorVersion.v342)
|
ccversion(EditorVersion.v342)
|
||||||
], CCLabel.prototype, "_isUnderline", void 0);
|
], CCLabel.prototype, "_isUnderline", void 0);
|
||||||
|
__decorate([
|
||||||
|
ccversion(EditorVersion.v342)
|
||||||
|
], CCLabel.prototype, "_enableOutline", void 0);
|
||||||
|
__decorate([
|
||||||
|
ccversion(EditorVersion.v342)
|
||||||
|
], CCLabel.prototype, "_outlineColor", void 0);
|
||||||
|
__decorate([
|
||||||
|
ccversion(EditorVersion.v342)
|
||||||
|
], CCLabel.prototype, "_outlineWidth", void 0);
|
||||||
CCLabel = __decorate([
|
CCLabel = __decorate([
|
||||||
cctype("cc.Label")
|
cctype("cc.Label")
|
||||||
], CCLabel);
|
], CCLabel);
|
||||||
|
|
||||||
let CCLabelOutline = class CCLabelOutline extends CCComponent {
|
|
||||||
constructor() {
|
|
||||||
super(...arguments);
|
|
||||||
this._color = new CCColor(255, 255, 255, 255);
|
|
||||||
this._width = 1;
|
|
||||||
}
|
|
||||||
updateWithLayer(psdLayer) {
|
|
||||||
this._width = psdLayer.outline.width;
|
|
||||||
this._color.set(psdLayer.outline.color);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
__decorate([
|
|
||||||
ccversion(EditorVersion.all)
|
|
||||||
], CCLabelOutline.prototype, "_color", void 0);
|
|
||||||
__decorate([
|
|
||||||
ccversion(EditorVersion.all)
|
|
||||||
], CCLabelOutline.prototype, "_width", void 0);
|
|
||||||
CCLabelOutline = __decorate([
|
|
||||||
cctype("cc.LabelOutline")
|
|
||||||
], CCLabelOutline);
|
|
||||||
|
|
||||||
class ExportImageMgr {
|
class ExportImageMgr {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.textObjects = [];
|
this.textObjects = [];
|
||||||
@ -2602,13 +2598,13 @@
|
|||||||
});
|
});
|
||||||
label.updateWithLayer(layer);
|
label.updateWithLayer(layer);
|
||||||
this.applyConfig(label);
|
this.applyConfig(label);
|
||||||
// 有描边
|
// // 有描边
|
||||||
if (layer.outline) {
|
// if (layer.outline) {
|
||||||
let labelOutline = new CCLabelOutline();
|
// let labelOutline = new CCLabelOutline();
|
||||||
node.addComponent(labelOutline);
|
// node.addComponent(labelOutline);
|
||||||
labelOutline.updateWithLayer(layer);
|
// labelOutline.updateWithLayer(layer);
|
||||||
this.applyConfig(labelOutline);
|
// this.applyConfig(labelOutline);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
// Button / Toggle / ProgressBar
|
// Button / Toggle / ProgressBar
|
||||||
if (layer.attr) {
|
if (layer.attr) {
|
||||||
|
15
psd2ui-tools/package-lock.json
generated
15
psd2ui-tools/package-lock.json
generated
@ -10,7 +10,7 @@
|
|||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ag-psd": "^15.0.0",
|
"ag-psd": "^15.0.0",
|
||||||
"canvas": "^2.10.2",
|
"canvas": "^2.11.2",
|
||||||
"fs-extra": "^10.1.0",
|
"fs-extra": "^10.1.0",
|
||||||
"minimist": "^1.2.7",
|
"minimist": "^1.2.7",
|
||||||
"pinyin-pro": "^3.16.0"
|
"pinyin-pro": "^3.16.0"
|
||||||
@ -495,10 +495,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/canvas": {
|
"node_modules/canvas": {
|
||||||
"version": "2.10.2",
|
"version": "2.11.2",
|
||||||
"resolved": "https://registry.npmmirror.com/canvas/-/canvas-2.10.2.tgz",
|
"resolved": "https://registry.npmjs.org/canvas/-/canvas-2.11.2.tgz",
|
||||||
"integrity": "sha512-FSmlsip0nZ0U4Zcfht0qBJqDhlfGuevTZKE8h+dBOYrJjGvY3iqMGSzzbvkaFhvMXiVxfcMaPHS/kge++T5SKg==",
|
"integrity": "sha512-ItanGBMrmRV7Py2Z+Xhs7cT+FNt5K0vPL4p9EZ/UX/Mu7hFbkxSjKF2KVtPwX7UYWp7dRKnrTvReflgrItJbdw==",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@mapbox/node-pre-gyp": "^1.0.0",
|
"@mapbox/node-pre-gyp": "^1.0.0",
|
||||||
"nan": "^2.17.0",
|
"nan": "^2.17.0",
|
||||||
@ -2040,9 +2041,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"canvas": {
|
"canvas": {
|
||||||
"version": "2.10.2",
|
"version": "2.11.2",
|
||||||
"resolved": "https://registry.npmmirror.com/canvas/-/canvas-2.10.2.tgz",
|
"resolved": "https://registry.npmjs.org/canvas/-/canvas-2.11.2.tgz",
|
||||||
"integrity": "sha512-FSmlsip0nZ0U4Zcfht0qBJqDhlfGuevTZKE8h+dBOYrJjGvY3iqMGSzzbvkaFhvMXiVxfcMaPHS/kge++T5SKg==",
|
"integrity": "sha512-ItanGBMrmRV7Py2Z+Xhs7cT+FNt5K0vPL4p9EZ/UX/Mu7hFbkxSjKF2KVtPwX7UYWp7dRKnrTvReflgrItJbdw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@mapbox/node-pre-gyp": "^1.0.0",
|
"@mapbox/node-pre-gyp": "^1.0.0",
|
||||||
"nan": "^2.17.0",
|
"nan": "^2.17.0",
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
"build": "tsc -b",
|
"build": "tsc -b",
|
||||||
"watch": "tsc -w",
|
"watch": "tsc -w",
|
||||||
"rollup": "rollup -c",
|
"rollup": "rollup -c",
|
||||||
"test": "ts-node src/index.ts --engine-version v342 --force-img --input ./test/blank.psd --project-assets ./out/ --cache ./cache/cache.json --output ./out/",
|
"test": "ts-node src/index.ts --engine-version v342 --force-img --input ./test/demo.psd --project-assets ./out/ --cache ./cache/cache.json --output ./out/",
|
||||||
"help": "node dist/index.js --h",
|
"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-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/",
|
"test-png9": "ts-node src/index.ts --engine-version v342 --pinyin --input ./test/png9.psd --output ./out/",
|
||||||
@ -19,7 +19,7 @@
|
|||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ag-psd": "^15.0.0",
|
"ag-psd": "^15.0.0",
|
||||||
"canvas": "^2.10.2",
|
"canvas": "^2.11.2",
|
||||||
"fs-extra": "^10.1.0",
|
"fs-extra": "^10.1.0",
|
||||||
"minimist": "^1.2.7",
|
"minimist": "^1.2.7",
|
||||||
"pinyin-pro": "^3.16.0"
|
"pinyin-pro": "^3.16.0"
|
||||||
|
@ -370,13 +370,13 @@ export class Main {
|
|||||||
});
|
});
|
||||||
label.updateWithLayer(layer);
|
label.updateWithLayer(layer);
|
||||||
this.applyConfig(label);
|
this.applyConfig(label);
|
||||||
// 有描边
|
// // 有描边
|
||||||
if (layer.outline) {
|
// if (layer.outline) {
|
||||||
let labelOutline = new CCLabelOutline();
|
// let labelOutline = new CCLabelOutline();
|
||||||
node.addComponent(labelOutline);
|
// node.addComponent(labelOutline);
|
||||||
labelOutline.updateWithLayer(layer);
|
// labelOutline.updateWithLayer(layer);
|
||||||
this.applyConfig(labelOutline);
|
// this.applyConfig(labelOutline);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Button / Toggle / ProgressBar
|
// Button / Toggle / ProgressBar
|
||||||
|
@ -8,8 +8,8 @@ import { CCUUIDObject } from "./CCObject";
|
|||||||
import { CCColor } from "./values/CCColor";
|
import { CCColor } from "./values/CCColor";
|
||||||
|
|
||||||
@cctype("cc.Label")
|
@cctype("cc.Label")
|
||||||
export class CCLabel extends CCComponent{
|
export class CCLabel extends CCComponent {
|
||||||
|
|
||||||
@ccversion(EditorVersion.all)
|
@ccversion(EditorVersion.all)
|
||||||
_srcBlendFactor: number = 770; // 3.4.x = 2
|
_srcBlendFactor: number = 770; // 3.4.x = 2
|
||||||
@ccversion(EditorVersion.all)
|
@ccversion(EditorVersion.all)
|
||||||
@ -28,7 +28,7 @@ export class CCLabel extends CCComponent{
|
|||||||
_spacingX: number = 0;
|
_spacingX: number = 0;
|
||||||
@ccversion(EditorVersion.all)
|
@ccversion(EditorVersion.all)
|
||||||
_underlineHeight: number = 0;
|
_underlineHeight: number = 0;
|
||||||
|
|
||||||
@ccversion(EditorVersion.v249)
|
@ccversion(EditorVersion.v249)
|
||||||
_materials: CCUUIDObject[] = [];
|
_materials: CCUUIDObject[] = [];
|
||||||
// 2.4.x
|
// 2.4.x
|
||||||
@ -69,12 +69,12 @@ export class CCLabel extends CCComponent{
|
|||||||
|
|
||||||
// 3.4.x
|
// 3.4.x
|
||||||
@ccversion(EditorVersion.v342)
|
@ccversion(EditorVersion.v342)
|
||||||
_color: CCColor = new CCColor(255,255,255,255);
|
_color: CCColor = new CCColor(255, 255, 255, 255);
|
||||||
|
|
||||||
// 3.4.x
|
// 3.4.x
|
||||||
@ccversion(EditorVersion.v342)
|
@ccversion(EditorVersion.v342)
|
||||||
_overflow: number = 0;
|
_overflow: number = 0;
|
||||||
|
|
||||||
// // 3.4.x
|
// // 3.4.x
|
||||||
@ccversion(EditorVersion.v342)
|
@ccversion(EditorVersion.v342)
|
||||||
_cacheMode = 0;
|
_cacheMode = 0;
|
||||||
@ -84,27 +84,42 @@ export class CCLabel extends CCComponent{
|
|||||||
|
|
||||||
@ccversion(EditorVersion.v342)
|
@ccversion(EditorVersion.v342)
|
||||||
_verticalAlign = 1;
|
_verticalAlign = 1;
|
||||||
|
|
||||||
@ccversion(EditorVersion.v342)
|
@ccversion(EditorVersion.v342)
|
||||||
_actualFontSize = 0;
|
_actualFontSize = 0;
|
||||||
|
|
||||||
@ccversion(EditorVersion.v342)
|
@ccversion(EditorVersion.v342)
|
||||||
_isItalic = false;
|
_isItalic = false;
|
||||||
|
|
||||||
@ccversion(EditorVersion.v342)
|
@ccversion(EditorVersion.v342)
|
||||||
_isBold = false;
|
_isBold = false;
|
||||||
|
|
||||||
@ccversion(EditorVersion.v342)
|
@ccversion(EditorVersion.v342)
|
||||||
_isUnderline = false;
|
_isUnderline = false;
|
||||||
|
|
||||||
|
@ccversion(EditorVersion.v342)
|
||||||
|
_enableOutline = false;
|
||||||
|
|
||||||
|
@ccversion(EditorVersion.v342)
|
||||||
|
_outlineColor: CCColor = new CCColor(255, 255, 255, 255);
|
||||||
|
|
||||||
|
@ccversion(EditorVersion.v342)
|
||||||
|
_outlineWidth = 0;
|
||||||
|
|
||||||
updateWithLayer(psdLayer: PsdText) {
|
updateWithLayer(psdLayer: PsdText) {
|
||||||
this._fontSize = psdLayer.fontSize;
|
this._fontSize = psdLayer.fontSize;
|
||||||
// this._actualFontSize = this._fontSize;
|
// this._actualFontSize = this._fontSize;
|
||||||
this._string = this._N$string = psdLayer.text;
|
this._string = this._N$string = psdLayer.text;
|
||||||
|
|
||||||
this._lineHeight = this._fontSize + config.textLineHeightOffset;
|
this._lineHeight = this._fontSize + config.textLineHeightOffset;
|
||||||
|
|
||||||
if(config.editorVersion >= EditorVersion.v342){
|
if (psdLayer.outline) {
|
||||||
|
this._enableOutline = true;
|
||||||
|
this._outlineColor.set(psdLayer.outline.color);
|
||||||
|
this._outlineWidth = psdLayer.outline.width;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config.editorVersion >= EditorVersion.v342) {
|
||||||
this._srcBlendFactor = 2;
|
this._srcBlendFactor = 2;
|
||||||
this._dstBlendFactor = 4;
|
this._dstBlendFactor = 4;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user