leafer-ui 1.0.5 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/web.cjs +9 -7
- package/dist/web.esm.js +9 -7
- package/dist/web.esm.min.js +1 -1
- package/dist/web.js +135 -144
- package/dist/web.min.cjs +1 -1
- package/dist/web.min.js +1 -1
- package/dist/web.module.js +135 -144
- package/dist/web.module.min.js +1 -1
- package/package.json +11 -11
package/dist/web.js
CHANGED
|
@@ -555,6 +555,12 @@ var LeaferUI = (function (exports) {
|
|
|
555
555
|
to.y = t.y + sin$4(r) * distance;
|
|
556
556
|
return to;
|
|
557
557
|
},
|
|
558
|
+
toNumberPoints(originPoints) {
|
|
559
|
+
let points = originPoints;
|
|
560
|
+
if (typeof originPoints[0] === 'object')
|
|
561
|
+
points = [], originPoints.forEach(p => points.push(p.x, p.y));
|
|
562
|
+
return points;
|
|
563
|
+
},
|
|
558
564
|
reset(t) {
|
|
559
565
|
P$5.reset(t);
|
|
560
566
|
}
|
|
@@ -1545,7 +1551,10 @@ var LeaferUI = (function (exports) {
|
|
|
1545
1551
|
|
|
1546
1552
|
class LeafData {
|
|
1547
1553
|
get __useNaturalRatio() { return true; }
|
|
1548
|
-
get __isLinePath() {
|
|
1554
|
+
get __isLinePath() {
|
|
1555
|
+
const { path } = this;
|
|
1556
|
+
return path && path.length === 6 && path[0] === 1;
|
|
1557
|
+
}
|
|
1549
1558
|
get __blendMode() {
|
|
1550
1559
|
if (this.eraser && this.eraser !== 'path')
|
|
1551
1560
|
return 'destination-out';
|
|
@@ -2308,11 +2317,12 @@ var LeaferUI = (function (exports) {
|
|
|
2308
2317
|
|
|
2309
2318
|
const { sin: sin$3, cos: cos$3, atan2: atan2$1, ceil: ceil$1, abs: abs$3, PI: PI$2, sqrt: sqrt$1, pow } = Math;
|
|
2310
2319
|
const { setPoint: setPoint$2, addPoint: addPoint$2 } = TwoPointBoundsHelper;
|
|
2311
|
-
const { set } = PointHelper;
|
|
2320
|
+
const { set, toNumberPoints } = PointHelper;
|
|
2312
2321
|
const { M: M$5, L: L$6, C: C$5, Q: Q$4, Z: Z$5 } = PathCommandMap;
|
|
2313
2322
|
const tempPoint$2 = {};
|
|
2314
2323
|
const BezierHelper = {
|
|
2315
|
-
points(data,
|
|
2324
|
+
points(data, originPoints, curve, close) {
|
|
2325
|
+
let points = toNumberPoints(originPoints);
|
|
2316
2326
|
data.push(M$5, points[0], points[1]);
|
|
2317
2327
|
if (curve && points.length > 5) {
|
|
2318
2328
|
let aX, aY, bX, bY, cX, cY, c1X, c1Y, c2X, c2Y;
|
|
@@ -2821,6 +2831,27 @@ var LeaferUI = (function (exports) {
|
|
|
2821
2831
|
}
|
|
2822
2832
|
return data;
|
|
2823
2833
|
},
|
|
2834
|
+
objectToCanvasData(list) {
|
|
2835
|
+
const data = [];
|
|
2836
|
+
list.forEach(item => {
|
|
2837
|
+
switch (item.name) {
|
|
2838
|
+
case 'M':
|
|
2839
|
+
data.push(M$4, item.x, item.y);
|
|
2840
|
+
break;
|
|
2841
|
+
case 'L':
|
|
2842
|
+
data.push(L$5, item.x, item.y);
|
|
2843
|
+
break;
|
|
2844
|
+
case 'C':
|
|
2845
|
+
data.push(C$4, item.x1, item.y1, item.x2, item.y2, item.x, item.y);
|
|
2846
|
+
break;
|
|
2847
|
+
case 'Q':
|
|
2848
|
+
data.push(Q$3, item.x1, item.y1, item.x, item.y);
|
|
2849
|
+
break;
|
|
2850
|
+
case 'Z': data.push(Z$4);
|
|
2851
|
+
}
|
|
2852
|
+
});
|
|
2853
|
+
return data;
|
|
2854
|
+
},
|
|
2824
2855
|
copyData(data, old, index, count) {
|
|
2825
2856
|
for (let i = index, end = index + count; i < end; i++) {
|
|
2826
2857
|
data.push(old[i]);
|
|
@@ -4398,13 +4429,10 @@ var LeaferUI = (function (exports) {
|
|
|
4398
4429
|
update() {
|
|
4399
4430
|
const { leafer } = this.leaf;
|
|
4400
4431
|
if (leafer) {
|
|
4401
|
-
if (leafer.ready)
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
}
|
|
4405
|
-
else {
|
|
4432
|
+
if (leafer.ready)
|
|
4433
|
+
leafer.watcher.changed && leafer.layouter.layout();
|
|
4434
|
+
else
|
|
4406
4435
|
leafer.start();
|
|
4407
|
-
}
|
|
4408
4436
|
}
|
|
4409
4437
|
else {
|
|
4410
4438
|
let root = this.leaf;
|
|
@@ -5162,7 +5190,7 @@ var LeaferUI = (function (exports) {
|
|
|
5162
5190
|
if (this.__worldOpacity) {
|
|
5163
5191
|
canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
|
|
5164
5192
|
this.__drawRenderPath(canvas);
|
|
5165
|
-
this.
|
|
5193
|
+
this.windingRule ? canvas.clip(this.windingRule) : canvas.clip();
|
|
5166
5194
|
}
|
|
5167
5195
|
},
|
|
5168
5196
|
__updateWorldOpacity() {
|
|
@@ -5679,11 +5707,17 @@ var LeaferUI = (function (exports) {
|
|
|
5679
5707
|
add(child, index) {
|
|
5680
5708
|
if (child === this)
|
|
5681
5709
|
return;
|
|
5682
|
-
|
|
5710
|
+
const noIndex = index === undefined;
|
|
5711
|
+
if (!child.__) {
|
|
5712
|
+
if (child instanceof Array)
|
|
5713
|
+
return child.forEach(item => { this.add(item, index); noIndex || index++; });
|
|
5714
|
+
else
|
|
5715
|
+
child = UICreator.get(child.tag, child);
|
|
5716
|
+
}
|
|
5683
5717
|
if (child.parent)
|
|
5684
5718
|
child.parent.remove(child);
|
|
5685
5719
|
child.parent = this;
|
|
5686
|
-
|
|
5720
|
+
noIndex ? this.children.push(child) : this.children.splice(index, 0, child);
|
|
5687
5721
|
if (child.isBranch)
|
|
5688
5722
|
this.__.__childBranchNumber = (this.__.__childBranchNumber || 0) + 1;
|
|
5689
5723
|
child.__layout.boxChanged || child.__layout.boxChange();
|
|
@@ -5697,9 +5731,7 @@ var LeaferUI = (function (exports) {
|
|
|
5697
5731
|
}
|
|
5698
5732
|
this.__layout.affectChildrenSort && this.__layout.childrenSortChange();
|
|
5699
5733
|
}
|
|
5700
|
-
addMany(...children) {
|
|
5701
|
-
children.forEach(child => this.add(child));
|
|
5702
|
-
}
|
|
5734
|
+
addMany(...children) { this.add(children); }
|
|
5703
5735
|
remove(child, destroy) {
|
|
5704
5736
|
if (child) {
|
|
5705
5737
|
if (child.__) {
|
|
@@ -5927,7 +5959,7 @@ var LeaferUI = (function (exports) {
|
|
|
5927
5959
|
}
|
|
5928
5960
|
}
|
|
5929
5961
|
|
|
5930
|
-
const version = "1.0.
|
|
5962
|
+
const version = "1.0.7";
|
|
5931
5963
|
|
|
5932
5964
|
const debug$7 = Debug.get('LeaferCanvas');
|
|
5933
5965
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
@@ -6085,7 +6117,7 @@ var LeaferUI = (function (exports) {
|
|
|
6085
6117
|
const oldSize = {};
|
|
6086
6118
|
DataHelper.copyAttrs(oldSize, this, canvasSizeAttrs);
|
|
6087
6119
|
this.resize(size);
|
|
6088
|
-
if (this.width !== undefined)
|
|
6120
|
+
if (this.resizeListener && this.width !== undefined)
|
|
6089
6121
|
this.resizeListener(new ResizeEvent(size, oldSize));
|
|
6090
6122
|
}
|
|
6091
6123
|
unrealCanvas() {
|
|
@@ -6819,7 +6851,8 @@ var LeaferUI = (function (exports) {
|
|
|
6819
6851
|
path.add(leaf);
|
|
6820
6852
|
leaf = leaf.parent;
|
|
6821
6853
|
}
|
|
6822
|
-
|
|
6854
|
+
if (this.target)
|
|
6855
|
+
path.add(this.target);
|
|
6823
6856
|
return path;
|
|
6824
6857
|
}
|
|
6825
6858
|
getHitablePath(leaf) {
|
|
@@ -6905,8 +6938,8 @@ var LeaferUI = (function (exports) {
|
|
|
6905
6938
|
this.innerIdMap = {};
|
|
6906
6939
|
this.idMap = {};
|
|
6907
6940
|
this.methods = {
|
|
6908
|
-
id: (leaf, name) => leaf.id === name ? (this.idMap[name] = leaf, 1) : 0,
|
|
6909
|
-
innerId: (leaf, innerId) => leaf.innerId === innerId ? (this.innerIdMap[innerId] = leaf, 1) : 0,
|
|
6941
|
+
id: (leaf, name) => leaf.id === name ? (this.target && (this.idMap[name] = leaf), 1) : 0,
|
|
6942
|
+
innerId: (leaf, innerId) => leaf.innerId === innerId ? (this.target && (this.innerIdMap[innerId] = leaf), 1) : 0,
|
|
6910
6943
|
className: (leaf, name) => leaf.className === name ? 1 : 0,
|
|
6911
6944
|
tag: (leaf, name) => leaf.__tag === name ? 1 : 0,
|
|
6912
6945
|
tags: (leaf, nameMap) => nameMap[leaf.__tag] ? 1 : 0
|
|
@@ -6915,7 +6948,8 @@ var LeaferUI = (function (exports) {
|
|
|
6915
6948
|
if (userConfig)
|
|
6916
6949
|
this.config = DataHelper.default(userConfig, this.config);
|
|
6917
6950
|
this.picker = new Picker(target, this);
|
|
6918
|
-
|
|
6951
|
+
if (target)
|
|
6952
|
+
this.__listenEvents();
|
|
6919
6953
|
}
|
|
6920
6954
|
getBy(condition, branch, one, options) {
|
|
6921
6955
|
switch (typeof condition) {
|
|
@@ -6950,7 +6984,7 @@ var LeaferUI = (function (exports) {
|
|
|
6950
6984
|
}
|
|
6951
6985
|
}
|
|
6952
6986
|
getByPoint(hitPoint, hitRadius, options) {
|
|
6953
|
-
if (Platform.name === 'node')
|
|
6987
|
+
if (Platform.name === 'node' && this.target)
|
|
6954
6988
|
this.target.emit(LayoutEvent.CHECK_UPDATE);
|
|
6955
6989
|
return this.picker.getByPoint(hitPoint, hitRadius, options);
|
|
6956
6990
|
}
|
|
@@ -7080,6 +7114,13 @@ var LeaferUI = (function (exports) {
|
|
|
7080
7114
|
|
|
7081
7115
|
const TextConvert = {};
|
|
7082
7116
|
const ColorConvert = {};
|
|
7117
|
+
const UnitConvert = {
|
|
7118
|
+
number(value, percentRefer) {
|
|
7119
|
+
if (typeof value === 'object')
|
|
7120
|
+
return value.type === 'percent' ? value.value * percentRefer : value.value;
|
|
7121
|
+
return value;
|
|
7122
|
+
}
|
|
7123
|
+
};
|
|
7083
7124
|
const PathArrow = {};
|
|
7084
7125
|
const Paint = {};
|
|
7085
7126
|
const PaintImage = {};
|
|
@@ -7100,7 +7141,7 @@ var LeaferUI = (function (exports) {
|
|
|
7100
7141
|
}
|
|
7101
7142
|
};
|
|
7102
7143
|
|
|
7103
|
-
const { parse } = PathConvert;
|
|
7144
|
+
const { parse, objectToCanvasData } = PathConvert;
|
|
7104
7145
|
const emptyPaint = {};
|
|
7105
7146
|
const debug$4 = Debug.get('UIData');
|
|
7106
7147
|
class UIData extends LeafData {
|
|
@@ -7114,10 +7155,11 @@ var LeaferUI = (function (exports) {
|
|
|
7114
7155
|
scaleX = -scaleX;
|
|
7115
7156
|
return scaleX > 1 ? strokeWidth / scaleX : strokeWidth;
|
|
7116
7157
|
}
|
|
7117
|
-
else
|
|
7158
|
+
else
|
|
7118
7159
|
return strokeWidth;
|
|
7119
|
-
}
|
|
7120
7160
|
}
|
|
7161
|
+
get __hasStroke() { return this.stroke && this.strokeWidth; }
|
|
7162
|
+
get __clipAfterFill() { return (this.cornerRadius || this.__pathInputed); }
|
|
7121
7163
|
get __autoWidth() { return !this._width; }
|
|
7122
7164
|
get __autoHeight() { return !this._height; }
|
|
7123
7165
|
get __autoSide() { return !this._width || !this._height; }
|
|
@@ -7134,9 +7176,8 @@ var LeaferUI = (function (exports) {
|
|
|
7134
7176
|
this.__leaf.scaleX *= -1;
|
|
7135
7177
|
debug$4.warn('width < 0, instead -scaleX ', this);
|
|
7136
7178
|
}
|
|
7137
|
-
else
|
|
7179
|
+
else
|
|
7138
7180
|
this._width = value;
|
|
7139
|
-
}
|
|
7140
7181
|
}
|
|
7141
7182
|
setHeight(value) {
|
|
7142
7183
|
if (value < 0) {
|
|
@@ -7144,9 +7185,8 @@ var LeaferUI = (function (exports) {
|
|
|
7144
7185
|
this.__leaf.scaleY *= -1;
|
|
7145
7186
|
debug$4.warn('height < 0, instead -scaleY', this);
|
|
7146
7187
|
}
|
|
7147
|
-
else
|
|
7188
|
+
else
|
|
7148
7189
|
this._height = value;
|
|
7149
|
-
}
|
|
7150
7190
|
}
|
|
7151
7191
|
setFill(value) {
|
|
7152
7192
|
if (this.__naturalWidth)
|
|
@@ -7187,9 +7227,10 @@ var LeaferUI = (function (exports) {
|
|
|
7187
7227
|
}
|
|
7188
7228
|
}
|
|
7189
7229
|
setPath(value) {
|
|
7190
|
-
|
|
7230
|
+
const isString = typeof value === 'string';
|
|
7231
|
+
if (isString || (value && typeof value[0] === 'object')) {
|
|
7191
7232
|
this.__setInput('path', value);
|
|
7192
|
-
this._path = parse(value);
|
|
7233
|
+
this._path = isString ? parse(value) : objectToCanvasData(value);
|
|
7193
7234
|
}
|
|
7194
7235
|
else {
|
|
7195
7236
|
if (this.__input)
|
|
@@ -7204,12 +7245,8 @@ var LeaferUI = (function (exports) {
|
|
|
7204
7245
|
value = value.filter((item) => item.visible !== false);
|
|
7205
7246
|
this._shadow = value.length ? value : null;
|
|
7206
7247
|
}
|
|
7207
|
-
else
|
|
7208
|
-
this._shadow = value.visible
|
|
7209
|
-
}
|
|
7210
|
-
else {
|
|
7211
|
-
this._shadow = null;
|
|
7212
|
-
}
|
|
7248
|
+
else
|
|
7249
|
+
this._shadow = value && value.visible !== false ? [value] : null;
|
|
7213
7250
|
}
|
|
7214
7251
|
setInnerShadow(value) {
|
|
7215
7252
|
this.__setInput('innerShadow', value);
|
|
@@ -7218,12 +7255,8 @@ var LeaferUI = (function (exports) {
|
|
|
7218
7255
|
value = value.filter((item) => item.visible !== false);
|
|
7219
7256
|
this._innerShadow = value.length ? value : null;
|
|
7220
7257
|
}
|
|
7221
|
-
else
|
|
7222
|
-
this._innerShadow = value.visible
|
|
7223
|
-
}
|
|
7224
|
-
else {
|
|
7225
|
-
this._innerShadow = null;
|
|
7226
|
-
}
|
|
7258
|
+
else
|
|
7259
|
+
this._innerShadow = value && value.visible !== false ? [value] : null;
|
|
7227
7260
|
}
|
|
7228
7261
|
__computePaint() {
|
|
7229
7262
|
const { fill, stroke } = this.__input;
|
|
@@ -7234,24 +7267,19 @@ var LeaferUI = (function (exports) {
|
|
|
7234
7267
|
this.__needComputePaint = false;
|
|
7235
7268
|
}
|
|
7236
7269
|
}
|
|
7237
|
-
const UnitConvert = {
|
|
7238
|
-
number(value, percentRefer) {
|
|
7239
|
-
if (typeof value === 'object')
|
|
7240
|
-
return value.type === 'percent' ? value.value * percentRefer : value.value;
|
|
7241
|
-
return value;
|
|
7242
|
-
}
|
|
7243
|
-
};
|
|
7244
7270
|
|
|
7245
7271
|
class GroupData extends UIData {
|
|
7246
7272
|
}
|
|
7247
7273
|
|
|
7248
7274
|
class BoxData extends GroupData {
|
|
7249
7275
|
get __boxStroke() { return !this.__pathInputed; }
|
|
7276
|
+
get __drawAfterFill() { return this.overflow === 'hide' && this.__clipAfterFill && this.__leaf.children.length; }
|
|
7277
|
+
get __clipAfterFill() { return this.__leaf.isOverflow || super.__clipAfterFill; }
|
|
7250
7278
|
}
|
|
7251
7279
|
|
|
7252
7280
|
class LeaferData extends GroupData {
|
|
7253
|
-
__getInputData() {
|
|
7254
|
-
const data = super.__getInputData();
|
|
7281
|
+
__getInputData(names, options) {
|
|
7282
|
+
const data = super.__getInputData(names, options);
|
|
7255
7283
|
canvasSizeAttrs.forEach(key => delete data[key]);
|
|
7256
7284
|
return data;
|
|
7257
7285
|
}
|
|
@@ -7278,6 +7306,7 @@ var LeaferUI = (function (exports) {
|
|
|
7278
7306
|
}
|
|
7279
7307
|
|
|
7280
7308
|
class PathData extends UIData {
|
|
7309
|
+
get __pathInputed() { return 2; }
|
|
7281
7310
|
}
|
|
7282
7311
|
|
|
7283
7312
|
class PenData extends GroupData {
|
|
@@ -7324,16 +7353,18 @@ var LeaferUI = (function (exports) {
|
|
|
7324
7353
|
delete data.fill;
|
|
7325
7354
|
return data;
|
|
7326
7355
|
}
|
|
7327
|
-
__getInputData() {
|
|
7328
|
-
const data = super.__getInputData();
|
|
7356
|
+
__getInputData(names, options) {
|
|
7357
|
+
const data = super.__getInputData(names, options);
|
|
7329
7358
|
delete data.fill;
|
|
7330
7359
|
return data;
|
|
7331
7360
|
}
|
|
7332
7361
|
}
|
|
7333
7362
|
|
|
7334
7363
|
class CanvasData extends RectData {
|
|
7335
|
-
|
|
7336
|
-
|
|
7364
|
+
get __isCanvas() { return true; }
|
|
7365
|
+
get __drawAfterFill() { return true; }
|
|
7366
|
+
__getInputData(names, options) {
|
|
7367
|
+
const data = super.__getInputData(names, options);
|
|
7337
7368
|
data.url = this.__leaf.canvas.toDataURL('image/png');
|
|
7338
7369
|
return data;
|
|
7339
7370
|
}
|
|
@@ -7360,16 +7391,12 @@ var LeaferUI = (function (exports) {
|
|
|
7360
7391
|
let width = 0;
|
|
7361
7392
|
const { shadow, innerShadow, blur, backgroundBlur } = this.__;
|
|
7362
7393
|
if (shadow)
|
|
7363
|
-
shadow.forEach(item =>
|
|
7364
|
-
width = Math.max(width, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread > 0 ? item.spread : 0) + item.blur * 1.5);
|
|
7365
|
-
});
|
|
7394
|
+
shadow.forEach(item => width = Math.max(width, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread > 0 ? item.spread : 0) + item.blur * 1.5));
|
|
7366
7395
|
if (blur)
|
|
7367
7396
|
width = Math.max(width, blur);
|
|
7368
7397
|
let shapeWidth = width = Math.ceil(width);
|
|
7369
7398
|
if (innerShadow)
|
|
7370
|
-
innerShadow.forEach(item =>
|
|
7371
|
-
shapeWidth = Math.max(shapeWidth, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread < 0 ? -item.spread : 0) + item.blur * 1.5);
|
|
7372
|
-
});
|
|
7399
|
+
innerShadow.forEach(item => shapeWidth = Math.max(shapeWidth, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread < 0 ? -item.spread : 0) + item.blur * 1.5));
|
|
7373
7400
|
if (backgroundBlur)
|
|
7374
7401
|
shapeWidth = Math.max(shapeWidth, backgroundBlur);
|
|
7375
7402
|
this.__layout.renderShapeSpread = shapeWidth;
|
|
@@ -7451,6 +7478,16 @@ var LeaferUI = (function (exports) {
|
|
|
7451
7478
|
if (stroke && !ignoreStroke)
|
|
7452
7479
|
this.__.__pixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
|
|
7453
7480
|
}
|
|
7481
|
+
},
|
|
7482
|
+
__drawAfterFill(canvas, options) {
|
|
7483
|
+
if (this.__.__clipAfterFill) {
|
|
7484
|
+
canvas.save();
|
|
7485
|
+
this.windingRule ? canvas.clip(this.windingRule) : canvas.clip();
|
|
7486
|
+
this.__drawContent(canvas, options);
|
|
7487
|
+
canvas.restore();
|
|
7488
|
+
}
|
|
7489
|
+
else
|
|
7490
|
+
this.__drawContent(canvas, options);
|
|
7454
7491
|
}
|
|
7455
7492
|
};
|
|
7456
7493
|
function drawFast(ui, canvas, options) {
|
|
@@ -7517,8 +7554,8 @@ var LeaferUI = (function (exports) {
|
|
|
7517
7554
|
return pen;
|
|
7518
7555
|
}
|
|
7519
7556
|
get editConfig() { return undefined; }
|
|
7520
|
-
get editOuter() { return
|
|
7521
|
-
get editInner() { return '
|
|
7557
|
+
get editOuter() { return ''; }
|
|
7558
|
+
get editInner() { return ''; }
|
|
7522
7559
|
constructor(data) {
|
|
7523
7560
|
super(data);
|
|
7524
7561
|
}
|
|
@@ -7529,9 +7566,8 @@ var LeaferUI = (function (exports) {
|
|
|
7529
7566
|
Object.assign(this, data);
|
|
7530
7567
|
this.lockNormalStyle = false;
|
|
7531
7568
|
}
|
|
7532
|
-
else
|
|
7569
|
+
else
|
|
7533
7570
|
Object.assign(this, data);
|
|
7534
|
-
}
|
|
7535
7571
|
}
|
|
7536
7572
|
get(name) {
|
|
7537
7573
|
return typeof name === 'string' ? this.__.__getInput(name) : this.__.__getInputData(name);
|
|
@@ -7833,23 +7869,13 @@ var LeaferUI = (function (exports) {
|
|
|
7833
7869
|
if (data.children) {
|
|
7834
7870
|
const { children } = data;
|
|
7835
7871
|
delete data.children;
|
|
7836
|
-
|
|
7837
|
-
this.__setBranch();
|
|
7838
|
-
}
|
|
7839
|
-
else {
|
|
7840
|
-
this.clear();
|
|
7841
|
-
}
|
|
7872
|
+
this.children ? this.clear() : this.__setBranch();
|
|
7842
7873
|
super.set(data, isTemp);
|
|
7843
|
-
|
|
7844
|
-
children.forEach(childData => {
|
|
7845
|
-
child = childData.__ ? childData : UICreator.get(childData.tag, childData);
|
|
7846
|
-
this.add(child);
|
|
7847
|
-
});
|
|
7874
|
+
children.forEach(child => this.add(child));
|
|
7848
7875
|
data.children = children;
|
|
7849
7876
|
}
|
|
7850
|
-
else
|
|
7877
|
+
else
|
|
7851
7878
|
super.set(data, isTemp);
|
|
7852
|
-
}
|
|
7853
7879
|
}
|
|
7854
7880
|
toJSON(options) {
|
|
7855
7881
|
const data = super.toJSON(options);
|
|
@@ -8281,9 +8307,7 @@ var LeaferUI = (function (exports) {
|
|
|
8281
8307
|
}
|
|
8282
8308
|
__updateStrokeSpread() { return 0; }
|
|
8283
8309
|
__updateRectRenderSpread() { return 0; }
|
|
8284
|
-
__updateRenderSpread() {
|
|
8285
|
-
return this.__updateRectRenderSpread() || -1;
|
|
8286
|
-
}
|
|
8310
|
+
__updateRenderSpread() { return this.__updateRectRenderSpread() || -1; }
|
|
8287
8311
|
__updateRectBoxBounds() { }
|
|
8288
8312
|
__updateBoxBounds(_secondLayout) {
|
|
8289
8313
|
const data = this.__;
|
|
@@ -8303,13 +8327,11 @@ var LeaferUI = (function (exports) {
|
|
|
8303
8327
|
}
|
|
8304
8328
|
this.__updateNaturalSize();
|
|
8305
8329
|
}
|
|
8306
|
-
else
|
|
8330
|
+
else
|
|
8307
8331
|
this.__updateRectBoxBounds();
|
|
8308
|
-
}
|
|
8309
8332
|
}
|
|
8310
|
-
else
|
|
8333
|
+
else
|
|
8311
8334
|
this.__updateRectBoxBounds();
|
|
8312
|
-
}
|
|
8313
8335
|
}
|
|
8314
8336
|
__updateStrokeBounds() { }
|
|
8315
8337
|
__updateRenderBounds() {
|
|
@@ -8319,14 +8341,13 @@ var LeaferUI = (function (exports) {
|
|
|
8319
8341
|
super.__updateRenderBounds();
|
|
8320
8342
|
copy$3(childrenRenderBounds, renderBounds);
|
|
8321
8343
|
this.__updateRectRenderBounds();
|
|
8322
|
-
isOverflow = !includes$1(renderBounds, childrenRenderBounds)
|
|
8344
|
+
isOverflow = !includes$1(renderBounds, childrenRenderBounds);
|
|
8345
|
+
if (isOverflow && this.__.overflow !== 'hide')
|
|
8346
|
+
add(renderBounds, childrenRenderBounds);
|
|
8323
8347
|
}
|
|
8324
|
-
else
|
|
8348
|
+
else
|
|
8325
8349
|
this.__updateRectRenderBounds();
|
|
8326
|
-
|
|
8327
|
-
this.isOverflow !== isOverflow && (this.isOverflow = isOverflow);
|
|
8328
|
-
if (!(this.__.__drawAfterFill = this.__.overflow === 'hide') && isOverflow)
|
|
8329
|
-
add(renderBounds, childrenRenderBounds);
|
|
8350
|
+
!this.isOverflow !== !isOverflow && (this.isOverflow = isOverflow);
|
|
8330
8351
|
}
|
|
8331
8352
|
__updateRectRenderBounds() { }
|
|
8332
8353
|
__updateRectChange() { }
|
|
@@ -8346,20 +8367,9 @@ var LeaferUI = (function (exports) {
|
|
|
8346
8367
|
this.__renderGroup(canvas, options);
|
|
8347
8368
|
}
|
|
8348
8369
|
}
|
|
8349
|
-
|
|
8350
|
-
|
|
8351
|
-
if (this.
|
|
8352
|
-
canvas.save();
|
|
8353
|
-
canvas.clip();
|
|
8354
|
-
if (length)
|
|
8355
|
-
this.__renderGroup(canvas, options);
|
|
8356
|
-
canvas.restore();
|
|
8357
|
-
}
|
|
8358
|
-
else {
|
|
8359
|
-
if (length)
|
|
8360
|
-
this.__renderGroup(canvas, options);
|
|
8361
|
-
}
|
|
8362
|
-
if (this.__.stroke && length) {
|
|
8370
|
+
__drawContent(canvas, options) {
|
|
8371
|
+
this.__renderGroup(canvas, options);
|
|
8372
|
+
if (this.__.__hasStroke) {
|
|
8363
8373
|
canvas.setWorld(this.__nowWorld);
|
|
8364
8374
|
this.__drawRenderPath(canvas);
|
|
8365
8375
|
}
|
|
@@ -8523,17 +8533,15 @@ var LeaferUI = (function (exports) {
|
|
|
8523
8533
|
if (data.__useArrow)
|
|
8524
8534
|
PathArrow.addArrows(this, false);
|
|
8525
8535
|
}
|
|
8526
|
-
else
|
|
8536
|
+
else
|
|
8527
8537
|
super.__updateRenderPath();
|
|
8528
|
-
}
|
|
8529
8538
|
}
|
|
8530
8539
|
__updateBoxBounds() {
|
|
8531
8540
|
if (this.points) {
|
|
8532
8541
|
toBounds$1(this.__.__pathForRender, this.__layout.boxBounds);
|
|
8533
8542
|
}
|
|
8534
|
-
else
|
|
8543
|
+
else
|
|
8535
8544
|
super.__updateBoxBounds();
|
|
8536
|
-
}
|
|
8537
8545
|
}
|
|
8538
8546
|
};
|
|
8539
8547
|
__decorate([
|
|
@@ -8671,7 +8679,6 @@ var LeaferUI = (function (exports) {
|
|
|
8671
8679
|
super(data);
|
|
8672
8680
|
this.canvas = Creator.canvas(this.__);
|
|
8673
8681
|
this.context = this.canvas.context;
|
|
8674
|
-
this.__.__isCanvas = this.__.__drawAfterFill = true;
|
|
8675
8682
|
if (data && data.url)
|
|
8676
8683
|
this.drawImage(data.url);
|
|
8677
8684
|
}
|
|
@@ -8684,8 +8691,7 @@ var LeaferUI = (function (exports) {
|
|
|
8684
8691
|
});
|
|
8685
8692
|
}
|
|
8686
8693
|
draw(ui, offset, scale, rotation) {
|
|
8687
|
-
ui.
|
|
8688
|
-
const matrix = new Matrix(ui.__world).invert();
|
|
8694
|
+
const matrix = new Matrix(ui.worldTransform).invert();
|
|
8689
8695
|
const m = new Matrix();
|
|
8690
8696
|
if (offset)
|
|
8691
8697
|
m.translate(offset.x, offset.y);
|
|
@@ -8700,17 +8706,9 @@ var LeaferUI = (function (exports) {
|
|
|
8700
8706
|
paint() {
|
|
8701
8707
|
this.forceRender();
|
|
8702
8708
|
}
|
|
8703
|
-
|
|
8704
|
-
const { width, height
|
|
8705
|
-
|
|
8706
|
-
canvas.save();
|
|
8707
|
-
canvas.clip();
|
|
8708
|
-
canvas.drawImage(view, 0, 0, view.width, view.height, 0, 0, width, height);
|
|
8709
|
-
canvas.restore();
|
|
8710
|
-
}
|
|
8711
|
-
else {
|
|
8712
|
-
canvas.drawImage(view, 0, 0, view.width, view.height, 0, 0, width, height);
|
|
8713
|
-
}
|
|
8709
|
+
__drawContent(canvas, _options) {
|
|
8710
|
+
const { width, height } = this.__, { view } = this.canvas;
|
|
8711
|
+
canvas.drawImage(view, 0, 0, view.width, view.height, 0, 0, width, height);
|
|
8714
8712
|
}
|
|
8715
8713
|
__updateSize() {
|
|
8716
8714
|
const { canvas } = this;
|
|
@@ -8754,7 +8752,6 @@ var LeaferUI = (function (exports) {
|
|
|
8754
8752
|
const { copyAndSpread, includes, isSame: isSame$1, spread, setList } = BoundsHelper;
|
|
8755
8753
|
exports.Text = class Text extends exports.UI {
|
|
8756
8754
|
get __tag() { return 'Text'; }
|
|
8757
|
-
get editInner() { return 'TextEditor'; }
|
|
8758
8755
|
get textDrawData() {
|
|
8759
8756
|
this.__layout.update();
|
|
8760
8757
|
return this.__.__textDrawData;
|
|
@@ -8829,9 +8826,8 @@ var LeaferUI = (function (exports) {
|
|
|
8829
8826
|
layout.renderChanged = true;
|
|
8830
8827
|
setList(data.__textBoxBounds = {}, [b, bounds]);
|
|
8831
8828
|
}
|
|
8832
|
-
else
|
|
8829
|
+
else
|
|
8833
8830
|
data.__textBoxBounds = contentBounds;
|
|
8834
|
-
}
|
|
8835
8831
|
}
|
|
8836
8832
|
__updateRenderSpread() {
|
|
8837
8833
|
let width = super.__updateRenderSpread();
|
|
@@ -8920,7 +8916,6 @@ var LeaferUI = (function (exports) {
|
|
|
8920
8916
|
get __tag() { return 'Path'; }
|
|
8921
8917
|
constructor(data) {
|
|
8922
8918
|
super(data);
|
|
8923
|
-
this.__.__pathInputed = 2;
|
|
8924
8919
|
}
|
|
8925
8920
|
};
|
|
8926
8921
|
__decorate([
|
|
@@ -9003,21 +8998,17 @@ var LeaferUI = (function (exports) {
|
|
|
9003
8998
|
this.tree = this.addLeafer(tree);
|
|
9004
8999
|
if (sky || editor)
|
|
9005
9000
|
this.sky = this.addLeafer(sky || { type: 'draw', usePartRender: false });
|
|
9006
|
-
if (editor)
|
|
9007
|
-
this.editor = Creator.editor(editor);
|
|
9008
|
-
this.sky.add(this.editor);
|
|
9009
|
-
}
|
|
9001
|
+
if (editor)
|
|
9002
|
+
this.sky.add(this.editor = Creator.editor(editor));
|
|
9010
9003
|
}
|
|
9011
9004
|
}
|
|
9012
9005
|
__setApp() {
|
|
9013
9006
|
const { canvas } = this;
|
|
9014
9007
|
const { realCanvas, view } = this.config;
|
|
9015
|
-
if (realCanvas || view === this.canvas.view || !canvas.parentView)
|
|
9008
|
+
if (realCanvas || view === this.canvas.view || !canvas.parentView)
|
|
9016
9009
|
this.realCanvas = true;
|
|
9017
|
-
|
|
9018
|
-
else {
|
|
9010
|
+
else
|
|
9019
9011
|
canvas.unrealCanvas();
|
|
9020
|
-
}
|
|
9021
9012
|
this.leafer = this;
|
|
9022
9013
|
this.watcher.disable();
|
|
9023
9014
|
this.layouter.disable();
|
|
@@ -9423,10 +9414,7 @@ var LeaferUI = (function (exports) {
|
|
|
9423
9414
|
leafer.getValidMove = function (moveX, moveY) {
|
|
9424
9415
|
const { scroll, disabled } = this.app.config.move;
|
|
9425
9416
|
if (scroll) {
|
|
9426
|
-
|
|
9427
|
-
moveY = 0;
|
|
9428
|
-
else
|
|
9429
|
-
moveX = 0;
|
|
9417
|
+
Math.abs(moveX) > Math.abs(moveY) ? moveY = 0 : moveX = 0;
|
|
9430
9418
|
if (scroll === 'limit') {
|
|
9431
9419
|
const { x, y, width, height } = new Bounds(this.__world).addPoint(this.zoomLayer);
|
|
9432
9420
|
const right = x + width - this.width, bottom = y + height - this.height;
|
|
@@ -10513,17 +10501,20 @@ var LeaferUI = (function (exports) {
|
|
|
10513
10501
|
};
|
|
10514
10502
|
|
|
10515
10503
|
const ui = exports.UI.prototype, group = exports.Group.prototype;
|
|
10504
|
+
function getSelector(ui) {
|
|
10505
|
+
return ui.leafer ? ui.leafer.selector : (Platform.selector || (Platform.selector = Creator.selector()));
|
|
10506
|
+
}
|
|
10516
10507
|
ui.find = function (condition, options) {
|
|
10517
|
-
return this.
|
|
10508
|
+
return getSelector(this).getBy(condition, this, false, options);
|
|
10518
10509
|
};
|
|
10519
10510
|
ui.findOne = function (condition, options) {
|
|
10520
|
-
return this.
|
|
10511
|
+
return getSelector(this).getBy(condition, this, true, options);
|
|
10521
10512
|
};
|
|
10522
10513
|
group.pick = function (hitPoint, options) {
|
|
10523
10514
|
this.__layout.update();
|
|
10524
10515
|
if (!options)
|
|
10525
10516
|
options = {};
|
|
10526
|
-
return this.
|
|
10517
|
+
return getSelector(this).getByPoint(hitPoint, options.hitRadius || 0, Object.assign(Object.assign({}, options), { target: this }));
|
|
10527
10518
|
};
|
|
10528
10519
|
|
|
10529
10520
|
const canvas$1 = LeaferCanvasBase.prototype;
|
|
@@ -11510,7 +11501,7 @@ var LeaferUI = (function (exports) {
|
|
|
11510
11501
|
}
|
|
11511
11502
|
if (allowPaint) {
|
|
11512
11503
|
canvas.save();
|
|
11513
|
-
canvas.clip();
|
|
11504
|
+
ui.windingRule ? canvas.clip(ui.windingRule) : canvas.clip();
|
|
11514
11505
|
if (paint.blendMode)
|
|
11515
11506
|
canvas.blendMode = paint.blendMode;
|
|
11516
11507
|
if (data.opacity)
|