@leafer-draw/worker 1.0.0-rc.21 → 1.0.0-rc.23
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.esm.js +79 -53
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.js +362 -209
- package/dist/worker.min.js +1 -1
- package/dist/worker.module.js +361 -209
- package/dist/worker.module.min.js +1 -1
- package/package.json +6 -6
package/dist/worker.js
CHANGED
|
@@ -6,7 +6,7 @@ var LeaferUI = (function (exports) {
|
|
|
6
6
|
hitCanvasSize: 100,
|
|
7
7
|
maxCacheSize: 2560 * 1600,
|
|
8
8
|
maxPatternSize: 4096 * 2160,
|
|
9
|
-
suffix: '
|
|
9
|
+
suffix: '',
|
|
10
10
|
crossOrigin: 'anonymous'
|
|
11
11
|
}
|
|
12
12
|
};
|
|
@@ -36,24 +36,12 @@ var LeaferUI = (function (exports) {
|
|
|
36
36
|
const { round, pow: pow$1, PI: PI$4 } = Math;
|
|
37
37
|
const MathHelper = {
|
|
38
38
|
within(value, min, max) {
|
|
39
|
-
if (value < min)
|
|
39
|
+
if (min !== undefined && value < min)
|
|
40
40
|
value = min;
|
|
41
|
-
if (value > max)
|
|
41
|
+
if (max !== undefined && value > max)
|
|
42
42
|
value = max;
|
|
43
43
|
return value;
|
|
44
44
|
},
|
|
45
|
-
minus(value, isFourNumber) {
|
|
46
|
-
if (value instanceof Array) {
|
|
47
|
-
if (isFourNumber)
|
|
48
|
-
value = MathHelper.fourNumber(value, 0);
|
|
49
|
-
for (let i = 0; i < value.length; i++)
|
|
50
|
-
value[i] = -value[i];
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
value = -value;
|
|
54
|
-
}
|
|
55
|
-
return value;
|
|
56
|
-
},
|
|
57
45
|
fourNumber(num, maxValue) {
|
|
58
46
|
let data;
|
|
59
47
|
if (num instanceof Array) {
|
|
@@ -120,7 +108,7 @@ var LeaferUI = (function (exports) {
|
|
|
120
108
|
|
|
121
109
|
const { sin: sin$5, cos: cos$5, acos, sqrt: sqrt$3 } = Math;
|
|
122
110
|
const { float: float$1 } = MathHelper;
|
|
123
|
-
const tempPoint$
|
|
111
|
+
const tempPoint$4 = {};
|
|
124
112
|
function getWorld() {
|
|
125
113
|
return Object.assign(Object.assign(Object.assign({}, getMatrixData()), getBoundsData()), { scaleX: 1, scaleY: 1, rotation: 0, skewX: 0, skewY: 0 });
|
|
126
114
|
}
|
|
@@ -150,9 +138,11 @@ var LeaferUI = (function (exports) {
|
|
|
150
138
|
t.e += x;
|
|
151
139
|
t.f += y;
|
|
152
140
|
},
|
|
153
|
-
translateInner(t, x, y) {
|
|
141
|
+
translateInner(t, x, y, isMoveOrigin) {
|
|
154
142
|
t.e += t.a * x + t.c * y;
|
|
155
143
|
t.f += t.b * x + t.d * y;
|
|
144
|
+
if (isMoveOrigin)
|
|
145
|
+
t.e -= x, t.f -= y;
|
|
156
146
|
},
|
|
157
147
|
scale(t, scaleX, scaleY = scaleX) {
|
|
158
148
|
t.a *= scaleX;
|
|
@@ -161,8 +151,8 @@ var LeaferUI = (function (exports) {
|
|
|
161
151
|
t.d *= scaleY;
|
|
162
152
|
},
|
|
163
153
|
scaleOfOuter(t, origin, scaleX, scaleY) {
|
|
164
|
-
M$6.toInnerPoint(t, origin, tempPoint$
|
|
165
|
-
M$6.scaleOfInner(t, tempPoint$
|
|
154
|
+
M$6.toInnerPoint(t, origin, tempPoint$4);
|
|
155
|
+
M$6.scaleOfInner(t, tempPoint$4, scaleX, scaleY);
|
|
166
156
|
},
|
|
167
157
|
scaleOfInner(t, origin, scaleX, scaleY = scaleX) {
|
|
168
158
|
M$6.translateInner(t, origin.x, origin.y);
|
|
@@ -180,8 +170,8 @@ var LeaferUI = (function (exports) {
|
|
|
180
170
|
t.d = c * sinR + d * cosR;
|
|
181
171
|
},
|
|
182
172
|
rotateOfOuter(t, origin, rotation) {
|
|
183
|
-
M$6.toInnerPoint(t, origin, tempPoint$
|
|
184
|
-
M$6.rotateOfInner(t, tempPoint$
|
|
173
|
+
M$6.toInnerPoint(t, origin, tempPoint$4);
|
|
174
|
+
M$6.rotateOfInner(t, tempPoint$4, rotation);
|
|
185
175
|
},
|
|
186
176
|
rotateOfInner(t, origin, rotation) {
|
|
187
177
|
M$6.translateInner(t, origin.x, origin.y);
|
|
@@ -202,8 +192,8 @@ var LeaferUI = (function (exports) {
|
|
|
202
192
|
}
|
|
203
193
|
},
|
|
204
194
|
skewOfOuter(t, origin, skewX, skewY) {
|
|
205
|
-
M$6.toInnerPoint(t, origin, tempPoint$
|
|
206
|
-
M$6.skewOfInner(t, tempPoint$
|
|
195
|
+
M$6.toInnerPoint(t, origin, tempPoint$4);
|
|
196
|
+
M$6.skewOfInner(t, tempPoint$4, skewX, skewY);
|
|
207
197
|
},
|
|
208
198
|
skewOfInner(t, origin, skewX, skewY = 0) {
|
|
209
199
|
M$6.translateInner(t, origin.x, origin.y);
|
|
@@ -219,8 +209,10 @@ var LeaferUI = (function (exports) {
|
|
|
219
209
|
t.e = child.e * a + child.f * c + e;
|
|
220
210
|
t.f = child.e * b + child.f * d + f;
|
|
221
211
|
},
|
|
222
|
-
multiplyParent(t, parent, to, abcdChanged, childScaleData) {
|
|
223
|
-
|
|
212
|
+
multiplyParent(t, parent, to, abcdChanged, childScaleData, scrollData) {
|
|
213
|
+
let { e, f } = t;
|
|
214
|
+
if (scrollData)
|
|
215
|
+
e += scrollData.scrollX, f += scrollData.scrollY;
|
|
224
216
|
to || (to = t);
|
|
225
217
|
if (abcdChanged === undefined)
|
|
226
218
|
abcdChanged = t.a !== 1 || t.b || t.c || t.d !== 1;
|
|
@@ -341,7 +333,7 @@ var LeaferUI = (function (exports) {
|
|
|
341
333
|
t.e = x;
|
|
342
334
|
t.f = y;
|
|
343
335
|
if (origin)
|
|
344
|
-
M$6.translateInner(t, -origin.x, -origin.y);
|
|
336
|
+
M$6.translateInner(t, -origin.x, -origin.y, true);
|
|
345
337
|
},
|
|
346
338
|
getLayout(t, origin, firstSkewY) {
|
|
347
339
|
const { a, b, c, d, e, f } = t;
|
|
@@ -597,7 +589,7 @@ var LeaferUI = (function (exports) {
|
|
|
597
589
|
return this;
|
|
598
590
|
}
|
|
599
591
|
}
|
|
600
|
-
const tempPoint$
|
|
592
|
+
const tempPoint$3 = new Point();
|
|
601
593
|
|
|
602
594
|
class Matrix {
|
|
603
595
|
constructor(a, b, c, d, e, f) {
|
|
@@ -761,7 +753,7 @@ var LeaferUI = (function (exports) {
|
|
|
761
753
|
const { floor, ceil: ceil$2 } = Math;
|
|
762
754
|
let right$1, bottom$1, boundsRight, boundsBottom;
|
|
763
755
|
const point = {};
|
|
764
|
-
const toPoint$
|
|
756
|
+
const toPoint$2 = {};
|
|
765
757
|
const BoundsHelper = {
|
|
766
758
|
tempBounds: {},
|
|
767
759
|
set(t, x = 0, y = 0, width = 0, height = 0) {
|
|
@@ -776,15 +768,17 @@ var LeaferUI = (function (exports) {
|
|
|
776
768
|
t.width = bounds.width;
|
|
777
769
|
t.height = bounds.height;
|
|
778
770
|
},
|
|
779
|
-
copyAndSpread(t, bounds,
|
|
780
|
-
if (
|
|
781
|
-
const four = fourNumber(
|
|
782
|
-
|
|
771
|
+
copyAndSpread(t, bounds, spread, isShrink) {
|
|
772
|
+
if (spread instanceof Array) {
|
|
773
|
+
const four = fourNumber(spread);
|
|
774
|
+
isShrink
|
|
775
|
+
? B.set(t, bounds.x + four[3], bounds.y + four[0], bounds.width - four[1] - four[3], bounds.height - four[2] - four[0])
|
|
776
|
+
: B.set(t, bounds.x - four[3], bounds.y - four[0], bounds.width + four[1] + four[3], bounds.height + four[2] + four[0]);
|
|
783
777
|
}
|
|
784
778
|
else {
|
|
785
|
-
if (
|
|
786
|
-
|
|
787
|
-
B.set(t, bounds.x -
|
|
779
|
+
if (isShrink)
|
|
780
|
+
spread = -spread;
|
|
781
|
+
B.set(t, bounds.x - spread, bounds.y - spread, bounds.width + spread * 2, bounds.height + spread * 2);
|
|
788
782
|
}
|
|
789
783
|
},
|
|
790
784
|
minX(t) { return t.width > 0 ? t.x : t.x + t.width; },
|
|
@@ -861,17 +855,17 @@ var LeaferUI = (function (exports) {
|
|
|
861
855
|
else {
|
|
862
856
|
point.x = t.x;
|
|
863
857
|
point.y = t.y;
|
|
864
|
-
toOuterPoint$1(matrix, point, toPoint$
|
|
865
|
-
setPoint$3(tempPointBounds$1, toPoint$
|
|
858
|
+
toOuterPoint$1(matrix, point, toPoint$2);
|
|
859
|
+
setPoint$3(tempPointBounds$1, toPoint$2.x, toPoint$2.y);
|
|
866
860
|
point.x = t.x + t.width;
|
|
867
|
-
toOuterPoint$1(matrix, point, toPoint$
|
|
868
|
-
addPoint$3(tempPointBounds$1, toPoint$
|
|
861
|
+
toOuterPoint$1(matrix, point, toPoint$2);
|
|
862
|
+
addPoint$3(tempPointBounds$1, toPoint$2.x, toPoint$2.y);
|
|
869
863
|
point.y = t.y + t.height;
|
|
870
|
-
toOuterPoint$1(matrix, point, toPoint$
|
|
871
|
-
addPoint$3(tempPointBounds$1, toPoint$
|
|
864
|
+
toOuterPoint$1(matrix, point, toPoint$2);
|
|
865
|
+
addPoint$3(tempPointBounds$1, toPoint$2.x, toPoint$2.y);
|
|
872
866
|
point.x = t.x;
|
|
873
|
-
toOuterPoint$1(matrix, point, toPoint$
|
|
874
|
-
addPoint$3(tempPointBounds$1, toPoint$
|
|
867
|
+
toOuterPoint$1(matrix, point, toPoint$2);
|
|
868
|
+
addPoint$3(tempPointBounds$1, toPoint$2.x, toPoint$2.y);
|
|
875
869
|
toBounds$4(tempPointBounds$1, to);
|
|
876
870
|
}
|
|
877
871
|
},
|
|
@@ -884,13 +878,16 @@ var LeaferUI = (function (exports) {
|
|
|
884
878
|
const scale = Math.min(baseScale, Math.min(t.width / put.width, t.height / put.height));
|
|
885
879
|
return new Matrix(scale, 0, 0, scale, -put.x * scale, -put.y * scale);
|
|
886
880
|
},
|
|
887
|
-
getSpread(t,
|
|
881
|
+
getSpread(t, spread) {
|
|
888
882
|
const n = {};
|
|
889
|
-
B.copyAndSpread(n, t,
|
|
883
|
+
B.copyAndSpread(n, t, spread);
|
|
890
884
|
return n;
|
|
891
885
|
},
|
|
892
|
-
spread(t,
|
|
893
|
-
B.copyAndSpread(t, t,
|
|
886
|
+
spread(t, spread) {
|
|
887
|
+
B.copyAndSpread(t, t, spread);
|
|
888
|
+
},
|
|
889
|
+
shrink(t, shrink) {
|
|
890
|
+
B.copyAndSpread(t, t, shrink, true);
|
|
894
891
|
},
|
|
895
892
|
ceil(t) {
|
|
896
893
|
const { x, y } = t;
|
|
@@ -1070,12 +1067,12 @@ var LeaferUI = (function (exports) {
|
|
|
1070
1067
|
getFitMatrix(put, baseScale) {
|
|
1071
1068
|
return BoundsHelper.getFitMatrix(this, put, baseScale);
|
|
1072
1069
|
}
|
|
1073
|
-
spread(fourNumber
|
|
1074
|
-
BoundsHelper.spread(this, fourNumber
|
|
1070
|
+
spread(fourNumber) {
|
|
1071
|
+
BoundsHelper.spread(this, fourNumber);
|
|
1075
1072
|
return this;
|
|
1076
1073
|
}
|
|
1077
1074
|
shrink(fourNumber) {
|
|
1078
|
-
BoundsHelper.
|
|
1075
|
+
BoundsHelper.shrink(this, fourNumber);
|
|
1079
1076
|
return this;
|
|
1080
1077
|
}
|
|
1081
1078
|
ceil() {
|
|
@@ -1192,6 +1189,10 @@ var LeaferUI = (function (exports) {
|
|
|
1192
1189
|
Direction9[Direction9["bottomLeft"] = 6] = "bottomLeft";
|
|
1193
1190
|
Direction9[Direction9["left"] = 7] = "left";
|
|
1194
1191
|
Direction9[Direction9["center"] = 8] = "center";
|
|
1192
|
+
Direction9[Direction9["top-left"] = 0] = "top-left";
|
|
1193
|
+
Direction9[Direction9["top-right"] = 2] = "top-right";
|
|
1194
|
+
Direction9[Direction9["bottom-right"] = 4] = "bottom-right";
|
|
1195
|
+
Direction9[Direction9["bottom-left"] = 6] = "bottom-left";
|
|
1195
1196
|
})(exports.Direction9 || (exports.Direction9 = {}));
|
|
1196
1197
|
|
|
1197
1198
|
const directionData = [
|
|
@@ -1205,15 +1206,28 @@ var LeaferUI = (function (exports) {
|
|
|
1205
1206
|
{ x: 0, y: 0.5 },
|
|
1206
1207
|
{ x: 0.5, y: 0.5 }
|
|
1207
1208
|
];
|
|
1209
|
+
directionData.forEach(item => item.type = 'percent');
|
|
1208
1210
|
const AroundHelper = {
|
|
1209
1211
|
directionData,
|
|
1210
1212
|
tempPoint: {},
|
|
1211
1213
|
get: get$5,
|
|
1212
|
-
toPoint(around, bounds, to, onlySize) {
|
|
1214
|
+
toPoint(around, bounds, to, onlySize, pointBounds) {
|
|
1213
1215
|
to || (to = {});
|
|
1214
1216
|
const point = get$5(around);
|
|
1215
|
-
to.x = point.x
|
|
1216
|
-
to.y = point.y
|
|
1217
|
+
to.x = point.x;
|
|
1218
|
+
to.y = point.y;
|
|
1219
|
+
if (point.type === 'percent') {
|
|
1220
|
+
to.x *= bounds.width;
|
|
1221
|
+
to.y *= bounds.height;
|
|
1222
|
+
if (pointBounds) {
|
|
1223
|
+
to.x -= pointBounds.x;
|
|
1224
|
+
to.y -= pointBounds.y;
|
|
1225
|
+
if (point.x)
|
|
1226
|
+
to.x -= (point.x === 1) ? pointBounds.width : (point.x === 0.5 ? point.x * pointBounds.width : 0);
|
|
1227
|
+
if (point.y)
|
|
1228
|
+
to.y -= (point.y === 1) ? pointBounds.height : (point.y === 0.5 ? point.y * pointBounds.height : 0);
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1217
1231
|
if (!onlySize) {
|
|
1218
1232
|
to.x += bounds.x;
|
|
1219
1233
|
to.y += bounds.y;
|
|
@@ -1224,6 +1238,13 @@ var LeaferUI = (function (exports) {
|
|
|
1224
1238
|
return typeof around === 'string' ? directionData[exports.Direction9[around]] : around;
|
|
1225
1239
|
}
|
|
1226
1240
|
|
|
1241
|
+
const { toPoint: toPoint$1 } = AroundHelper;
|
|
1242
|
+
const AlignHelper = {
|
|
1243
|
+
toPoint(align, contentBounds, bounds, to, onlySize) {
|
|
1244
|
+
toPoint$1(align, bounds, to, onlySize, contentBounds);
|
|
1245
|
+
}
|
|
1246
|
+
};
|
|
1247
|
+
|
|
1227
1248
|
const StringNumberMap = {
|
|
1228
1249
|
'0': 1,
|
|
1229
1250
|
'1': 1,
|
|
@@ -1456,13 +1477,19 @@ var LeaferUI = (function (exports) {
|
|
|
1456
1477
|
},
|
|
1457
1478
|
clone(data) {
|
|
1458
1479
|
return JSON.parse(JSON.stringify(data));
|
|
1480
|
+
},
|
|
1481
|
+
toMap(list) {
|
|
1482
|
+
const map = {};
|
|
1483
|
+
for (let i = 0, len = list.length; i < len; i++)
|
|
1484
|
+
map[list[i]] = true;
|
|
1485
|
+
return map;
|
|
1459
1486
|
}
|
|
1460
1487
|
};
|
|
1461
1488
|
const { assign } = DataHelper;
|
|
1462
1489
|
|
|
1463
1490
|
class LeafData {
|
|
1464
1491
|
get __blendMode() {
|
|
1465
|
-
if (this.eraser)
|
|
1492
|
+
if (this.eraser && this.eraser !== 'path')
|
|
1466
1493
|
return 'destination-out';
|
|
1467
1494
|
const { blendMode } = this;
|
|
1468
1495
|
return blendMode === 'pass-through' ? null : blendMode;
|
|
@@ -2092,7 +2119,7 @@ var LeaferUI = (function (exports) {
|
|
|
2092
2119
|
}
|
|
2093
2120
|
clear() {
|
|
2094
2121
|
const { pixelRatio } = this;
|
|
2095
|
-
this.clearRect(0, 0, this.width * pixelRatio, this.height * pixelRatio);
|
|
2122
|
+
this.clearRect(0, 0, this.width * pixelRatio + 2, this.height * pixelRatio + 2);
|
|
2096
2123
|
}
|
|
2097
2124
|
isSameSize(size) {
|
|
2098
2125
|
return this.width === size.width && this.height === size.height && this.pixelRatio === size.pixelRatio;
|
|
@@ -2211,7 +2238,7 @@ var LeaferUI = (function (exports) {
|
|
|
2211
2238
|
const { setPoint: setPoint$2, addPoint: addPoint$2 } = TwoPointBoundsHelper;
|
|
2212
2239
|
const { set: set$2 } = PointHelper;
|
|
2213
2240
|
const { M: M$5, L: L$6, C: C$5, Q: Q$4, Z: Z$5 } = PathCommandMap;
|
|
2214
|
-
const tempPoint$
|
|
2241
|
+
const tempPoint$2 = {};
|
|
2215
2242
|
const BezierHelper = {
|
|
2216
2243
|
points(data, points, curve, close) {
|
|
2217
2244
|
data.push(M$5, points[0], points[1]);
|
|
@@ -2401,8 +2428,8 @@ var LeaferUI = (function (exports) {
|
|
|
2401
2428
|
addMode ? addPoint$2(pointBounds, fromX, fromY) : setPoint$2(pointBounds, fromX, fromY);
|
|
2402
2429
|
addPoint$2(pointBounds, toX, toY);
|
|
2403
2430
|
for (let i = 0, len = tList.length; i < len; i++) {
|
|
2404
|
-
getPointAndSet(tList[i], fromX, fromY, x1, y1, x2, y2, toX, toY, tempPoint$
|
|
2405
|
-
addPoint$2(pointBounds, tempPoint$
|
|
2431
|
+
getPointAndSet(tList[i], fromX, fromY, x1, y1, x2, y2, toX, toY, tempPoint$2);
|
|
2432
|
+
addPoint$2(pointBounds, tempPoint$2.x, tempPoint$2.y);
|
|
2406
2433
|
}
|
|
2407
2434
|
},
|
|
2408
2435
|
getPointAndSet(t, fromX, fromY, x1, y1, x2, y2, toX, toY, setPoint) {
|
|
@@ -3748,6 +3775,8 @@ var LeaferUI = (function (exports) {
|
|
|
3748
3775
|
this.__setAttr(key, value);
|
|
3749
3776
|
this.__layout.boxChanged || this.__layout.boxChange();
|
|
3750
3777
|
this.waitParent(() => { this.parent.__updateMask(value); });
|
|
3778
|
+
if (typeof value === 'string')
|
|
3779
|
+
this.maskType = value;
|
|
3751
3780
|
}
|
|
3752
3781
|
}));
|
|
3753
3782
|
}
|
|
@@ -3959,15 +3988,21 @@ var LeaferUI = (function (exports) {
|
|
|
3959
3988
|
}
|
|
3960
3989
|
return true;
|
|
3961
3990
|
},
|
|
3962
|
-
moveWorld(t, x, y) {
|
|
3963
|
-
const local = { x, y };
|
|
3991
|
+
moveWorld(t, x, y = 0) {
|
|
3992
|
+
const local = typeof x === 'object' ? Object.assign({}, x) : { x, y };
|
|
3964
3993
|
if (t.parent)
|
|
3965
3994
|
toInnerPoint$1(t.parent.worldTransform, local, local, true);
|
|
3966
3995
|
L.moveLocal(t, local.x, local.y);
|
|
3967
3996
|
},
|
|
3968
3997
|
moveLocal(t, x, y = 0) {
|
|
3969
|
-
|
|
3970
|
-
|
|
3998
|
+
if (typeof x === 'object') {
|
|
3999
|
+
t.x += x.x;
|
|
4000
|
+
t.y += x.y;
|
|
4001
|
+
}
|
|
4002
|
+
else {
|
|
4003
|
+
t.x += x;
|
|
4004
|
+
t.y += y;
|
|
4005
|
+
}
|
|
3971
4006
|
},
|
|
3972
4007
|
zoomOfWorld(t, origin, scaleX, scaleY, resize) {
|
|
3973
4008
|
L.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY, resize);
|
|
@@ -4171,11 +4206,19 @@ var LeaferUI = (function (exports) {
|
|
|
4171
4206
|
|
|
4172
4207
|
const { getRelativeWorld: getRelativeWorld$1 } = LeafHelper;
|
|
4173
4208
|
const { toOuterOf: toOuterOf$2, getPoints, copy: copy$5 } = BoundsHelper;
|
|
4209
|
+
const localContent = '_localContentBounds';
|
|
4210
|
+
const worldContent = '_worldContentBounds', worldBox = '_worldBoxBounds', worldStroke = '_worldStrokeBounds';
|
|
4174
4211
|
class LeafLayout {
|
|
4212
|
+
get contentBounds() { return this._contentBounds || this.boxBounds; }
|
|
4213
|
+
set contentBounds(bounds) { this._contentBounds = bounds; }
|
|
4175
4214
|
get strokeBounds() { return this._strokeBounds || this.boxBounds; }
|
|
4176
4215
|
get renderBounds() { return this._renderBounds || this.boxBounds; }
|
|
4216
|
+
get localContentBounds() { toOuterOf$2(this.contentBounds, this.leaf.__localMatrix, this[localContent] || (this[localContent] = {})); return this[localContent]; }
|
|
4177
4217
|
get localStrokeBounds() { return this._localStrokeBounds || this; }
|
|
4178
4218
|
get localRenderBounds() { return this._localRenderBounds || this; }
|
|
4219
|
+
get worldContentBounds() { toOuterOf$2(this.contentBounds, this.leaf.__world, this[worldContent] || (this[worldContent] = {})); return this[worldContent]; }
|
|
4220
|
+
get worldBoxBounds() { toOuterOf$2(this.boxBounds, this.leaf.__world, this[worldBox] || (this[worldBox] = {})); return this[worldBox]; }
|
|
4221
|
+
get worldStrokeBounds() { toOuterOf$2(this.strokeBounds, this.leaf.__world, this[worldStroke] || (this[worldStroke] = {})); return this[worldStroke]; }
|
|
4179
4222
|
get a() { return 1; }
|
|
4180
4223
|
get b() { return 0; }
|
|
4181
4224
|
get c() { return 0; }
|
|
@@ -4258,7 +4301,6 @@ var LeaferUI = (function (exports) {
|
|
|
4258
4301
|
case 'content':
|
|
4259
4302
|
if (this.contentBounds)
|
|
4260
4303
|
return this.contentBounds;
|
|
4261
|
-
case 'margin':
|
|
4262
4304
|
case 'box':
|
|
4263
4305
|
return this.boxBounds;
|
|
4264
4306
|
case 'stroke':
|
|
@@ -4271,8 +4313,9 @@ var LeaferUI = (function (exports) {
|
|
|
4271
4313
|
return this.localRenderBounds;
|
|
4272
4314
|
case 'stroke':
|
|
4273
4315
|
return this.localStrokeBounds;
|
|
4274
|
-
case 'margin':
|
|
4275
4316
|
case 'content':
|
|
4317
|
+
if (this.contentBounds)
|
|
4318
|
+
return this.localContentBounds;
|
|
4276
4319
|
case 'box':
|
|
4277
4320
|
return this.leaf.__localBoxBounds;
|
|
4278
4321
|
}
|
|
@@ -4281,15 +4324,13 @@ var LeaferUI = (function (exports) {
|
|
|
4281
4324
|
switch (type) {
|
|
4282
4325
|
case 'render':
|
|
4283
4326
|
return this.leaf.__world;
|
|
4327
|
+
case 'stroke':
|
|
4328
|
+
return this.worldStrokeBounds;
|
|
4284
4329
|
case 'content':
|
|
4285
4330
|
if (this.contentBounds)
|
|
4286
|
-
return this.
|
|
4287
|
-
case 'margin':
|
|
4331
|
+
return this.worldContentBounds;
|
|
4288
4332
|
case 'box':
|
|
4289
|
-
return this.
|
|
4290
|
-
case 'margin':
|
|
4291
|
-
case 'stroke':
|
|
4292
|
-
return this.getWorldStrokeBounds();
|
|
4333
|
+
return this.worldBoxBounds;
|
|
4293
4334
|
}
|
|
4294
4335
|
}
|
|
4295
4336
|
getLayoutBounds(type, relative = 'world', unscale) {
|
|
@@ -4352,20 +4393,24 @@ var LeaferUI = (function (exports) {
|
|
|
4352
4393
|
points.forEach(point => leaf.innerToWorld(point, null, false, relativeLeaf));
|
|
4353
4394
|
return points;
|
|
4354
4395
|
}
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4396
|
+
shrinkContent() {
|
|
4397
|
+
const { x, y, width, height } = this.boxBounds;
|
|
4398
|
+
this._contentBounds = { x, y, width, height };
|
|
4399
|
+
}
|
|
4400
|
+
spreadStroke() {
|
|
4401
|
+
const { x, y, width, height } = this.strokeBounds;
|
|
4402
|
+
this._strokeBounds = { x, y, width, height };
|
|
4403
|
+
this._localStrokeBounds = { x, y, width, height };
|
|
4404
|
+
if (!this.renderSpread)
|
|
4405
|
+
this.spreadRenderCancel();
|
|
4359
4406
|
}
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4407
|
+
spreadRender() {
|
|
4408
|
+
const { x, y, width, height } = this.renderBounds;
|
|
4409
|
+
this._renderBounds = { x, y, width, height };
|
|
4410
|
+
this._localRenderBounds = { x, y, width, height };
|
|
4364
4411
|
}
|
|
4365
|
-
|
|
4366
|
-
this.
|
|
4367
|
-
toOuterOf$2(this.strokeBounds, this.leaf.__world, this._worldStrokeBounds);
|
|
4368
|
-
return this._worldStrokeBounds;
|
|
4412
|
+
shrinkContentCancel() {
|
|
4413
|
+
this._contentBounds = undefined;
|
|
4369
4414
|
}
|
|
4370
4415
|
spreadStrokeCancel() {
|
|
4371
4416
|
const same = this.renderBounds === this.strokeBounds;
|
|
@@ -4378,18 +4423,6 @@ var LeaferUI = (function (exports) {
|
|
|
4378
4423
|
this._renderBounds = this._strokeBounds;
|
|
4379
4424
|
this._localRenderBounds = this._localStrokeBounds;
|
|
4380
4425
|
}
|
|
4381
|
-
spreadStroke() {
|
|
4382
|
-
const { x, y, width, height } = this.strokeBounds;
|
|
4383
|
-
this._strokeBounds = { x, y, width, height };
|
|
4384
|
-
this._localStrokeBounds = { x, y, width, height };
|
|
4385
|
-
if (!this.renderSpread)
|
|
4386
|
-
this.spreadRenderCancel();
|
|
4387
|
-
}
|
|
4388
|
-
spreadRender() {
|
|
4389
|
-
const { x, y, width, height } = this.renderBounds;
|
|
4390
|
-
this._renderBounds = { x, y, width, height };
|
|
4391
|
-
this._localRenderBounds = { x, y, width, height };
|
|
4392
|
-
}
|
|
4393
4426
|
boxChange() {
|
|
4394
4427
|
this.boxChanged = true;
|
|
4395
4428
|
this.localBoxChanged || this.localBoxChange();
|
|
@@ -4476,24 +4509,40 @@ var LeaferUI = (function (exports) {
|
|
|
4476
4509
|
});
|
|
4477
4510
|
},
|
|
4478
4511
|
off(type, listener, options) {
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
|
|
4512
|
+
if (type) {
|
|
4513
|
+
const typeList = typeof type === 'string' ? type.split(' ') : type;
|
|
4514
|
+
if (listener) {
|
|
4515
|
+
let capture;
|
|
4516
|
+
if (options)
|
|
4517
|
+
capture = typeof options === 'boolean' ? options : options.capture;
|
|
4518
|
+
let events, index;
|
|
4519
|
+
const map = __getListenerMap(this, capture);
|
|
4520
|
+
typeList.forEach(type => {
|
|
4521
|
+
if (type) {
|
|
4522
|
+
events = map[type];
|
|
4523
|
+
if (events) {
|
|
4524
|
+
index = events.findIndex(item => item.listener === listener);
|
|
4525
|
+
if (index > -1)
|
|
4526
|
+
events.splice(index, 1);
|
|
4527
|
+
if (!events.length)
|
|
4528
|
+
delete map[type];
|
|
4529
|
+
}
|
|
4530
|
+
}
|
|
4531
|
+
});
|
|
4495
4532
|
}
|
|
4496
|
-
|
|
4533
|
+
else {
|
|
4534
|
+
const { __bubbleMap: b, __captureMap: c } = this;
|
|
4535
|
+
typeList.forEach(type => {
|
|
4536
|
+
if (b)
|
|
4537
|
+
delete b[type];
|
|
4538
|
+
if (c)
|
|
4539
|
+
delete c[type];
|
|
4540
|
+
});
|
|
4541
|
+
}
|
|
4542
|
+
}
|
|
4543
|
+
else {
|
|
4544
|
+
this.__bubbleMap = this.__captureMap = undefined;
|
|
4545
|
+
}
|
|
4497
4546
|
},
|
|
4498
4547
|
on_(type, listener, bind, options) {
|
|
4499
4548
|
if (bind)
|
|
@@ -4529,12 +4578,15 @@ var LeaferUI = (function (exports) {
|
|
|
4529
4578
|
break;
|
|
4530
4579
|
}
|
|
4531
4580
|
}
|
|
4581
|
+
this.syncEventer && this.syncEventer.emitEvent(event, capture);
|
|
4532
4582
|
},
|
|
4533
4583
|
emitEvent(event, capture) {
|
|
4534
4584
|
event.current = this;
|
|
4535
4585
|
this.emit(event.type, event, capture);
|
|
4536
4586
|
},
|
|
4537
4587
|
hasEvent(type, capture) {
|
|
4588
|
+
if (this.syncEventer && this.syncEventer.hasEvent(type, capture))
|
|
4589
|
+
return true;
|
|
4538
4590
|
const { __bubbleMap: b, __captureMap: c } = this;
|
|
4539
4591
|
const hasB = b && b[type], hasC = c && c[type];
|
|
4540
4592
|
return !!(capture === undefined ? (hasB || hasC) : (capture ? hasC : hasB));
|
|
@@ -4754,10 +4806,10 @@ var LeaferUI = (function (exports) {
|
|
|
4754
4806
|
};
|
|
4755
4807
|
|
|
4756
4808
|
const { setLayout, multiplyParent: multiplyParent$1, translateInner, defaultWorld } = MatrixHelper;
|
|
4757
|
-
const { toPoint, tempPoint } = AroundHelper;
|
|
4809
|
+
const { toPoint, tempPoint: tempPoint$1 } = AroundHelper;
|
|
4758
4810
|
const LeafMatrix = {
|
|
4759
4811
|
__updateWorldMatrix() {
|
|
4760
|
-
multiplyParent$1(this.__local || this.__layout, this.parent ? this.parent.__world : defaultWorld, this.__world, !!this.__layout.affectScaleOrRotation, this.__);
|
|
4812
|
+
multiplyParent$1(this.__local || this.__layout, this.parent ? this.parent.__world : defaultWorld, this.__world, !!this.__layout.affectScaleOrRotation, this.__, this.parent && this.parent.__);
|
|
4761
4813
|
},
|
|
4762
4814
|
__updateLocalMatrix() {
|
|
4763
4815
|
if (this.__local) {
|
|
@@ -4768,11 +4820,11 @@ var LeaferUI = (function (exports) {
|
|
|
4768
4820
|
layout.scaleChanged = layout.rotationChanged = false;
|
|
4769
4821
|
}
|
|
4770
4822
|
}
|
|
4771
|
-
local.e = data.x;
|
|
4772
|
-
local.f = data.y;
|
|
4773
|
-
if (data.around) {
|
|
4774
|
-
toPoint(data.around, layout.boxBounds, tempPoint);
|
|
4775
|
-
translateInner(local, -tempPoint.x, -tempPoint.y);
|
|
4823
|
+
local.e = data.x + data.offsetX;
|
|
4824
|
+
local.f = data.y + data.offsetY;
|
|
4825
|
+
if (data.around || data.origin) {
|
|
4826
|
+
toPoint(data.around || data.origin, layout.boxBounds, tempPoint$1);
|
|
4827
|
+
translateInner(local, -tempPoint$1.x, -tempPoint$1.y, data.origin);
|
|
4776
4828
|
}
|
|
4777
4829
|
}
|
|
4778
4830
|
this.__layout.matrixChanged = false;
|
|
@@ -4878,6 +4930,8 @@ var LeaferUI = (function (exports) {
|
|
|
4878
4930
|
if (this.isBranch) {
|
|
4879
4931
|
if (this.leafer)
|
|
4880
4932
|
this.leafer.layouter.addExtra(this);
|
|
4933
|
+
if (this.__.flow)
|
|
4934
|
+
this.__updateFlowLayout();
|
|
4881
4935
|
if (hasParentAutoLayout(this)) {
|
|
4882
4936
|
updateMatrix$1(this);
|
|
4883
4937
|
}
|
|
@@ -4910,6 +4964,8 @@ var LeaferUI = (function (exports) {
|
|
|
4910
4964
|
canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
|
|
4911
4965
|
canvas.opacity = this.__.opacity;
|
|
4912
4966
|
if (this.__.__single) {
|
|
4967
|
+
if (this.__.eraser === 'path')
|
|
4968
|
+
return this.__renderEraser(canvas, options);
|
|
4913
4969
|
const tempCanvas = canvas.getSameCanvas(true, true);
|
|
4914
4970
|
this.__draw(tempCanvas, options);
|
|
4915
4971
|
if (this.__worldFlipped) {
|
|
@@ -4952,6 +5008,8 @@ var LeaferUI = (function (exports) {
|
|
|
4952
5008
|
__render(canvas, options) {
|
|
4953
5009
|
if (this.__worldOpacity) {
|
|
4954
5010
|
if (this.__.__single) {
|
|
5011
|
+
if (this.__.eraser === 'path')
|
|
5012
|
+
return this.__renderEraser(canvas, options);
|
|
4955
5013
|
const tempCanvas = canvas.getSameCanvas(false, true);
|
|
4956
5014
|
this.__renderBranch(tempCanvas, options);
|
|
4957
5015
|
const nowWorld = this.__getNowWorld(options);
|
|
@@ -5091,7 +5149,9 @@ var LeaferUI = (function (exports) {
|
|
|
5091
5149
|
setProxyAttr(_attrName, _newValue) { }
|
|
5092
5150
|
getProxyAttr(_attrName) { return undefined; }
|
|
5093
5151
|
find(_condition, _options) { return undefined; }
|
|
5152
|
+
findTag(_tag) { return undefined; }
|
|
5094
5153
|
findOne(_condition, _options) { return undefined; }
|
|
5154
|
+
findId(_id) { return undefined; }
|
|
5095
5155
|
focus(_value) { }
|
|
5096
5156
|
forceUpdate(attrName) {
|
|
5097
5157
|
if (attrName === undefined)
|
|
@@ -5113,9 +5173,11 @@ var LeaferUI = (function (exports) {
|
|
|
5113
5173
|
__updateLocalStrokeBounds() { }
|
|
5114
5174
|
__updateLocalRenderBounds() { }
|
|
5115
5175
|
__updateBoxBounds() { }
|
|
5176
|
+
__updateContentBounds() { }
|
|
5116
5177
|
__updateStrokeBounds() { }
|
|
5117
5178
|
__updateRenderBounds() { }
|
|
5118
5179
|
__updateAutoLayout() { }
|
|
5180
|
+
__updateFlowLayout() { }
|
|
5119
5181
|
__updateNaturalSize() { }
|
|
5120
5182
|
__updateStrokeSpread() { return 0; }
|
|
5121
5183
|
__updateRenderSpread() { return 0; }
|
|
@@ -5123,6 +5185,13 @@ var LeaferUI = (function (exports) {
|
|
|
5123
5185
|
__updateEraser(value) {
|
|
5124
5186
|
this.__hasEraser = value ? true : this.children.some(item => item.__.eraser);
|
|
5125
5187
|
}
|
|
5188
|
+
__renderEraser(canvas, options) {
|
|
5189
|
+
canvas.save();
|
|
5190
|
+
this.__clip(canvas, options);
|
|
5191
|
+
const { renderBounds: r } = this.__layout;
|
|
5192
|
+
canvas.clearRect(r.x, r.y, r.width, r.height);
|
|
5193
|
+
canvas.restore();
|
|
5194
|
+
}
|
|
5126
5195
|
__updateMask(value) {
|
|
5127
5196
|
this.__hasMask = value ? true : this.children.some(item => item.__.mask);
|
|
5128
5197
|
}
|
|
@@ -5303,8 +5372,8 @@ var LeaferUI = (function (exports) {
|
|
|
5303
5372
|
emit(_type, _event, _capture) { }
|
|
5304
5373
|
emitEvent(_event, _capture) { }
|
|
5305
5374
|
hasEvent(_type, _capture) { return false; }
|
|
5306
|
-
static changeAttr(attrName, defaultValue) {
|
|
5307
|
-
defineDataProcessor(this.prototype, attrName, defaultValue);
|
|
5375
|
+
static changeAttr(attrName, defaultValue, fn) {
|
|
5376
|
+
fn ? this.addAttr(attrName, defaultValue, fn) : defineDataProcessor(this.prototype, attrName, defaultValue);
|
|
5308
5377
|
}
|
|
5309
5378
|
static addAttr(attrName, defaultValue, fn) {
|
|
5310
5379
|
if (!fn)
|
|
@@ -6231,8 +6300,11 @@ var LeaferUI = (function (exports) {
|
|
|
6231
6300
|
if (!bounds.includes(this.target.__world) || this.needFill || !e.samePixelRatio) {
|
|
6232
6301
|
this.addBlock(this.canvas.bounds);
|
|
6233
6302
|
this.target.forceUpdate('surface');
|
|
6303
|
+
return;
|
|
6234
6304
|
}
|
|
6235
6305
|
}
|
|
6306
|
+
this.addBlock(new Bounds(0, 0, 1, 1));
|
|
6307
|
+
this.changed = true;
|
|
6236
6308
|
}
|
|
6237
6309
|
__onLayoutEnd(event) {
|
|
6238
6310
|
if (event.data)
|
|
@@ -6338,7 +6410,11 @@ var LeaferUI = (function (exports) {
|
|
|
6338
6410
|
defineKey(target, key, {
|
|
6339
6411
|
set(value) { if (this.isLeafer)
|
|
6340
6412
|
this[privateKey] = value; },
|
|
6341
|
-
get() {
|
|
6413
|
+
get() {
|
|
6414
|
+
return this.isApp
|
|
6415
|
+
? this.tree.zoomLayer
|
|
6416
|
+
: (this.isLeafer ? (this[privateKey] || this) : this.leafer && this.leafer.zoomLayer);
|
|
6417
|
+
}
|
|
6342
6418
|
});
|
|
6343
6419
|
};
|
|
6344
6420
|
}
|
|
@@ -6478,7 +6554,7 @@ var LeaferUI = (function (exports) {
|
|
|
6478
6554
|
const UnitConvert = {
|
|
6479
6555
|
number(value, percentRefer) {
|
|
6480
6556
|
if (typeof value === 'object')
|
|
6481
|
-
return value.type === 'percent' ? value.value / 100 * percentRefer : value.value;
|
|
6557
|
+
return value.type === 'percent' ? (value.value > 49 ? value.value / 100 : value.value) * percentRefer : value.value;
|
|
6482
6558
|
return value;
|
|
6483
6559
|
}
|
|
6484
6560
|
};
|
|
@@ -6744,6 +6820,9 @@ var LeaferUI = (function (exports) {
|
|
|
6744
6820
|
pen.set(this.path = this.__.path || []);
|
|
6745
6821
|
return pen;
|
|
6746
6822
|
}
|
|
6823
|
+
get editConfig() { return undefined; }
|
|
6824
|
+
get editOuter() { return 'EditTool'; }
|
|
6825
|
+
get editInner() { return 'PathEditor'; }
|
|
6747
6826
|
constructor(data) {
|
|
6748
6827
|
super(data);
|
|
6749
6828
|
}
|
|
@@ -6756,7 +6835,9 @@ var LeaferUI = (function (exports) {
|
|
|
6756
6835
|
}
|
|
6757
6836
|
createProxyData() { return undefined; }
|
|
6758
6837
|
find(_condition, _options) { return undefined; }
|
|
6838
|
+
findTag(tag) { return this.find({ tag }); }
|
|
6759
6839
|
findOne(_condition, _options) { return undefined; }
|
|
6840
|
+
findId(id) { return this.findOne({ id }); }
|
|
6760
6841
|
getPath(curve, pathForRender) {
|
|
6761
6842
|
this.__layout.update();
|
|
6762
6843
|
let path = pathForRender ? this.__.__pathForRender : this.__.path;
|
|
@@ -6805,7 +6886,8 @@ var LeaferUI = (function (exports) {
|
|
|
6805
6886
|
__drawPathByBox(drawer) {
|
|
6806
6887
|
const { x, y, width, height } = this.__layout.boxBounds;
|
|
6807
6888
|
if (this.__.cornerRadius) {
|
|
6808
|
-
|
|
6889
|
+
const { cornerRadius } = this.__;
|
|
6890
|
+
drawer.roundRect(x, y, width, height, typeof cornerRadius === 'number' ? [cornerRadius] : cornerRadius);
|
|
6809
6891
|
}
|
|
6810
6892
|
else {
|
|
6811
6893
|
drawer.rect(x, y, width, height);
|
|
@@ -6826,6 +6908,9 @@ var LeaferUI = (function (exports) {
|
|
|
6826
6908
|
static registerData(data) {
|
|
6827
6909
|
dataProcessor(data)(this.prototype);
|
|
6828
6910
|
}
|
|
6911
|
+
static setEditConfig(_config) { }
|
|
6912
|
+
static setEditOuter(_toolName) { }
|
|
6913
|
+
static setEditInner(_editorName) { }
|
|
6829
6914
|
destroy() {
|
|
6830
6915
|
this.fill = this.stroke = null;
|
|
6831
6916
|
super.destroy();
|
|
@@ -6903,21 +6988,84 @@ var LeaferUI = (function (exports) {
|
|
|
6903
6988
|
__decorate([
|
|
6904
6989
|
rotationType(0, true)
|
|
6905
6990
|
], exports.UI.prototype, "skewY", void 0);
|
|
6991
|
+
__decorate([
|
|
6992
|
+
positionType(0, true)
|
|
6993
|
+
], exports.UI.prototype, "offsetX", void 0);
|
|
6994
|
+
__decorate([
|
|
6995
|
+
positionType(0, true)
|
|
6996
|
+
], exports.UI.prototype, "offsetY", void 0);
|
|
6997
|
+
__decorate([
|
|
6998
|
+
positionType(0, true)
|
|
6999
|
+
], exports.UI.prototype, "scrollX", void 0);
|
|
7000
|
+
__decorate([
|
|
7001
|
+
positionType(0, true)
|
|
7002
|
+
], exports.UI.prototype, "scrollY", void 0);
|
|
7003
|
+
__decorate([
|
|
7004
|
+
autoLayoutType()
|
|
7005
|
+
], exports.UI.prototype, "origin", void 0);
|
|
6906
7006
|
__decorate([
|
|
6907
7007
|
autoLayoutType()
|
|
6908
7008
|
], exports.UI.prototype, "around", void 0);
|
|
6909
7009
|
__decorate([
|
|
6910
7010
|
dataType(false)
|
|
6911
|
-
], exports.UI.prototype, "
|
|
7011
|
+
], exports.UI.prototype, "lazy", void 0);
|
|
6912
7012
|
__decorate([
|
|
6913
|
-
|
|
6914
|
-
], exports.UI.prototype, "
|
|
7013
|
+
naturalBoundsType(1)
|
|
7014
|
+
], exports.UI.prototype, "pixelRatio", void 0);
|
|
7015
|
+
__decorate([
|
|
7016
|
+
pathInputType()
|
|
7017
|
+
], exports.UI.prototype, "path", void 0);
|
|
7018
|
+
__decorate([
|
|
7019
|
+
pathType()
|
|
7020
|
+
], exports.UI.prototype, "windingRule", void 0);
|
|
7021
|
+
__decorate([
|
|
7022
|
+
pathType(true)
|
|
7023
|
+
], exports.UI.prototype, "closed", void 0);
|
|
7024
|
+
__decorate([
|
|
7025
|
+
autoLayoutType(false)
|
|
7026
|
+
], exports.UI.prototype, "flow", void 0);
|
|
7027
|
+
__decorate([
|
|
7028
|
+
boundsType(0)
|
|
7029
|
+
], exports.UI.prototype, "padding", void 0);
|
|
7030
|
+
__decorate([
|
|
7031
|
+
boundsType(0)
|
|
7032
|
+
], exports.UI.prototype, "gap", void 0);
|
|
7033
|
+
__decorate([
|
|
7034
|
+
boundsType('top-left')
|
|
7035
|
+
], exports.UI.prototype, "align", void 0);
|
|
7036
|
+
__decorate([
|
|
7037
|
+
boundsType(false)
|
|
7038
|
+
], exports.UI.prototype, "wrap", void 0);
|
|
6915
7039
|
__decorate([
|
|
6916
|
-
|
|
6917
|
-
], exports.UI.prototype, "
|
|
7040
|
+
boundsType('box')
|
|
7041
|
+
], exports.UI.prototype, "itemBox", void 0);
|
|
7042
|
+
__decorate([
|
|
7043
|
+
boundsType(true)
|
|
7044
|
+
], exports.UI.prototype, "inFlow", void 0);
|
|
7045
|
+
__decorate([
|
|
7046
|
+
boundsType()
|
|
7047
|
+
], exports.UI.prototype, "autoWidth", void 0);
|
|
7048
|
+
__decorate([
|
|
7049
|
+
boundsType()
|
|
7050
|
+
], exports.UI.prototype, "autoHeight", void 0);
|
|
7051
|
+
__decorate([
|
|
7052
|
+
boundsType()
|
|
7053
|
+
], exports.UI.prototype, "autoBox", void 0);
|
|
7054
|
+
__decorate([
|
|
7055
|
+
boundsType()
|
|
7056
|
+
], exports.UI.prototype, "widthRange", void 0);
|
|
7057
|
+
__decorate([
|
|
7058
|
+
boundsType()
|
|
7059
|
+
], exports.UI.prototype, "heightRange", void 0);
|
|
7060
|
+
__decorate([
|
|
7061
|
+
dataType(false)
|
|
7062
|
+
], exports.UI.prototype, "draggable", void 0);
|
|
6918
7063
|
__decorate([
|
|
6919
7064
|
dataType()
|
|
6920
|
-
], exports.UI.prototype, "
|
|
7065
|
+
], exports.UI.prototype, "dragBounds", void 0);
|
|
7066
|
+
__decorate([
|
|
7067
|
+
dataType(false)
|
|
7068
|
+
], exports.UI.prototype, "editable", void 0);
|
|
6921
7069
|
__decorate([
|
|
6922
7070
|
hitType(true)
|
|
6923
7071
|
], exports.UI.prototype, "hittable", void 0);
|
|
@@ -6972,21 +7120,6 @@ var LeaferUI = (function (exports) {
|
|
|
6972
7120
|
__decorate([
|
|
6973
7121
|
strokeType(10)
|
|
6974
7122
|
], exports.UI.prototype, "miterLimit", void 0);
|
|
6975
|
-
__decorate([
|
|
6976
|
-
dataType(false)
|
|
6977
|
-
], exports.UI.prototype, "lazy", void 0);
|
|
6978
|
-
__decorate([
|
|
6979
|
-
naturalBoundsType(1)
|
|
6980
|
-
], exports.UI.prototype, "pixelRatio", void 0);
|
|
6981
|
-
__decorate([
|
|
6982
|
-
pathInputType()
|
|
6983
|
-
], exports.UI.prototype, "path", void 0);
|
|
6984
|
-
__decorate([
|
|
6985
|
-
pathType()
|
|
6986
|
-
], exports.UI.prototype, "windingRule", void 0);
|
|
6987
|
-
__decorate([
|
|
6988
|
-
pathType(true)
|
|
6989
|
-
], exports.UI.prototype, "closed", void 0);
|
|
6990
7123
|
__decorate([
|
|
6991
7124
|
arrowType('none')
|
|
6992
7125
|
], exports.UI.prototype, "startArrow", void 0);
|
|
@@ -7109,7 +7242,6 @@ var LeaferUI = (function (exports) {
|
|
|
7109
7242
|
var Leafer_1;
|
|
7110
7243
|
const debug$1 = Debug.get('Leafer');
|
|
7111
7244
|
exports.Leafer = Leafer_1 = class Leafer extends exports.Group {
|
|
7112
|
-
static get version() { return '1.0.0-rc.21'; }
|
|
7113
7245
|
get __tag() { return 'Leafer'; }
|
|
7114
7246
|
get isApp() { return false; }
|
|
7115
7247
|
get app() { return this.parent || this; }
|
|
@@ -7162,7 +7294,6 @@ var LeaferUI = (function (exports) {
|
|
|
7162
7294
|
if (this.isApp)
|
|
7163
7295
|
this.__setApp();
|
|
7164
7296
|
this.__checkAutoLayout(config);
|
|
7165
|
-
this.updateLazyBounds();
|
|
7166
7297
|
this.view = canvas.view;
|
|
7167
7298
|
if (parentApp) {
|
|
7168
7299
|
this.__bindApp(parentApp);
|
|
@@ -7222,9 +7353,6 @@ var LeaferUI = (function (exports) {
|
|
|
7222
7353
|
const data = DataHelper.copyAttrs({}, size, canvasSizeAttrs);
|
|
7223
7354
|
Object.keys(data).forEach(key => this[key] = data[key]);
|
|
7224
7355
|
}
|
|
7225
|
-
forceFullRender() {
|
|
7226
|
-
this.forceRender();
|
|
7227
|
-
}
|
|
7228
7356
|
forceRender(bounds) {
|
|
7229
7357
|
this.renderer.addBlock(bounds ? new Bounds(bounds) : this.canvas.bounds);
|
|
7230
7358
|
if (this.viewReady)
|
|
@@ -7302,7 +7430,7 @@ var LeaferUI = (function (exports) {
|
|
|
7302
7430
|
this.canvas.backgroundColor = newValue;
|
|
7303
7431
|
}
|
|
7304
7432
|
else {
|
|
7305
|
-
this.
|
|
7433
|
+
this.forceRender();
|
|
7306
7434
|
}
|
|
7307
7435
|
}
|
|
7308
7436
|
__onCreated() {
|
|
@@ -7406,6 +7534,7 @@ var LeaferUI = (function (exports) {
|
|
|
7406
7534
|
__listenEvents() {
|
|
7407
7535
|
const runId = Run.start('FirstCreate ' + this.innerName);
|
|
7408
7536
|
this.once(LeaferEvent.START, () => Run.end(runId));
|
|
7537
|
+
this.once(LayoutEvent.START, () => this.updateLazyBounds());
|
|
7409
7538
|
this.once(LayoutEvent.END, () => this.__onReady());
|
|
7410
7539
|
this.once(RenderEvent.START, () => this.__onCreated());
|
|
7411
7540
|
this.once(RenderEvent.END, () => this.__onViewReady());
|
|
@@ -7512,6 +7641,8 @@ var LeaferUI = (function (exports) {
|
|
|
7512
7641
|
else {
|
|
7513
7642
|
this.__updateRectBoxBounds();
|
|
7514
7643
|
}
|
|
7644
|
+
if (data.flow)
|
|
7645
|
+
this.__updateContentBounds();
|
|
7515
7646
|
}
|
|
7516
7647
|
__updateStrokeBounds() { }
|
|
7517
7648
|
__updateRenderBounds() {
|
|
@@ -7921,9 +8052,10 @@ var LeaferUI = (function (exports) {
|
|
|
7921
8052
|
registerUI()
|
|
7922
8053
|
], exports.Canvas);
|
|
7923
8054
|
|
|
7924
|
-
const { copyAndSpread, includes, spread, setList } = BoundsHelper;
|
|
8055
|
+
const { copyAndSpread, includes, isSame: isSame$1, spread, setList } = BoundsHelper;
|
|
7925
8056
|
exports.Text = class Text extends exports.UI {
|
|
7926
8057
|
get __tag() { return 'Text'; }
|
|
8058
|
+
get editInner() { return 'TextEditor'; }
|
|
7927
8059
|
get textDrawData() {
|
|
7928
8060
|
this.__layout.update();
|
|
7929
8061
|
return this.__.__textDrawData;
|
|
@@ -7993,7 +8125,7 @@ var LeaferUI = (function (exports) {
|
|
|
7993
8125
|
if (italic)
|
|
7994
8126
|
b.width += fontSize * 0.16;
|
|
7995
8127
|
const contentBounds = includes(b, bounds) ? b : bounds;
|
|
7996
|
-
if (contentBounds
|
|
8128
|
+
if (!isSame$1(contentBounds, layout.contentBounds)) {
|
|
7997
8129
|
layout.contentBounds = contentBounds;
|
|
7998
8130
|
layout.renderChanged = true;
|
|
7999
8131
|
setList(data.__textBoxBounds = {}, [b, bounds]);
|
|
@@ -8021,9 +8153,6 @@ var LeaferUI = (function (exports) {
|
|
|
8021
8153
|
__decorate([
|
|
8022
8154
|
boundsType(0)
|
|
8023
8155
|
], exports.Text.prototype, "height", void 0);
|
|
8024
|
-
__decorate([
|
|
8025
|
-
boundsType(0)
|
|
8026
|
-
], exports.Text.prototype, "padding", void 0);
|
|
8027
8156
|
__decorate([
|
|
8028
8157
|
surfaceType('#000000')
|
|
8029
8158
|
], exports.Text.prototype, "fill", void 0);
|
|
@@ -8152,7 +8281,7 @@ var LeaferUI = (function (exports) {
|
|
|
8152
8281
|
};
|
|
8153
8282
|
}
|
|
8154
8283
|
|
|
8155
|
-
const version = "1.0.0-rc.
|
|
8284
|
+
const version = "1.0.0-rc.23";
|
|
8156
8285
|
|
|
8157
8286
|
function fillText(ui, canvas) {
|
|
8158
8287
|
let row;
|
|
@@ -8373,7 +8502,7 @@ var LeaferUI = (function (exports) {
|
|
|
8373
8502
|
}
|
|
8374
8503
|
else {
|
|
8375
8504
|
const { renderShapeSpread: spread } = ui.__layout;
|
|
8376
|
-
const worldClipBounds = getIntersectData(spread ? getSpread(current.bounds, spread * scaleX, spread *
|
|
8505
|
+
const worldClipBounds = getIntersectData(spread ? getSpread(current.bounds, scaleX === scaleY ? spread * scaleX : [spread * scaleY, spread * scaleX]) : current.bounds, nowWorld);
|
|
8377
8506
|
fitMatrix = current.bounds.getFitMatrix(worldClipBounds);
|
|
8378
8507
|
let { a: fitScaleX, d: fitScaleY } = fitMatrix;
|
|
8379
8508
|
if (fitMatrix.a < 1) {
|
|
@@ -8456,79 +8585,75 @@ var LeaferUI = (function (exports) {
|
|
|
8456
8585
|
|
|
8457
8586
|
let origin = {};
|
|
8458
8587
|
const { get: get$4, rotateOfOuter: rotateOfOuter$2, translate: translate$1, scaleOfOuter: scaleOfOuter$2, scale: scaleHelper, rotate } = MatrixHelper;
|
|
8459
|
-
function fillOrFitMode(data,
|
|
8588
|
+
function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
8460
8589
|
const transform = get$4();
|
|
8461
|
-
|
|
8462
|
-
|
|
8463
|
-
const sh = box.height / (swap ? width : height);
|
|
8464
|
-
const scale = mode === 'fit' ? Math.min(sw, sh) : Math.max(sw, sh);
|
|
8465
|
-
const x = box.x + (box.width - width * scale) / 2;
|
|
8466
|
-
const y = box.y + (box.height - height * scale) / 2;
|
|
8467
|
-
translate$1(transform, x, y);
|
|
8468
|
-
scaleHelper(transform, scale);
|
|
8590
|
+
translate$1(transform, box.x + x, box.y + y);
|
|
8591
|
+
scaleHelper(transform, scaleX, scaleY);
|
|
8469
8592
|
if (rotation)
|
|
8470
8593
|
rotateOfOuter$2(transform, { x: box.x + box.width / 2, y: box.y + box.height / 2 }, rotation);
|
|
8471
|
-
data.scaleX = data.scaleY = scale;
|
|
8472
8594
|
data.transform = transform;
|
|
8473
8595
|
}
|
|
8474
8596
|
function clipMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
8475
8597
|
const transform = get$4();
|
|
8476
|
-
translate$1(transform, box.x, box.y);
|
|
8477
|
-
if (
|
|
8478
|
-
translate$1(transform, x, y);
|
|
8479
|
-
if (scaleX) {
|
|
8598
|
+
translate$1(transform, box.x + x, box.y + y);
|
|
8599
|
+
if (scaleX)
|
|
8480
8600
|
scaleHelper(transform, scaleX, scaleY);
|
|
8481
|
-
data.scaleX = transform.a;
|
|
8482
|
-
data.scaleY = transform.d;
|
|
8483
|
-
}
|
|
8484
8601
|
if (rotation)
|
|
8485
8602
|
rotate(transform, rotation);
|
|
8486
8603
|
data.transform = transform;
|
|
8487
8604
|
}
|
|
8488
|
-
function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation) {
|
|
8605
|
+
function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align) {
|
|
8489
8606
|
const transform = get$4();
|
|
8490
8607
|
if (rotation) {
|
|
8491
|
-
|
|
8492
|
-
|
|
8493
|
-
|
|
8494
|
-
|
|
8495
|
-
|
|
8496
|
-
|
|
8497
|
-
|
|
8498
|
-
|
|
8499
|
-
|
|
8500
|
-
|
|
8501
|
-
|
|
8608
|
+
if (align === 'center') {
|
|
8609
|
+
rotateOfOuter$2(transform, { x: width / 2, y: height / 2 }, rotation);
|
|
8610
|
+
}
|
|
8611
|
+
else {
|
|
8612
|
+
rotate(transform, rotation);
|
|
8613
|
+
switch (rotation) {
|
|
8614
|
+
case 90:
|
|
8615
|
+
translate$1(transform, height, 0);
|
|
8616
|
+
break;
|
|
8617
|
+
case 180:
|
|
8618
|
+
translate$1(transform, width, height);
|
|
8619
|
+
break;
|
|
8620
|
+
case 270:
|
|
8621
|
+
translate$1(transform, 0, width);
|
|
8622
|
+
break;
|
|
8623
|
+
}
|
|
8502
8624
|
}
|
|
8503
8625
|
}
|
|
8504
|
-
origin.x = box.x;
|
|
8505
|
-
origin.y = box.y;
|
|
8506
|
-
if (x || y)
|
|
8507
|
-
origin.x += x, origin.y += y;
|
|
8626
|
+
origin.x = box.x + x;
|
|
8627
|
+
origin.y = box.y + y;
|
|
8508
8628
|
translate$1(transform, origin.x, origin.y);
|
|
8509
|
-
if (scaleX)
|
|
8629
|
+
if (scaleX)
|
|
8510
8630
|
scaleOfOuter$2(transform, origin, scaleX, scaleY);
|
|
8511
|
-
data.scaleX = scaleX;
|
|
8512
|
-
data.scaleY = scaleY;
|
|
8513
|
-
}
|
|
8514
8631
|
data.transform = transform;
|
|
8515
8632
|
}
|
|
8516
8633
|
|
|
8517
8634
|
const { get: get$3, translate } = MatrixHelper;
|
|
8518
8635
|
const tempBox = new Bounds();
|
|
8636
|
+
const tempPoint = {};
|
|
8519
8637
|
function createData(leafPaint, image, paint, box) {
|
|
8520
8638
|
let { width, height } = image;
|
|
8521
8639
|
if (paint.padding)
|
|
8522
8640
|
box = tempBox.set(box).shrink(paint.padding);
|
|
8523
|
-
const { opacity, mode, offset, scale, size, rotation, blendMode, repeat } = paint;
|
|
8641
|
+
const { opacity, mode, align, offset, scale, size, rotation, blendMode, repeat } = paint;
|
|
8524
8642
|
const sameBox = box.width === width && box.height === height;
|
|
8525
8643
|
if (blendMode)
|
|
8526
8644
|
leafPaint.blendMode = blendMode;
|
|
8527
8645
|
const data = leafPaint.data = { mode };
|
|
8528
|
-
|
|
8529
|
-
|
|
8530
|
-
|
|
8531
|
-
if (
|
|
8646
|
+
const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
|
|
8647
|
+
const swapWidth = swapSize ? height : width, swapHeight = swapSize ? width : height;
|
|
8648
|
+
let x = 0, y = 0, scaleX, scaleY;
|
|
8649
|
+
if (!mode || mode === 'cover' || mode === 'fit') {
|
|
8650
|
+
if (!sameBox || rotation) {
|
|
8651
|
+
const sw = box.width / swapWidth, sh = box.height / swapHeight;
|
|
8652
|
+
scaleX = scaleY = mode === 'fit' ? Math.min(sw, sh) : Math.max(sw, sh);
|
|
8653
|
+
x += (box.width - width * scaleX) / 2, y += (box.height - height * scaleY) / 2;
|
|
8654
|
+
}
|
|
8655
|
+
}
|
|
8656
|
+
else if (size) {
|
|
8532
8657
|
scaleX = (typeof size === 'number' ? size : size.width) / width;
|
|
8533
8658
|
scaleY = (typeof size === 'number' ? size : size.height) / height;
|
|
8534
8659
|
}
|
|
@@ -8536,26 +8661,36 @@ var LeaferUI = (function (exports) {
|
|
|
8536
8661
|
scaleX = typeof scale === 'number' ? scale : scale.x;
|
|
8537
8662
|
scaleY = typeof scale === 'number' ? scale : scale.y;
|
|
8538
8663
|
}
|
|
8664
|
+
if (align) {
|
|
8665
|
+
const imageBounds = { x, y, width: swapWidth, height: swapHeight };
|
|
8666
|
+
if (scaleX)
|
|
8667
|
+
imageBounds.width *= scaleX, imageBounds.height *= scaleY;
|
|
8668
|
+
AlignHelper.toPoint(align, imageBounds, box, tempPoint, true);
|
|
8669
|
+
x += tempPoint.x, y += tempPoint.y;
|
|
8670
|
+
}
|
|
8671
|
+
if (offset)
|
|
8672
|
+
x += offset.x, y += offset.y;
|
|
8539
8673
|
switch (mode) {
|
|
8540
8674
|
case 'strench':
|
|
8541
8675
|
if (!sameBox)
|
|
8542
8676
|
width = box.width, height = box.height;
|
|
8543
8677
|
break;
|
|
8678
|
+
case 'normal':
|
|
8544
8679
|
case 'clip':
|
|
8545
|
-
if (
|
|
8680
|
+
if (x || y || scaleX || rotation)
|
|
8546
8681
|
clipMode(data, box, x, y, scaleX, scaleY, rotation);
|
|
8547
8682
|
break;
|
|
8548
8683
|
case 'repeat':
|
|
8549
8684
|
if (!sameBox || scaleX || rotation)
|
|
8550
|
-
repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation);
|
|
8685
|
+
repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align);
|
|
8551
8686
|
if (!repeat)
|
|
8552
8687
|
data.repeat = 'repeat';
|
|
8553
8688
|
break;
|
|
8554
8689
|
case 'fit':
|
|
8555
8690
|
case 'cover':
|
|
8556
8691
|
default:
|
|
8557
|
-
if (
|
|
8558
|
-
fillOrFitMode(data,
|
|
8692
|
+
if (scaleX)
|
|
8693
|
+
fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation);
|
|
8559
8694
|
}
|
|
8560
8695
|
if (!data.transform) {
|
|
8561
8696
|
if (box.x || box.y) {
|
|
@@ -8563,6 +8698,10 @@ var LeaferUI = (function (exports) {
|
|
|
8563
8698
|
translate(data.transform, box.x, box.y);
|
|
8564
8699
|
}
|
|
8565
8700
|
}
|
|
8701
|
+
if (scaleX && mode !== 'strench') {
|
|
8702
|
+
data.scaleX = scaleX;
|
|
8703
|
+
data.scaleY = scaleY;
|
|
8704
|
+
}
|
|
8566
8705
|
data.width = width;
|
|
8567
8706
|
data.height = height;
|
|
8568
8707
|
if (opacity)
|
|
@@ -9460,11 +9599,13 @@ var LeaferUI = (function (exports) {
|
|
|
9460
9599
|
const { rows, overflow } = drawData;
|
|
9461
9600
|
let { textOverflow } = style;
|
|
9462
9601
|
rows.splice(overflow);
|
|
9463
|
-
if (textOverflow !== '
|
|
9464
|
-
if (textOverflow === '
|
|
9602
|
+
if (textOverflow && textOverflow !== 'show') {
|
|
9603
|
+
if (textOverflow === 'hide')
|
|
9604
|
+
textOverflow = '';
|
|
9605
|
+
else if (textOverflow === 'ellipsis')
|
|
9465
9606
|
textOverflow = '...';
|
|
9466
9607
|
let char, charRight;
|
|
9467
|
-
const ellipsisWidth = Platform.canvas.measureText(textOverflow).width;
|
|
9608
|
+
const ellipsisWidth = textOverflow ? Platform.canvas.measureText(textOverflow).width : 0;
|
|
9468
9609
|
const right = style.x + style.width - ellipsisWidth;
|
|
9469
9610
|
const list = style.textWrap === 'none' ? rows : [rows[overflow - 1]];
|
|
9470
9611
|
list.forEach(row => {
|
|
@@ -9618,6 +9759,13 @@ var LeaferUI = (function (exports) {
|
|
|
9618
9759
|
resolve();
|
|
9619
9760
|
this.running = false;
|
|
9620
9761
|
};
|
|
9762
|
+
if (filename === 'json') {
|
|
9763
|
+
return over({ data: leaf.toJSON() });
|
|
9764
|
+
}
|
|
9765
|
+
else if (FileHelper.fileType(filename) === 'json') {
|
|
9766
|
+
Platform.origin.download('data:text/plain;charset=utf-8,' + encodeURIComponent(JSON.stringify(leaf.toJSON())), filename);
|
|
9767
|
+
return over({ data: true });
|
|
9768
|
+
}
|
|
9621
9769
|
const { leafer } = leaf;
|
|
9622
9770
|
if (leafer) {
|
|
9623
9771
|
leafer.waitViewCompleted(() => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -9625,8 +9773,12 @@ var LeaferUI = (function (exports) {
|
|
|
9625
9773
|
let renderBounds, trimBounds, scaleX = 1, scaleY = 1;
|
|
9626
9774
|
const { worldTransform, isLeafer, isFrame } = leaf;
|
|
9627
9775
|
const { slice, trim, onCanvas } = options;
|
|
9628
|
-
|
|
9629
|
-
|
|
9776
|
+
let scale = options.scale || 1;
|
|
9777
|
+
let pixelRatio = options.pixelRatio || 1;
|
|
9778
|
+
if (leaf.isApp) {
|
|
9779
|
+
scale *= pixelRatio;
|
|
9780
|
+
pixelRatio = leaf.app.pixelRatio;
|
|
9781
|
+
}
|
|
9630
9782
|
const screenshot = options.screenshot || leaf.isApp;
|
|
9631
9783
|
const fill = (isLeafer && screenshot) ? (options.fill === undefined ? leaf.fill : options.fill) : options.fill;
|
|
9632
9784
|
const needFill = FileHelper.isOpaqueImage(filename) || fill, matrix = new Matrix();
|
|
@@ -9756,6 +9908,7 @@ var LeaferUI = (function (exports) {
|
|
|
9756
9908
|
|
|
9757
9909
|
useCanvas();
|
|
9758
9910
|
|
|
9911
|
+
exports.AlignHelper = AlignHelper;
|
|
9759
9912
|
exports.AnimateEvent = AnimateEvent;
|
|
9760
9913
|
exports.AroundHelper = AroundHelper;
|
|
9761
9914
|
exports.AutoBounds = AutoBounds;
|
|
@@ -9901,7 +10054,7 @@ var LeaferUI = (function (exports) {
|
|
|
9901
10054
|
exports.surfaceType = surfaceType;
|
|
9902
10055
|
exports.tempBounds = tempBounds$1;
|
|
9903
10056
|
exports.tempMatrix = tempMatrix;
|
|
9904
|
-
exports.tempPoint = tempPoint$
|
|
10057
|
+
exports.tempPoint = tempPoint$3;
|
|
9905
10058
|
exports.useCanvas = useCanvas;
|
|
9906
10059
|
exports.useModule = useModule;
|
|
9907
10060
|
exports.version = version;
|