mirror of
https://gitee.com/onvia/ccc-tnt-psd2ui
synced 2026-03-21 05:31:42 +00:00
两个版本的插件
This commit is contained in:
44
ccc-tnt-psd2ui-v3.4.+/libs/psd2ui/psd/PsdGroup.js
Normal file
44
ccc-tnt-psd2ui-v3.4.+/libs/psd2ui/psd/PsdGroup.js
Normal file
@@ -0,0 +1,44 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.PsdGroup = void 0;
|
||||
const Rect_1 = require("../values/Rect");
|
||||
const PsdLayer_1 = require("./PsdLayer");
|
||||
class PsdGroup extends PsdLayer_1.PsdLayer {
|
||||
constructor(source, parent, rootDoc) {
|
||||
super(source, parent, rootDoc);
|
||||
this.children = [];
|
||||
if (rootDoc) {
|
||||
this.rect = new Rect_1.Rect(0, rootDoc.size.width, 0, rootDoc.size.height);
|
||||
}
|
||||
}
|
||||
parseSource() {
|
||||
var _a;
|
||||
super.parseSource();
|
||||
if (!((_a = this.attr) === null || _a === void 0 ? void 0 : _a.comps.full)) {
|
||||
this.resize();
|
||||
this.computeBasePosition();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
resize() {
|
||||
let left = Number.MAX_SAFE_INTEGER;
|
||||
let right = Number.MIN_SAFE_INTEGER;
|
||||
let top = Number.MAX_SAFE_INTEGER;
|
||||
let bottom = Number.MIN_SAFE_INTEGER;
|
||||
for (let i = 0; i < this.children.length; i++) {
|
||||
const element = this.children[i];
|
||||
let _rect = element.rect;
|
||||
left = Math.min(_rect.left, left);
|
||||
right = Math.max(_rect.right, right);
|
||||
top = Math.min(_rect.top, top);
|
||||
bottom = Math.max(_rect.bottom, bottom);
|
||||
}
|
||||
this.rect.left = left;
|
||||
this.rect.right = right;
|
||||
this.rect.top = top;
|
||||
this.rect.bottom = bottom;
|
||||
}
|
||||
onCtor() {
|
||||
}
|
||||
}
|
||||
exports.PsdGroup = PsdGroup;
|
||||
Reference in New Issue
Block a user