@leafer-editor/worker 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/dist/worker.js +153 -156
- package/dist/worker.min.js +1 -1
- package/dist/worker.module.js +153 -156
- package/dist/worker.module.min.js +1 -1
- package/package.json +6 -6
package/dist/worker.module.js
CHANGED
|
@@ -552,6 +552,12 @@ const PointHelper = {
|
|
|
552
552
|
to.y = t.y + sin$4(r) * distance;
|
|
553
553
|
return to;
|
|
554
554
|
},
|
|
555
|
+
toNumberPoints(originPoints) {
|
|
556
|
+
let points = originPoints;
|
|
557
|
+
if (typeof originPoints[0] === 'object')
|
|
558
|
+
points = [], originPoints.forEach(p => points.push(p.x, p.y));
|
|
559
|
+
return points;
|
|
560
|
+
},
|
|
555
561
|
reset(t) {
|
|
556
562
|
P$7.reset(t);
|
|
557
563
|
}
|
|
@@ -1542,7 +1548,10 @@ const { assign } = DataHelper;
|
|
|
1542
1548
|
|
|
1543
1549
|
class LeafData {
|
|
1544
1550
|
get __useNaturalRatio() { return true; }
|
|
1545
|
-
get __isLinePath() {
|
|
1551
|
+
get __isLinePath() {
|
|
1552
|
+
const { path } = this;
|
|
1553
|
+
return path && path.length === 6 && path[0] === 1;
|
|
1554
|
+
}
|
|
1546
1555
|
get __blendMode() {
|
|
1547
1556
|
if (this.eraser && this.eraser !== 'path')
|
|
1548
1557
|
return 'destination-out';
|
|
@@ -2305,11 +2314,12 @@ const RectHelper = {
|
|
|
2305
2314
|
|
|
2306
2315
|
const { sin: sin$3, cos: cos$3, atan2: atan2$1, ceil: ceil$1, abs: abs$4, PI: PI$2, sqrt: sqrt$1, pow } = Math;
|
|
2307
2316
|
const { setPoint: setPoint$4, addPoint: addPoint$2 } = TwoPointBoundsHelper;
|
|
2308
|
-
const { set } = PointHelper;
|
|
2317
|
+
const { set, toNumberPoints: toNumberPoints$1 } = PointHelper;
|
|
2309
2318
|
const { M: M$8, L: L$9, C: C$8, Q: Q$7, Z: Z$7 } = PathCommandMap;
|
|
2310
2319
|
const tempPoint$2 = {};
|
|
2311
2320
|
const BezierHelper = {
|
|
2312
|
-
points(data,
|
|
2321
|
+
points(data, originPoints, curve, close) {
|
|
2322
|
+
let points = toNumberPoints$1(originPoints);
|
|
2313
2323
|
data.push(M$8, points[0], points[1]);
|
|
2314
2324
|
if (curve && points.length > 5) {
|
|
2315
2325
|
let aX, aY, bX, bY, cX, cY, c1X, c1Y, c2X, c2Y;
|
|
@@ -2818,6 +2828,27 @@ const PathConvert = {
|
|
|
2818
2828
|
}
|
|
2819
2829
|
return data;
|
|
2820
2830
|
},
|
|
2831
|
+
objectToCanvasData(list) {
|
|
2832
|
+
const data = [];
|
|
2833
|
+
list.forEach(item => {
|
|
2834
|
+
switch (item.name) {
|
|
2835
|
+
case 'M':
|
|
2836
|
+
data.push(M$7, item.x, item.y);
|
|
2837
|
+
break;
|
|
2838
|
+
case 'L':
|
|
2839
|
+
data.push(L$8, item.x, item.y);
|
|
2840
|
+
break;
|
|
2841
|
+
case 'C':
|
|
2842
|
+
data.push(C$7, item.x1, item.y1, item.x2, item.y2, item.x, item.y);
|
|
2843
|
+
break;
|
|
2844
|
+
case 'Q':
|
|
2845
|
+
data.push(Q$6, item.x1, item.y1, item.x, item.y);
|
|
2846
|
+
break;
|
|
2847
|
+
case 'Z': data.push(Z$6);
|
|
2848
|
+
}
|
|
2849
|
+
});
|
|
2850
|
+
return data;
|
|
2851
|
+
},
|
|
2821
2852
|
copyData(data, old, index, count) {
|
|
2822
2853
|
for (let i = index, end = index + count; i < end; i++) {
|
|
2823
2854
|
data.push(old[i]);
|
|
@@ -4395,13 +4426,10 @@ class LeafLayout {
|
|
|
4395
4426
|
update() {
|
|
4396
4427
|
const { leafer } = this.leaf;
|
|
4397
4428
|
if (leafer) {
|
|
4398
|
-
if (leafer.ready)
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
}
|
|
4402
|
-
else {
|
|
4429
|
+
if (leafer.ready)
|
|
4430
|
+
leafer.watcher.changed && leafer.layouter.layout();
|
|
4431
|
+
else
|
|
4403
4432
|
leafer.start();
|
|
4404
|
-
}
|
|
4405
4433
|
}
|
|
4406
4434
|
else {
|
|
4407
4435
|
let root = this.leaf;
|
|
@@ -5159,7 +5187,7 @@ const LeafRender = {
|
|
|
5159
5187
|
if (this.__worldOpacity) {
|
|
5160
5188
|
canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
|
|
5161
5189
|
this.__drawRenderPath(canvas);
|
|
5162
|
-
this.
|
|
5190
|
+
this.windingRule ? canvas.clip(this.windingRule) : canvas.clip();
|
|
5163
5191
|
}
|
|
5164
5192
|
},
|
|
5165
5193
|
__updateWorldOpacity() {
|
|
@@ -5676,11 +5704,17 @@ let Branch = class Branch extends Leaf {
|
|
|
5676
5704
|
add(child, index) {
|
|
5677
5705
|
if (child === this)
|
|
5678
5706
|
return;
|
|
5679
|
-
|
|
5707
|
+
const noIndex = index === undefined;
|
|
5708
|
+
if (!child.__) {
|
|
5709
|
+
if (child instanceof Array)
|
|
5710
|
+
return child.forEach(item => { this.add(item, index); noIndex || index++; });
|
|
5711
|
+
else
|
|
5712
|
+
child = UICreator.get(child.tag, child);
|
|
5713
|
+
}
|
|
5680
5714
|
if (child.parent)
|
|
5681
5715
|
child.parent.remove(child);
|
|
5682
5716
|
child.parent = this;
|
|
5683
|
-
|
|
5717
|
+
noIndex ? this.children.push(child) : this.children.splice(index, 0, child);
|
|
5684
5718
|
if (child.isBranch)
|
|
5685
5719
|
this.__.__childBranchNumber = (this.__.__childBranchNumber || 0) + 1;
|
|
5686
5720
|
child.__layout.boxChanged || child.__layout.boxChange();
|
|
@@ -5694,9 +5728,7 @@ let Branch = class Branch extends Leaf {
|
|
|
5694
5728
|
}
|
|
5695
5729
|
this.__layout.affectChildrenSort && this.__layout.childrenSortChange();
|
|
5696
5730
|
}
|
|
5697
|
-
addMany(...children) {
|
|
5698
|
-
children.forEach(child => this.add(child));
|
|
5699
|
-
}
|
|
5731
|
+
addMany(...children) { this.add(children); }
|
|
5700
5732
|
remove(child, destroy) {
|
|
5701
5733
|
if (child) {
|
|
5702
5734
|
if (child.__) {
|
|
@@ -5924,7 +5956,7 @@ class LeafLevelList {
|
|
|
5924
5956
|
}
|
|
5925
5957
|
}
|
|
5926
5958
|
|
|
5927
|
-
const version = "1.0.
|
|
5959
|
+
const version = "1.0.7";
|
|
5928
5960
|
|
|
5929
5961
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
5930
5962
|
get allowBackgroundColor() { return true; }
|
|
@@ -6643,7 +6675,8 @@ class Picker {
|
|
|
6643
6675
|
path.add(leaf);
|
|
6644
6676
|
leaf = leaf.parent;
|
|
6645
6677
|
}
|
|
6646
|
-
|
|
6678
|
+
if (this.target)
|
|
6679
|
+
path.add(this.target);
|
|
6647
6680
|
return path;
|
|
6648
6681
|
}
|
|
6649
6682
|
getHitablePath(leaf) {
|
|
@@ -6729,8 +6762,8 @@ class Selector {
|
|
|
6729
6762
|
this.innerIdMap = {};
|
|
6730
6763
|
this.idMap = {};
|
|
6731
6764
|
this.methods = {
|
|
6732
|
-
id: (leaf, name) => leaf.id === name ? (this.idMap[name] = leaf, 1) : 0,
|
|
6733
|
-
innerId: (leaf, innerId) => leaf.innerId === innerId ? (this.innerIdMap[innerId] = leaf, 1) : 0,
|
|
6765
|
+
id: (leaf, name) => leaf.id === name ? (this.target && (this.idMap[name] = leaf), 1) : 0,
|
|
6766
|
+
innerId: (leaf, innerId) => leaf.innerId === innerId ? (this.target && (this.innerIdMap[innerId] = leaf), 1) : 0,
|
|
6734
6767
|
className: (leaf, name) => leaf.className === name ? 1 : 0,
|
|
6735
6768
|
tag: (leaf, name) => leaf.__tag === name ? 1 : 0,
|
|
6736
6769
|
tags: (leaf, nameMap) => nameMap[leaf.__tag] ? 1 : 0
|
|
@@ -6739,7 +6772,8 @@ class Selector {
|
|
|
6739
6772
|
if (userConfig)
|
|
6740
6773
|
this.config = DataHelper.default(userConfig, this.config);
|
|
6741
6774
|
this.picker = new Picker(target, this);
|
|
6742
|
-
|
|
6775
|
+
if (target)
|
|
6776
|
+
this.__listenEvents();
|
|
6743
6777
|
}
|
|
6744
6778
|
getBy(condition, branch, one, options) {
|
|
6745
6779
|
switch (typeof condition) {
|
|
@@ -6774,7 +6808,7 @@ class Selector {
|
|
|
6774
6808
|
}
|
|
6775
6809
|
}
|
|
6776
6810
|
getByPoint(hitPoint, hitRadius, options) {
|
|
6777
|
-
if (Platform.name === 'node')
|
|
6811
|
+
if (Platform.name === 'node' && this.target)
|
|
6778
6812
|
this.target.emit(LayoutEvent.CHECK_UPDATE);
|
|
6779
6813
|
return this.picker.getByPoint(hitPoint, hitRadius, options);
|
|
6780
6814
|
}
|
|
@@ -6904,6 +6938,13 @@ function zoomLayerType() {
|
|
|
6904
6938
|
|
|
6905
6939
|
const TextConvert = {};
|
|
6906
6940
|
const ColorConvert = {};
|
|
6941
|
+
const UnitConvert = {
|
|
6942
|
+
number(value, percentRefer) {
|
|
6943
|
+
if (typeof value === 'object')
|
|
6944
|
+
return value.type === 'percent' ? value.value * percentRefer : value.value;
|
|
6945
|
+
return value;
|
|
6946
|
+
}
|
|
6947
|
+
};
|
|
6907
6948
|
const PathArrow = {};
|
|
6908
6949
|
const Paint = {};
|
|
6909
6950
|
const PaintImage = {};
|
|
@@ -6924,7 +6965,7 @@ const Transition = {
|
|
|
6924
6965
|
}
|
|
6925
6966
|
};
|
|
6926
6967
|
|
|
6927
|
-
const { parse } = PathConvert;
|
|
6968
|
+
const { parse, objectToCanvasData } = PathConvert;
|
|
6928
6969
|
const emptyPaint = {};
|
|
6929
6970
|
const debug$5 = Debug.get('UIData');
|
|
6930
6971
|
class UIData extends LeafData {
|
|
@@ -6938,10 +6979,11 @@ class UIData extends LeafData {
|
|
|
6938
6979
|
scaleX = -scaleX;
|
|
6939
6980
|
return scaleX > 1 ? strokeWidth / scaleX : strokeWidth;
|
|
6940
6981
|
}
|
|
6941
|
-
else
|
|
6982
|
+
else
|
|
6942
6983
|
return strokeWidth;
|
|
6943
|
-
}
|
|
6944
6984
|
}
|
|
6985
|
+
get __hasStroke() { return this.stroke && this.strokeWidth; }
|
|
6986
|
+
get __clipAfterFill() { return (this.cornerRadius || this.__pathInputed); }
|
|
6945
6987
|
get __autoWidth() { return !this._width; }
|
|
6946
6988
|
get __autoHeight() { return !this._height; }
|
|
6947
6989
|
get __autoSide() { return !this._width || !this._height; }
|
|
@@ -6958,9 +7000,8 @@ class UIData extends LeafData {
|
|
|
6958
7000
|
this.__leaf.scaleX *= -1;
|
|
6959
7001
|
debug$5.warn('width < 0, instead -scaleX ', this);
|
|
6960
7002
|
}
|
|
6961
|
-
else
|
|
7003
|
+
else
|
|
6962
7004
|
this._width = value;
|
|
6963
|
-
}
|
|
6964
7005
|
}
|
|
6965
7006
|
setHeight(value) {
|
|
6966
7007
|
if (value < 0) {
|
|
@@ -6968,9 +7009,8 @@ class UIData extends LeafData {
|
|
|
6968
7009
|
this.__leaf.scaleY *= -1;
|
|
6969
7010
|
debug$5.warn('height < 0, instead -scaleY', this);
|
|
6970
7011
|
}
|
|
6971
|
-
else
|
|
7012
|
+
else
|
|
6972
7013
|
this._height = value;
|
|
6973
|
-
}
|
|
6974
7014
|
}
|
|
6975
7015
|
setFill(value) {
|
|
6976
7016
|
if (this.__naturalWidth)
|
|
@@ -7011,9 +7051,10 @@ class UIData extends LeafData {
|
|
|
7011
7051
|
}
|
|
7012
7052
|
}
|
|
7013
7053
|
setPath(value) {
|
|
7014
|
-
|
|
7054
|
+
const isString = typeof value === 'string';
|
|
7055
|
+
if (isString || (value && typeof value[0] === 'object')) {
|
|
7015
7056
|
this.__setInput('path', value);
|
|
7016
|
-
this._path = parse(value);
|
|
7057
|
+
this._path = isString ? parse(value) : objectToCanvasData(value);
|
|
7017
7058
|
}
|
|
7018
7059
|
else {
|
|
7019
7060
|
if (this.__input)
|
|
@@ -7028,12 +7069,8 @@ class UIData extends LeafData {
|
|
|
7028
7069
|
value = value.filter((item) => item.visible !== false);
|
|
7029
7070
|
this._shadow = value.length ? value : null;
|
|
7030
7071
|
}
|
|
7031
|
-
else
|
|
7032
|
-
this._shadow = value.visible
|
|
7033
|
-
}
|
|
7034
|
-
else {
|
|
7035
|
-
this._shadow = null;
|
|
7036
|
-
}
|
|
7072
|
+
else
|
|
7073
|
+
this._shadow = value && value.visible !== false ? [value] : null;
|
|
7037
7074
|
}
|
|
7038
7075
|
setInnerShadow(value) {
|
|
7039
7076
|
this.__setInput('innerShadow', value);
|
|
@@ -7042,12 +7079,8 @@ class UIData extends LeafData {
|
|
|
7042
7079
|
value = value.filter((item) => item.visible !== false);
|
|
7043
7080
|
this._innerShadow = value.length ? value : null;
|
|
7044
7081
|
}
|
|
7045
|
-
else
|
|
7046
|
-
this._innerShadow = value.visible
|
|
7047
|
-
}
|
|
7048
|
-
else {
|
|
7049
|
-
this._innerShadow = null;
|
|
7050
|
-
}
|
|
7082
|
+
else
|
|
7083
|
+
this._innerShadow = value && value.visible !== false ? [value] : null;
|
|
7051
7084
|
}
|
|
7052
7085
|
__computePaint() {
|
|
7053
7086
|
const { fill, stroke } = this.__input;
|
|
@@ -7058,24 +7091,19 @@ class UIData extends LeafData {
|
|
|
7058
7091
|
this.__needComputePaint = false;
|
|
7059
7092
|
}
|
|
7060
7093
|
}
|
|
7061
|
-
const UnitConvert = {
|
|
7062
|
-
number(value, percentRefer) {
|
|
7063
|
-
if (typeof value === 'object')
|
|
7064
|
-
return value.type === 'percent' ? value.value * percentRefer : value.value;
|
|
7065
|
-
return value;
|
|
7066
|
-
}
|
|
7067
|
-
};
|
|
7068
7094
|
|
|
7069
7095
|
class GroupData extends UIData {
|
|
7070
7096
|
}
|
|
7071
7097
|
|
|
7072
7098
|
class BoxData extends GroupData {
|
|
7073
7099
|
get __boxStroke() { return !this.__pathInputed; }
|
|
7100
|
+
get __drawAfterFill() { return this.overflow === 'hide' && this.__clipAfterFill && this.__leaf.children.length; }
|
|
7101
|
+
get __clipAfterFill() { return this.__leaf.isOverflow || super.__clipAfterFill; }
|
|
7074
7102
|
}
|
|
7075
7103
|
|
|
7076
7104
|
class LeaferData extends GroupData {
|
|
7077
|
-
__getInputData() {
|
|
7078
|
-
const data = super.__getInputData();
|
|
7105
|
+
__getInputData(names, options) {
|
|
7106
|
+
const data = super.__getInputData(names, options);
|
|
7079
7107
|
canvasSizeAttrs.forEach(key => delete data[key]);
|
|
7080
7108
|
return data;
|
|
7081
7109
|
}
|
|
@@ -7102,6 +7130,7 @@ class StarData extends UIData {
|
|
|
7102
7130
|
}
|
|
7103
7131
|
|
|
7104
7132
|
class PathData extends UIData {
|
|
7133
|
+
get __pathInputed() { return 2; }
|
|
7105
7134
|
}
|
|
7106
7135
|
|
|
7107
7136
|
class PenData extends GroupData {
|
|
@@ -7148,16 +7177,18 @@ class ImageData extends RectData {
|
|
|
7148
7177
|
delete data.fill;
|
|
7149
7178
|
return data;
|
|
7150
7179
|
}
|
|
7151
|
-
__getInputData() {
|
|
7152
|
-
const data = super.__getInputData();
|
|
7180
|
+
__getInputData(names, options) {
|
|
7181
|
+
const data = super.__getInputData(names, options);
|
|
7153
7182
|
delete data.fill;
|
|
7154
7183
|
return data;
|
|
7155
7184
|
}
|
|
7156
7185
|
}
|
|
7157
7186
|
|
|
7158
7187
|
class CanvasData extends RectData {
|
|
7159
|
-
|
|
7160
|
-
|
|
7188
|
+
get __isCanvas() { return true; }
|
|
7189
|
+
get __drawAfterFill() { return true; }
|
|
7190
|
+
__getInputData(names, options) {
|
|
7191
|
+
const data = super.__getInputData(names, options);
|
|
7161
7192
|
data.url = this.__leaf.canvas.toDataURL('image/png');
|
|
7162
7193
|
return data;
|
|
7163
7194
|
}
|
|
@@ -7184,16 +7215,12 @@ const UIBounds = {
|
|
|
7184
7215
|
let width = 0;
|
|
7185
7216
|
const { shadow, innerShadow, blur, backgroundBlur } = this.__;
|
|
7186
7217
|
if (shadow)
|
|
7187
|
-
shadow.forEach(item =>
|
|
7188
|
-
width = Math.max(width, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread > 0 ? item.spread : 0) + item.blur * 1.5);
|
|
7189
|
-
});
|
|
7218
|
+
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));
|
|
7190
7219
|
if (blur)
|
|
7191
7220
|
width = Math.max(width, blur);
|
|
7192
7221
|
let shapeWidth = width = Math.ceil(width);
|
|
7193
7222
|
if (innerShadow)
|
|
7194
|
-
innerShadow.forEach(item =>
|
|
7195
|
-
shapeWidth = Math.max(shapeWidth, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread < 0 ? -item.spread : 0) + item.blur * 1.5);
|
|
7196
|
-
});
|
|
7223
|
+
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));
|
|
7197
7224
|
if (backgroundBlur)
|
|
7198
7225
|
shapeWidth = Math.max(shapeWidth, backgroundBlur);
|
|
7199
7226
|
this.__layout.renderShapeSpread = shapeWidth;
|
|
@@ -7275,6 +7302,16 @@ const UIRender = {
|
|
|
7275
7302
|
if (stroke && !ignoreStroke)
|
|
7276
7303
|
this.__.__pixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
|
|
7277
7304
|
}
|
|
7305
|
+
},
|
|
7306
|
+
__drawAfterFill(canvas, options) {
|
|
7307
|
+
if (this.__.__clipAfterFill) {
|
|
7308
|
+
canvas.save();
|
|
7309
|
+
this.windingRule ? canvas.clip(this.windingRule) : canvas.clip();
|
|
7310
|
+
this.__drawContent(canvas, options);
|
|
7311
|
+
canvas.restore();
|
|
7312
|
+
}
|
|
7313
|
+
else
|
|
7314
|
+
this.__drawContent(canvas, options);
|
|
7278
7315
|
}
|
|
7279
7316
|
};
|
|
7280
7317
|
function drawFast(ui, canvas, options) {
|
|
@@ -7341,8 +7378,8 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
7341
7378
|
return pen;
|
|
7342
7379
|
}
|
|
7343
7380
|
get editConfig() { return undefined; }
|
|
7344
|
-
get editOuter() { return
|
|
7345
|
-
get editInner() { return '
|
|
7381
|
+
get editOuter() { return ''; }
|
|
7382
|
+
get editInner() { return ''; }
|
|
7346
7383
|
constructor(data) {
|
|
7347
7384
|
super(data);
|
|
7348
7385
|
}
|
|
@@ -7353,9 +7390,8 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
7353
7390
|
Object.assign(this, data);
|
|
7354
7391
|
this.lockNormalStyle = false;
|
|
7355
7392
|
}
|
|
7356
|
-
else
|
|
7393
|
+
else
|
|
7357
7394
|
Object.assign(this, data);
|
|
7358
|
-
}
|
|
7359
7395
|
}
|
|
7360
7396
|
get(name) {
|
|
7361
7397
|
return typeof name === 'string' ? this.__.__getInput(name) : this.__.__getInputData(name);
|
|
@@ -7657,23 +7693,13 @@ let Group = class Group extends UI {
|
|
|
7657
7693
|
if (data.children) {
|
|
7658
7694
|
const { children } = data;
|
|
7659
7695
|
delete data.children;
|
|
7660
|
-
|
|
7661
|
-
this.__setBranch();
|
|
7662
|
-
}
|
|
7663
|
-
else {
|
|
7664
|
-
this.clear();
|
|
7665
|
-
}
|
|
7696
|
+
this.children ? this.clear() : this.__setBranch();
|
|
7666
7697
|
super.set(data, isTemp);
|
|
7667
|
-
|
|
7668
|
-
children.forEach(childData => {
|
|
7669
|
-
child = childData.__ ? childData : UICreator.get(childData.tag, childData);
|
|
7670
|
-
this.add(child);
|
|
7671
|
-
});
|
|
7698
|
+
children.forEach(child => this.add(child));
|
|
7672
7699
|
data.children = children;
|
|
7673
7700
|
}
|
|
7674
|
-
else
|
|
7701
|
+
else
|
|
7675
7702
|
super.set(data, isTemp);
|
|
7676
|
-
}
|
|
7677
7703
|
}
|
|
7678
7704
|
toJSON(options) {
|
|
7679
7705
|
const data = super.toJSON(options);
|
|
@@ -8105,9 +8131,7 @@ let Box = class Box extends Group {
|
|
|
8105
8131
|
}
|
|
8106
8132
|
__updateStrokeSpread() { return 0; }
|
|
8107
8133
|
__updateRectRenderSpread() { return 0; }
|
|
8108
|
-
__updateRenderSpread() {
|
|
8109
|
-
return this.__updateRectRenderSpread() || -1;
|
|
8110
|
-
}
|
|
8134
|
+
__updateRenderSpread() { return this.__updateRectRenderSpread() || -1; }
|
|
8111
8135
|
__updateRectBoxBounds() { }
|
|
8112
8136
|
__updateBoxBounds(_secondLayout) {
|
|
8113
8137
|
const data = this.__;
|
|
@@ -8127,13 +8151,11 @@ let Box = class Box extends Group {
|
|
|
8127
8151
|
}
|
|
8128
8152
|
this.__updateNaturalSize();
|
|
8129
8153
|
}
|
|
8130
|
-
else
|
|
8154
|
+
else
|
|
8131
8155
|
this.__updateRectBoxBounds();
|
|
8132
|
-
}
|
|
8133
8156
|
}
|
|
8134
|
-
else
|
|
8157
|
+
else
|
|
8135
8158
|
this.__updateRectBoxBounds();
|
|
8136
|
-
}
|
|
8137
8159
|
}
|
|
8138
8160
|
__updateStrokeBounds() { }
|
|
8139
8161
|
__updateRenderBounds() {
|
|
@@ -8143,14 +8165,13 @@ let Box = class Box extends Group {
|
|
|
8143
8165
|
super.__updateRenderBounds();
|
|
8144
8166
|
copy$6(childrenRenderBounds, renderBounds);
|
|
8145
8167
|
this.__updateRectRenderBounds();
|
|
8146
|
-
isOverflow = !includes$1(renderBounds, childrenRenderBounds)
|
|
8168
|
+
isOverflow = !includes$1(renderBounds, childrenRenderBounds);
|
|
8169
|
+
if (isOverflow && this.__.overflow !== 'hide')
|
|
8170
|
+
add(renderBounds, childrenRenderBounds);
|
|
8147
8171
|
}
|
|
8148
|
-
else
|
|
8172
|
+
else
|
|
8149
8173
|
this.__updateRectRenderBounds();
|
|
8150
|
-
|
|
8151
|
-
this.isOverflow !== isOverflow && (this.isOverflow = isOverflow);
|
|
8152
|
-
if (!(this.__.__drawAfterFill = this.__.overflow === 'hide') && isOverflow)
|
|
8153
|
-
add(renderBounds, childrenRenderBounds);
|
|
8174
|
+
!this.isOverflow !== !isOverflow && (this.isOverflow = isOverflow);
|
|
8154
8175
|
}
|
|
8155
8176
|
__updateRectRenderBounds() { }
|
|
8156
8177
|
__updateRectChange() { }
|
|
@@ -8170,20 +8191,9 @@ let Box = class Box extends Group {
|
|
|
8170
8191
|
this.__renderGroup(canvas, options);
|
|
8171
8192
|
}
|
|
8172
8193
|
}
|
|
8173
|
-
|
|
8174
|
-
|
|
8175
|
-
if (this.
|
|
8176
|
-
canvas.save();
|
|
8177
|
-
canvas.clip();
|
|
8178
|
-
if (length)
|
|
8179
|
-
this.__renderGroup(canvas, options);
|
|
8180
|
-
canvas.restore();
|
|
8181
|
-
}
|
|
8182
|
-
else {
|
|
8183
|
-
if (length)
|
|
8184
|
-
this.__renderGroup(canvas, options);
|
|
8185
|
-
}
|
|
8186
|
-
if (this.__.stroke && length) {
|
|
8194
|
+
__drawContent(canvas, options) {
|
|
8195
|
+
this.__renderGroup(canvas, options);
|
|
8196
|
+
if (this.__.__hasStroke) {
|
|
8187
8197
|
canvas.setWorld(this.__nowWorld);
|
|
8188
8198
|
this.__drawRenderPath(canvas);
|
|
8189
8199
|
}
|
|
@@ -8347,17 +8357,15 @@ let Line = class Line extends UI {
|
|
|
8347
8357
|
if (data.__useArrow)
|
|
8348
8358
|
PathArrow.addArrows(this, false);
|
|
8349
8359
|
}
|
|
8350
|
-
else
|
|
8360
|
+
else
|
|
8351
8361
|
super.__updateRenderPath();
|
|
8352
|
-
}
|
|
8353
8362
|
}
|
|
8354
8363
|
__updateBoxBounds() {
|
|
8355
8364
|
if (this.points) {
|
|
8356
8365
|
toBounds$1(this.__.__pathForRender, this.__layout.boxBounds);
|
|
8357
8366
|
}
|
|
8358
|
-
else
|
|
8367
|
+
else
|
|
8359
8368
|
super.__updateBoxBounds();
|
|
8360
|
-
}
|
|
8361
8369
|
}
|
|
8362
8370
|
};
|
|
8363
8371
|
__decorate([
|
|
@@ -8495,7 +8503,6 @@ let Canvas = class Canvas extends Rect {
|
|
|
8495
8503
|
super(data);
|
|
8496
8504
|
this.canvas = Creator.canvas(this.__);
|
|
8497
8505
|
this.context = this.canvas.context;
|
|
8498
|
-
this.__.__isCanvas = this.__.__drawAfterFill = true;
|
|
8499
8506
|
if (data && data.url)
|
|
8500
8507
|
this.drawImage(data.url);
|
|
8501
8508
|
}
|
|
@@ -8508,8 +8515,7 @@ let Canvas = class Canvas extends Rect {
|
|
|
8508
8515
|
});
|
|
8509
8516
|
}
|
|
8510
8517
|
draw(ui, offset, scale, rotation) {
|
|
8511
|
-
ui.
|
|
8512
|
-
const matrix = new Matrix(ui.__world).invert();
|
|
8518
|
+
const matrix = new Matrix(ui.worldTransform).invert();
|
|
8513
8519
|
const m = new Matrix();
|
|
8514
8520
|
if (offset)
|
|
8515
8521
|
m.translate(offset.x, offset.y);
|
|
@@ -8524,17 +8530,9 @@ let Canvas = class Canvas extends Rect {
|
|
|
8524
8530
|
paint() {
|
|
8525
8531
|
this.forceRender();
|
|
8526
8532
|
}
|
|
8527
|
-
|
|
8528
|
-
const { width, height
|
|
8529
|
-
|
|
8530
|
-
canvas.save();
|
|
8531
|
-
canvas.clip();
|
|
8532
|
-
canvas.drawImage(view, 0, 0, view.width, view.height, 0, 0, width, height);
|
|
8533
|
-
canvas.restore();
|
|
8534
|
-
}
|
|
8535
|
-
else {
|
|
8536
|
-
canvas.drawImage(view, 0, 0, view.width, view.height, 0, 0, width, height);
|
|
8537
|
-
}
|
|
8533
|
+
__drawContent(canvas, _options) {
|
|
8534
|
+
const { width, height } = this.__, { view } = this.canvas;
|
|
8535
|
+
canvas.drawImage(view, 0, 0, view.width, view.height, 0, 0, width, height);
|
|
8538
8536
|
}
|
|
8539
8537
|
__updateSize() {
|
|
8540
8538
|
const { canvas } = this;
|
|
@@ -8578,7 +8576,6 @@ Canvas = __decorate([
|
|
|
8578
8576
|
const { copyAndSpread, includes, isSame: isSame$1, spread, setList } = BoundsHelper;
|
|
8579
8577
|
let Text = class Text extends UI {
|
|
8580
8578
|
get __tag() { return 'Text'; }
|
|
8581
|
-
get editInner() { return 'TextEditor'; }
|
|
8582
8579
|
get textDrawData() {
|
|
8583
8580
|
this.__layout.update();
|
|
8584
8581
|
return this.__.__textDrawData;
|
|
@@ -8653,9 +8650,8 @@ let Text = class Text extends UI {
|
|
|
8653
8650
|
layout.renderChanged = true;
|
|
8654
8651
|
setList(data.__textBoxBounds = {}, [b, bounds]);
|
|
8655
8652
|
}
|
|
8656
|
-
else
|
|
8653
|
+
else
|
|
8657
8654
|
data.__textBoxBounds = contentBounds;
|
|
8658
|
-
}
|
|
8659
8655
|
}
|
|
8660
8656
|
__updateRenderSpread() {
|
|
8661
8657
|
let width = super.__updateRenderSpread();
|
|
@@ -8744,7 +8740,6 @@ let Path = class Path extends UI {
|
|
|
8744
8740
|
get __tag() { return 'Path'; }
|
|
8745
8741
|
constructor(data) {
|
|
8746
8742
|
super(data);
|
|
8747
|
-
this.__.__pathInputed = 2;
|
|
8748
8743
|
}
|
|
8749
8744
|
};
|
|
8750
8745
|
__decorate([
|
|
@@ -8827,21 +8822,17 @@ let App = class App extends Leafer {
|
|
|
8827
8822
|
this.tree = this.addLeafer(tree);
|
|
8828
8823
|
if (sky || editor)
|
|
8829
8824
|
this.sky = this.addLeafer(sky || { type: 'draw', usePartRender: false });
|
|
8830
|
-
if (editor)
|
|
8831
|
-
this.editor = Creator.editor(editor);
|
|
8832
|
-
this.sky.add(this.editor);
|
|
8833
|
-
}
|
|
8825
|
+
if (editor)
|
|
8826
|
+
this.sky.add(this.editor = Creator.editor(editor));
|
|
8834
8827
|
}
|
|
8835
8828
|
}
|
|
8836
8829
|
__setApp() {
|
|
8837
8830
|
const { canvas } = this;
|
|
8838
8831
|
const { realCanvas, view } = this.config;
|
|
8839
|
-
if (realCanvas || view === this.canvas.view || !canvas.parentView)
|
|
8832
|
+
if (realCanvas || view === this.canvas.view || !canvas.parentView)
|
|
8840
8833
|
this.realCanvas = true;
|
|
8841
|
-
|
|
8842
|
-
else {
|
|
8834
|
+
else
|
|
8843
8835
|
canvas.unrealCanvas();
|
|
8844
|
-
}
|
|
8845
8836
|
this.leafer = this;
|
|
8846
8837
|
this.watcher.disable();
|
|
8847
8838
|
this.layouter.disable();
|
|
@@ -9247,10 +9238,7 @@ leafer.initType = function (type) {
|
|
|
9247
9238
|
leafer.getValidMove = function (moveX, moveY) {
|
|
9248
9239
|
const { scroll, disabled } = this.app.config.move;
|
|
9249
9240
|
if (scroll) {
|
|
9250
|
-
|
|
9251
|
-
moveY = 0;
|
|
9252
|
-
else
|
|
9253
|
-
moveX = 0;
|
|
9241
|
+
Math.abs(moveX) > Math.abs(moveY) ? moveY = 0 : moveX = 0;
|
|
9254
9242
|
if (scroll === 'limit') {
|
|
9255
9243
|
const { x, y, width, height } = new Bounds(this.__world).addPoint(this.zoomLayer);
|
|
9256
9244
|
const right = x + width - this.width, bottom = y + height - this.height;
|
|
@@ -10337,17 +10325,20 @@ rect.__hitFill = box$1.__hitFill = function (inner) {
|
|
|
10337
10325
|
};
|
|
10338
10326
|
|
|
10339
10327
|
const ui$1 = UI.prototype, group = Group.prototype;
|
|
10328
|
+
function getSelector(ui) {
|
|
10329
|
+
return ui.leafer ? ui.leafer.selector : (Platform.selector || (Platform.selector = Creator.selector()));
|
|
10330
|
+
}
|
|
10340
10331
|
ui$1.find = function (condition, options) {
|
|
10341
|
-
return this.
|
|
10332
|
+
return getSelector(this).getBy(condition, this, false, options);
|
|
10342
10333
|
};
|
|
10343
10334
|
ui$1.findOne = function (condition, options) {
|
|
10344
|
-
return this.
|
|
10335
|
+
return getSelector(this).getBy(condition, this, true, options);
|
|
10345
10336
|
};
|
|
10346
10337
|
group.pick = function (hitPoint, options) {
|
|
10347
10338
|
this.__layout.update();
|
|
10348
10339
|
if (!options)
|
|
10349
10340
|
options = {};
|
|
10350
|
-
return this.
|
|
10341
|
+
return getSelector(this).getByPoint(hitPoint, options.hitRadius || 0, Object.assign(Object.assign({}, options), { target: this }));
|
|
10351
10342
|
};
|
|
10352
10343
|
|
|
10353
10344
|
const canvas$1 = LeaferCanvasBase.prototype;
|
|
@@ -10982,7 +10973,7 @@ function checkImage(ui, canvas, paint, allowPaint) {
|
|
|
10982
10973
|
}
|
|
10983
10974
|
if (allowPaint) {
|
|
10984
10975
|
canvas.save();
|
|
10985
|
-
canvas.clip();
|
|
10976
|
+
ui.windingRule ? canvas.clip(ui.windingRule) : canvas.clip();
|
|
10986
10977
|
if (paint.blendMode)
|
|
10987
10978
|
canvas.blendMode = paint.blendMode;
|
|
10988
10979
|
if (data.opacity)
|
|
@@ -12183,8 +12174,9 @@ function scaleResizePath(leaf, scaleX, scaleY) {
|
|
|
12183
12174
|
leaf.path = leaf.__.path;
|
|
12184
12175
|
}
|
|
12185
12176
|
function scaleResizePoints(leaf, scaleX, scaleY) {
|
|
12186
|
-
|
|
12187
|
-
|
|
12177
|
+
const { points } = leaf;
|
|
12178
|
+
typeof points[0] === 'object' ? points.forEach(p => { p.x *= scaleX, p.y *= scaleY; }) : PathScaler.scalePoints(points, scaleX, scaleY);
|
|
12179
|
+
leaf.points = points;
|
|
12188
12180
|
}
|
|
12189
12181
|
function scaleResizeGroup(group, scaleX, scaleY) {
|
|
12190
12182
|
const { children } = group;
|
|
@@ -13847,7 +13839,8 @@ class Editor extends Group {
|
|
|
13847
13839
|
this.simulateTarget.destroy();
|
|
13848
13840
|
Object.values(this.editToolList).forEach(item => item.destroy());
|
|
13849
13841
|
this.editToolList = {};
|
|
13850
|
-
this.target = this.hoverTarget =
|
|
13842
|
+
this.target = this.hoverTarget = null;
|
|
13843
|
+
this.simulateTarget = this.editTool = this.innerEditor = null;
|
|
13851
13844
|
super.destroy();
|
|
13852
13845
|
}
|
|
13853
13846
|
}
|
|
@@ -13979,7 +13972,7 @@ EditTool = __decorate([
|
|
|
13979
13972
|
], EditTool);
|
|
13980
13973
|
|
|
13981
13974
|
const { left, right } = Direction9;
|
|
13982
|
-
const { move, copy: copy$1 } = PointHelper;
|
|
13975
|
+
const { move, copy: copy$1, toNumberPoints } = PointHelper;
|
|
13983
13976
|
let LineEditTool = class LineEditTool extends EditTool {
|
|
13984
13977
|
constructor() {
|
|
13985
13978
|
super(...arguments);
|
|
@@ -14021,14 +14014,8 @@ let LineEditTool = class LineEditTool extends EditTool {
|
|
|
14021
14014
|
}
|
|
14022
14015
|
getInnerMove(ui, event, lockRatio) {
|
|
14023
14016
|
const movePoint = event.getInnerMove(ui);
|
|
14024
|
-
if (lockRatio)
|
|
14025
|
-
|
|
14026
|
-
movePoint.y = 0;
|
|
14027
|
-
}
|
|
14028
|
-
else {
|
|
14029
|
-
movePoint.x = 0;
|
|
14030
|
-
}
|
|
14031
|
-
}
|
|
14017
|
+
if (lockRatio)
|
|
14018
|
+
Math.abs(movePoint.x) > Math.abs(movePoint.y) ? movePoint.y = 0 : movePoint.x = 0;
|
|
14032
14019
|
return movePoint;
|
|
14033
14020
|
}
|
|
14034
14021
|
getFromToByPath(path) {
|
|
@@ -14037,7 +14024,8 @@ let LineEditTool = class LineEditTool extends EditTool {
|
|
|
14037
14024
|
to: { x: path[4], y: path[5] }
|
|
14038
14025
|
};
|
|
14039
14026
|
}
|
|
14040
|
-
getFromToByPoints(
|
|
14027
|
+
getFromToByPoints(originPoints) {
|
|
14028
|
+
const points = toNumberPoints(originPoints);
|
|
14041
14029
|
return {
|
|
14042
14030
|
from: { x: points[0], y: points[1] },
|
|
14043
14031
|
to: { x: points[2], y: points[3] }
|
|
@@ -14090,6 +14078,15 @@ LineEditTool = __decorate([
|
|
|
14090
14078
|
], LineEditTool);
|
|
14091
14079
|
|
|
14092
14080
|
Creator.editor = function (options) { return new Editor(options); };
|
|
14081
|
+
defineKey(UI.prototype, 'editOuter', {
|
|
14082
|
+
get() { return this.__.__isLinePath ? 'LineEditTool' : 'EditTool'; }
|
|
14083
|
+
});
|
|
14084
|
+
defineKey(UI.prototype, 'editInner', {
|
|
14085
|
+
get() { return 'PathEditor'; }
|
|
14086
|
+
});
|
|
14087
|
+
defineKey(Text.prototype, 'editInner', {
|
|
14088
|
+
get() { return 'TextEditor'; }
|
|
14089
|
+
});
|
|
14093
14090
|
UI.setEditConfig = function (config) {
|
|
14094
14091
|
defineKey(this.prototype, 'editConfig', {
|
|
14095
14092
|
get() { return typeof config === 'function' ? config(this) : config; }
|