@leafer-ui/miniapp 1.0.0-rc.22 → 1.0.0-rc.24
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/miniapp.esm.js +84 -61
- package/dist/miniapp.esm.min.js +1 -1
- package/dist/miniapp.module.js +535 -347
- package/dist/miniapp.module.min.js +1 -1
- package/package.json +10 -10
package/dist/miniapp.module.js
CHANGED
|
@@ -3,7 +3,7 @@ const Platform = {
|
|
|
3
3
|
hitCanvasSize: 100,
|
|
4
4
|
maxCacheSize: 2560 * 1600,
|
|
5
5
|
maxPatternSize: 4096 * 2160,
|
|
6
|
-
suffix: '
|
|
6
|
+
suffix: '',
|
|
7
7
|
crossOrigin: 'anonymous'
|
|
8
8
|
}
|
|
9
9
|
};
|
|
@@ -33,24 +33,12 @@ const I$2 = IncrementId;
|
|
|
33
33
|
const { round, pow: pow$1, PI: PI$4 } = Math;
|
|
34
34
|
const MathHelper = {
|
|
35
35
|
within(value, min, max) {
|
|
36
|
-
if (value < min)
|
|
36
|
+
if (min !== undefined && value < min)
|
|
37
37
|
value = min;
|
|
38
|
-
if (value > max)
|
|
38
|
+
if (max !== undefined && value > max)
|
|
39
39
|
value = max;
|
|
40
40
|
return value;
|
|
41
41
|
},
|
|
42
|
-
minus(value, isFourNumber) {
|
|
43
|
-
if (value instanceof Array) {
|
|
44
|
-
if (isFourNumber)
|
|
45
|
-
value = MathHelper.fourNumber(value, 0);
|
|
46
|
-
for (let i = 0; i < value.length; i++)
|
|
47
|
-
value[i] = -value[i];
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
value = -value;
|
|
51
|
-
}
|
|
52
|
-
return value;
|
|
53
|
-
},
|
|
54
42
|
fourNumber(num, maxValue) {
|
|
55
43
|
let data;
|
|
56
44
|
if (num instanceof Array) {
|
|
@@ -147,9 +135,11 @@ const MatrixHelper = {
|
|
|
147
135
|
t.e += x;
|
|
148
136
|
t.f += y;
|
|
149
137
|
},
|
|
150
|
-
translateInner(t, x, y) {
|
|
138
|
+
translateInner(t, x, y, isMoveOrigin) {
|
|
151
139
|
t.e += t.a * x + t.c * y;
|
|
152
140
|
t.f += t.b * x + t.d * y;
|
|
141
|
+
if (isMoveOrigin)
|
|
142
|
+
t.e -= x, t.f -= y;
|
|
153
143
|
},
|
|
154
144
|
scale(t, scaleX, scaleY = scaleX) {
|
|
155
145
|
t.a *= scaleX;
|
|
@@ -216,8 +206,10 @@ const MatrixHelper = {
|
|
|
216
206
|
t.e = child.e * a + child.f * c + e;
|
|
217
207
|
t.f = child.e * b + child.f * d + f;
|
|
218
208
|
},
|
|
219
|
-
multiplyParent(t, parent, to, abcdChanged, childScaleData) {
|
|
220
|
-
|
|
209
|
+
multiplyParent(t, parent, to, abcdChanged, childScaleData, scrollData) {
|
|
210
|
+
let { e, f } = t;
|
|
211
|
+
if (scrollData)
|
|
212
|
+
e += scrollData.scrollX, f += scrollData.scrollY;
|
|
221
213
|
to || (to = t);
|
|
222
214
|
if (abcdChanged === undefined)
|
|
223
215
|
abcdChanged = t.a !== 1 || t.b || t.c || t.d !== 1;
|
|
@@ -338,7 +330,7 @@ const MatrixHelper = {
|
|
|
338
330
|
t.e = x;
|
|
339
331
|
t.f = y;
|
|
340
332
|
if (origin)
|
|
341
|
-
M$6.translateInner(t, -origin.x, -origin.y);
|
|
333
|
+
M$6.translateInner(t, -origin.x, -origin.y, true);
|
|
342
334
|
},
|
|
343
335
|
getLayout(t, origin, firstSkewY) {
|
|
344
336
|
const { a, b, c, d, e, f } = t;
|
|
@@ -758,7 +750,7 @@ const { float, fourNumber } = MathHelper;
|
|
|
758
750
|
const { floor, ceil: ceil$2 } = Math;
|
|
759
751
|
let right$1, bottom$1, boundsRight, boundsBottom;
|
|
760
752
|
const point = {};
|
|
761
|
-
const toPoint$
|
|
753
|
+
const toPoint$5 = {};
|
|
762
754
|
const BoundsHelper = {
|
|
763
755
|
tempBounds: {},
|
|
764
756
|
set(t, x = 0, y = 0, width = 0, height = 0) {
|
|
@@ -773,15 +765,17 @@ const BoundsHelper = {
|
|
|
773
765
|
t.width = bounds.width;
|
|
774
766
|
t.height = bounds.height;
|
|
775
767
|
},
|
|
776
|
-
copyAndSpread(t, bounds,
|
|
777
|
-
if (
|
|
778
|
-
const four = fourNumber(
|
|
779
|
-
|
|
768
|
+
copyAndSpread(t, bounds, spread, isShrink) {
|
|
769
|
+
if (spread instanceof Array) {
|
|
770
|
+
const four = fourNumber(spread);
|
|
771
|
+
isShrink
|
|
772
|
+
? B.set(t, bounds.x + four[3], bounds.y + four[0], bounds.width - four[1] - four[3], bounds.height - four[2] - four[0])
|
|
773
|
+
: B.set(t, bounds.x - four[3], bounds.y - four[0], bounds.width + four[1] + four[3], bounds.height + four[2] + four[0]);
|
|
780
774
|
}
|
|
781
775
|
else {
|
|
782
|
-
if (
|
|
783
|
-
|
|
784
|
-
B.set(t, bounds.x -
|
|
776
|
+
if (isShrink)
|
|
777
|
+
spread = -spread;
|
|
778
|
+
B.set(t, bounds.x - spread, bounds.y - spread, bounds.width + spread * 2, bounds.height + spread * 2);
|
|
785
779
|
}
|
|
786
780
|
},
|
|
787
781
|
minX(t) { return t.width > 0 ? t.x : t.x + t.width; },
|
|
@@ -858,17 +852,17 @@ const BoundsHelper = {
|
|
|
858
852
|
else {
|
|
859
853
|
point.x = t.x;
|
|
860
854
|
point.y = t.y;
|
|
861
|
-
toOuterPoint$1(matrix, point, toPoint$
|
|
862
|
-
setPoint$3(tempPointBounds$1, toPoint$
|
|
855
|
+
toOuterPoint$1(matrix, point, toPoint$5);
|
|
856
|
+
setPoint$3(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
|
|
863
857
|
point.x = t.x + t.width;
|
|
864
|
-
toOuterPoint$1(matrix, point, toPoint$
|
|
865
|
-
addPoint$3(tempPointBounds$1, toPoint$
|
|
858
|
+
toOuterPoint$1(matrix, point, toPoint$5);
|
|
859
|
+
addPoint$3(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
|
|
866
860
|
point.y = t.y + t.height;
|
|
867
|
-
toOuterPoint$1(matrix, point, toPoint$
|
|
868
|
-
addPoint$3(tempPointBounds$1, toPoint$
|
|
861
|
+
toOuterPoint$1(matrix, point, toPoint$5);
|
|
862
|
+
addPoint$3(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
|
|
869
863
|
point.x = t.x;
|
|
870
|
-
toOuterPoint$1(matrix, point, toPoint$
|
|
871
|
-
addPoint$3(tempPointBounds$1, toPoint$
|
|
864
|
+
toOuterPoint$1(matrix, point, toPoint$5);
|
|
865
|
+
addPoint$3(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
|
|
872
866
|
toBounds$4(tempPointBounds$1, to);
|
|
873
867
|
}
|
|
874
868
|
},
|
|
@@ -881,13 +875,16 @@ const BoundsHelper = {
|
|
|
881
875
|
const scale = Math.min(baseScale, Math.min(t.width / put.width, t.height / put.height));
|
|
882
876
|
return new Matrix(scale, 0, 0, scale, -put.x * scale, -put.y * scale);
|
|
883
877
|
},
|
|
884
|
-
getSpread(t,
|
|
878
|
+
getSpread(t, spread) {
|
|
885
879
|
const n = {};
|
|
886
|
-
B.copyAndSpread(n, t,
|
|
880
|
+
B.copyAndSpread(n, t, spread);
|
|
887
881
|
return n;
|
|
888
882
|
},
|
|
889
|
-
spread(t,
|
|
890
|
-
B.copyAndSpread(t, t,
|
|
883
|
+
spread(t, spread) {
|
|
884
|
+
B.copyAndSpread(t, t, spread);
|
|
885
|
+
},
|
|
886
|
+
shrink(t, shrink) {
|
|
887
|
+
B.copyAndSpread(t, t, shrink, true);
|
|
891
888
|
},
|
|
892
889
|
ceil(t) {
|
|
893
890
|
const { x, y } = t;
|
|
@@ -1067,12 +1064,12 @@ class Bounds {
|
|
|
1067
1064
|
getFitMatrix(put, baseScale) {
|
|
1068
1065
|
return BoundsHelper.getFitMatrix(this, put, baseScale);
|
|
1069
1066
|
}
|
|
1070
|
-
spread(fourNumber
|
|
1071
|
-
BoundsHelper.spread(this, fourNumber
|
|
1067
|
+
spread(fourNumber) {
|
|
1068
|
+
BoundsHelper.spread(this, fourNumber);
|
|
1072
1069
|
return this;
|
|
1073
1070
|
}
|
|
1074
1071
|
shrink(fourNumber) {
|
|
1075
|
-
BoundsHelper.
|
|
1072
|
+
BoundsHelper.shrink(this, fourNumber);
|
|
1076
1073
|
return this;
|
|
1077
1074
|
}
|
|
1078
1075
|
ceil() {
|
|
@@ -1189,6 +1186,10 @@ var Direction9;
|
|
|
1189
1186
|
Direction9[Direction9["bottomLeft"] = 6] = "bottomLeft";
|
|
1190
1187
|
Direction9[Direction9["left"] = 7] = "left";
|
|
1191
1188
|
Direction9[Direction9["center"] = 8] = "center";
|
|
1189
|
+
Direction9[Direction9["top-left"] = 0] = "top-left";
|
|
1190
|
+
Direction9[Direction9["top-right"] = 2] = "top-right";
|
|
1191
|
+
Direction9[Direction9["bottom-right"] = 4] = "bottom-right";
|
|
1192
|
+
Direction9[Direction9["bottom-left"] = 6] = "bottom-left";
|
|
1192
1193
|
})(Direction9 || (Direction9 = {}));
|
|
1193
1194
|
|
|
1194
1195
|
const directionData = [
|
|
@@ -1202,6 +1203,7 @@ const directionData = [
|
|
|
1202
1203
|
{ x: 0, y: 0.5 },
|
|
1203
1204
|
{ x: 0.5, y: 0.5 }
|
|
1204
1205
|
];
|
|
1206
|
+
directionData.forEach(item => item.type = 'percent');
|
|
1205
1207
|
const AroundHelper = {
|
|
1206
1208
|
directionData,
|
|
1207
1209
|
tempPoint: {},
|
|
@@ -1209,15 +1211,19 @@ const AroundHelper = {
|
|
|
1209
1211
|
toPoint(around, bounds, to, onlySize, pointBounds) {
|
|
1210
1212
|
to || (to = {});
|
|
1211
1213
|
const point = get$5(around);
|
|
1212
|
-
to.x = point.x
|
|
1213
|
-
to.y = point.y
|
|
1214
|
-
if (
|
|
1215
|
-
to.x
|
|
1216
|
-
to.y
|
|
1217
|
-
if (
|
|
1218
|
-
to.x -=
|
|
1219
|
-
|
|
1220
|
-
|
|
1214
|
+
to.x = point.x;
|
|
1215
|
+
to.y = point.y;
|
|
1216
|
+
if (point.type === 'percent') {
|
|
1217
|
+
to.x *= bounds.width;
|
|
1218
|
+
to.y *= bounds.height;
|
|
1219
|
+
if (pointBounds) {
|
|
1220
|
+
to.x -= pointBounds.x;
|
|
1221
|
+
to.y -= pointBounds.y;
|
|
1222
|
+
if (point.x)
|
|
1223
|
+
to.x -= (point.x === 1) ? pointBounds.width : (point.x === 0.5 ? point.x * pointBounds.width : 0);
|
|
1224
|
+
if (point.y)
|
|
1225
|
+
to.y -= (point.y === 1) ? pointBounds.height : (point.y === 0.5 ? point.y * pointBounds.height : 0);
|
|
1226
|
+
}
|
|
1221
1227
|
}
|
|
1222
1228
|
if (!onlySize) {
|
|
1223
1229
|
to.x += bounds.x;
|
|
@@ -1229,6 +1235,13 @@ function get$5(around) {
|
|
|
1229
1235
|
return typeof around === 'string' ? directionData[Direction9[around]] : around;
|
|
1230
1236
|
}
|
|
1231
1237
|
|
|
1238
|
+
const { toPoint: toPoint$4 } = AroundHelper;
|
|
1239
|
+
const AlignHelper = {
|
|
1240
|
+
toPoint(align, contentBounds, bounds, to, onlySize) {
|
|
1241
|
+
toPoint$4(align, bounds, to, onlySize, contentBounds);
|
|
1242
|
+
}
|
|
1243
|
+
};
|
|
1244
|
+
|
|
1232
1245
|
const StringNumberMap = {
|
|
1233
1246
|
'0': 1,
|
|
1234
1247
|
'1': 1,
|
|
@@ -1461,13 +1474,21 @@ const DataHelper = {
|
|
|
1461
1474
|
},
|
|
1462
1475
|
clone(data) {
|
|
1463
1476
|
return JSON.parse(JSON.stringify(data));
|
|
1477
|
+
},
|
|
1478
|
+
toMap(list) {
|
|
1479
|
+
const map = {};
|
|
1480
|
+
for (let i = 0, len = list.length; i < len; i++)
|
|
1481
|
+
map[list[i]] = true;
|
|
1482
|
+
return map;
|
|
1464
1483
|
}
|
|
1465
1484
|
};
|
|
1466
1485
|
const { assign } = DataHelper;
|
|
1467
1486
|
|
|
1468
1487
|
class LeafData {
|
|
1488
|
+
get __useNaturalRatio() { return true; }
|
|
1489
|
+
get __isLinePath() { return this.path && this.path.length === 6; }
|
|
1469
1490
|
get __blendMode() {
|
|
1470
|
-
if (this.eraser)
|
|
1491
|
+
if (this.eraser && this.eraser !== 'path')
|
|
1471
1492
|
return 'destination-out';
|
|
1472
1493
|
const { blendMode } = this;
|
|
1473
1494
|
return blendMode === 'pass-through' ? null : blendMode;
|
|
@@ -1963,6 +1984,11 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
1963
1984
|
}
|
|
1964
1985
|
updateViewSize() { }
|
|
1965
1986
|
updateClientBounds() { }
|
|
1987
|
+
getClientBounds(update) {
|
|
1988
|
+
if (update)
|
|
1989
|
+
this.updateClientBounds();
|
|
1990
|
+
return this.clientBounds || this.bounds;
|
|
1991
|
+
}
|
|
1966
1992
|
startAutoLayout(_autoBounds, _listener) { }
|
|
1967
1993
|
stopAutoLayout() { }
|
|
1968
1994
|
setCursor(_cursor) { }
|
|
@@ -2097,7 +2123,7 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
2097
2123
|
}
|
|
2098
2124
|
clear() {
|
|
2099
2125
|
const { pixelRatio } = this;
|
|
2100
|
-
this.clearRect(0, 0, this.width * pixelRatio, this.height * pixelRatio);
|
|
2126
|
+
this.clearRect(0, 0, this.width * pixelRatio + 2, this.height * pixelRatio + 2);
|
|
2101
2127
|
}
|
|
2102
2128
|
isSameSize(size) {
|
|
2103
2129
|
return this.width === size.width && this.height === size.height && this.pixelRatio === size.pixelRatio;
|
|
@@ -2214,7 +2240,7 @@ const RectHelper = {
|
|
|
2214
2240
|
|
|
2215
2241
|
const { sin: sin$3, cos: cos$3, atan2: atan2$1, ceil: ceil$1, abs: abs$3, PI: PI$2, sqrt: sqrt$1, pow } = Math;
|
|
2216
2242
|
const { setPoint: setPoint$2, addPoint: addPoint$2 } = TwoPointBoundsHelper;
|
|
2217
|
-
const { set
|
|
2243
|
+
const { set } = PointHelper;
|
|
2218
2244
|
const { M: M$5, L: L$6, C: C$5, Q: Q$4, Z: Z$5 } = PathCommandMap;
|
|
2219
2245
|
const tempPoint$2 = {};
|
|
2220
2246
|
const BezierHelper = {
|
|
@@ -2292,9 +2318,9 @@ const BezierHelper = {
|
|
|
2292
2318
|
addPoint$2(setPointBounds, x1, y1);
|
|
2293
2319
|
}
|
|
2294
2320
|
if (setStartPoint)
|
|
2295
|
-
set
|
|
2321
|
+
set(setStartPoint, fromX, fromY);
|
|
2296
2322
|
if (setEndPoint)
|
|
2297
|
-
set
|
|
2323
|
+
set(setEndPoint, x1, y1);
|
|
2298
2324
|
return;
|
|
2299
2325
|
}
|
|
2300
2326
|
const anticlockwise = BAx * CBy - CBx * BAy < 0;
|
|
@@ -2343,7 +2369,7 @@ const BezierHelper = {
|
|
|
2343
2369
|
if (setPointBounds)
|
|
2344
2370
|
setPoint$2(setPointBounds, fromX, fromY);
|
|
2345
2371
|
if (setStartPoint)
|
|
2346
|
-
set
|
|
2372
|
+
set(setStartPoint, fromX, fromY);
|
|
2347
2373
|
for (let i = 0; i < parts; i++) {
|
|
2348
2374
|
endCos = cos$3(endRadian);
|
|
2349
2375
|
endSin = sin$3(endRadian);
|
|
@@ -2365,7 +2391,7 @@ const BezierHelper = {
|
|
|
2365
2391
|
endRadian += partRadian;
|
|
2366
2392
|
}
|
|
2367
2393
|
if (setEndPoint)
|
|
2368
|
-
set
|
|
2394
|
+
set(setEndPoint, cx + x, cy + y);
|
|
2369
2395
|
},
|
|
2370
2396
|
quadraticCurveTo(data, fromX, fromY, x1, y1, toX, toY) {
|
|
2371
2397
|
data.push(C$5, (fromX + 2 * x1) / 3, (fromY + 2 * y1) / 3, (toX + 2 * x1) / 3, (toY + 2 * y1) / 3, toX, toY);
|
|
@@ -2511,11 +2537,15 @@ const PathConvert = {
|
|
|
2511
2537
|
char = pathString[i];
|
|
2512
2538
|
if (StringNumberMap[char]) {
|
|
2513
2539
|
if (char === '.') {
|
|
2514
|
-
current.dot
|
|
2515
|
-
if (current.dot > 1) {
|
|
2540
|
+
if (current.dot) {
|
|
2516
2541
|
pushData(data, num);
|
|
2517
2542
|
num = '';
|
|
2518
2543
|
}
|
|
2544
|
+
current.dot++;
|
|
2545
|
+
}
|
|
2546
|
+
if (num === '0' && char !== '.') {
|
|
2547
|
+
pushData(data, num);
|
|
2548
|
+
num = '';
|
|
2519
2549
|
}
|
|
2520
2550
|
num += char;
|
|
2521
2551
|
}
|
|
@@ -3605,7 +3635,9 @@ class LeaferImage {
|
|
|
3605
3635
|
}
|
|
3606
3636
|
}
|
|
3607
3637
|
|
|
3608
|
-
function defineKey(target, key, descriptor) {
|
|
3638
|
+
function defineKey(target, key, descriptor, noConfigurable) {
|
|
3639
|
+
if (!noConfigurable)
|
|
3640
|
+
descriptor.configurable = descriptor.enumerable = true;
|
|
3609
3641
|
Object.defineProperty(target, key, descriptor);
|
|
3610
3642
|
}
|
|
3611
3643
|
function getDescriptor(object, name) {
|
|
@@ -3624,9 +3656,7 @@ function attr(partDescriptor) {
|
|
|
3624
3656
|
function defineLeafAttr(target, key, defaultValue, partDescriptor) {
|
|
3625
3657
|
const defaultDescriptor = {
|
|
3626
3658
|
get() { return this.__getAttr(key); },
|
|
3627
|
-
set(value) { this.__setAttr(key, value); }
|
|
3628
|
-
configurable: true,
|
|
3629
|
-
enumerable: true
|
|
3659
|
+
set(value) { this.__setAttr(key, value); }
|
|
3630
3660
|
};
|
|
3631
3661
|
defineKey(target, key, Object.assign(defaultDescriptor, partDescriptor || {}));
|
|
3632
3662
|
defineDataProcessor(target, key, defaultValue);
|
|
@@ -3637,35 +3667,33 @@ function dataType(defaultValue) {
|
|
|
3637
3667
|
function positionType(defaultValue, checkFiniteNumber) {
|
|
3638
3668
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3639
3669
|
set(value) {
|
|
3640
|
-
this.__setAttr(key, value, checkFiniteNumber);
|
|
3641
|
-
this.__layout.matrixChanged || this.__layout.matrixChange();
|
|
3670
|
+
this.__setAttr(key, value, checkFiniteNumber) && (this.__layout.matrixChanged || this.__layout.matrixChange());
|
|
3642
3671
|
}
|
|
3643
3672
|
}));
|
|
3644
3673
|
}
|
|
3645
3674
|
function autoLayoutType(defaultValue) {
|
|
3646
3675
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3647
3676
|
set(value) {
|
|
3648
|
-
this.__setAttr(key, value)
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3677
|
+
if (this.__setAttr(key, value)) {
|
|
3678
|
+
this.__layout.matrixChanged || this.__layout.matrixChange();
|
|
3679
|
+
this.__hasAutoLayout = !!value;
|
|
3680
|
+
if (!this.__local)
|
|
3681
|
+
this.__layout.createLocal();
|
|
3682
|
+
}
|
|
3653
3683
|
}
|
|
3654
3684
|
}));
|
|
3655
3685
|
}
|
|
3656
3686
|
function scaleType(defaultValue, checkFiniteNumber) {
|
|
3657
3687
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3658
3688
|
set(value) {
|
|
3659
|
-
this.__setAttr(key, value, checkFiniteNumber);
|
|
3660
|
-
this.__layout.scaleChanged || this.__layout.scaleChange();
|
|
3689
|
+
this.__setAttr(key, value, checkFiniteNumber) && (this.__layout.scaleChanged || this.__layout.scaleChange());
|
|
3661
3690
|
}
|
|
3662
3691
|
}));
|
|
3663
3692
|
}
|
|
3664
3693
|
function rotationType(defaultValue, checkFiniteNumber) {
|
|
3665
3694
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3666
3695
|
set(value) {
|
|
3667
|
-
this.__setAttr(key, value, checkFiniteNumber);
|
|
3668
|
-
this.__layout.rotationChanged || this.__layout.rotationChange();
|
|
3696
|
+
this.__setAttr(key, value, checkFiniteNumber) && (this.__layout.rotationChanged || this.__layout.rotationChange());
|
|
3669
3697
|
}
|
|
3670
3698
|
}));
|
|
3671
3699
|
}
|
|
@@ -3679,9 +3707,7 @@ function boundsType(defaultValue, checkFiniteNumber) {
|
|
|
3679
3707
|
function naturalBoundsType(defaultValue) {
|
|
3680
3708
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3681
3709
|
set(value) {
|
|
3682
|
-
this.__setAttr(key, value);
|
|
3683
|
-
doBoundsType(this);
|
|
3684
|
-
this.__.__removeNaturalSize();
|
|
3710
|
+
this.__setAttr(key, value) && (doBoundsType(this), this.__.__removeNaturalSize());
|
|
3685
3711
|
}
|
|
3686
3712
|
}));
|
|
3687
3713
|
}
|
|
@@ -3693,8 +3719,11 @@ function doBoundsType(leaf) {
|
|
|
3693
3719
|
function pathInputType(defaultValue) {
|
|
3694
3720
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3695
3721
|
set(value) {
|
|
3696
|
-
|
|
3697
|
-
|
|
3722
|
+
const data = this.__;
|
|
3723
|
+
if (data.__pathInputed !== 2)
|
|
3724
|
+
data.__pathInputed = value ? 1 : 0;
|
|
3725
|
+
if (!value)
|
|
3726
|
+
data.__pathForRender = undefined;
|
|
3698
3727
|
this.__setAttr(key, value);
|
|
3699
3728
|
doBoundsType(this);
|
|
3700
3729
|
}
|
|
@@ -3725,54 +3754,66 @@ function affectRenderBoundsType(defaultValue) {
|
|
|
3725
3754
|
function surfaceType(defaultValue) {
|
|
3726
3755
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3727
3756
|
set(value) {
|
|
3728
|
-
this.__setAttr(key, value);
|
|
3729
|
-
this.__layout.surfaceChanged || this.__layout.surfaceChange();
|
|
3757
|
+
this.__setAttr(key, value) && (this.__layout.surfaceChanged || this.__layout.surfaceChange());
|
|
3730
3758
|
}
|
|
3731
3759
|
}));
|
|
3732
3760
|
}
|
|
3733
3761
|
function opacityType(defaultValue) {
|
|
3734
3762
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3735
3763
|
set(value) {
|
|
3736
|
-
this.__setAttr(key, value);
|
|
3737
|
-
|
|
3764
|
+
this.__setAttr(key, value) && (this.__layout.opacityChanged || this.__layout.opacityChange());
|
|
3765
|
+
}
|
|
3766
|
+
}));
|
|
3767
|
+
}
|
|
3768
|
+
function visibleType(defaultValue) {
|
|
3769
|
+
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3770
|
+
set(value) {
|
|
3771
|
+
const oldValue = this.visible;
|
|
3772
|
+
if (this.__setAttr(key, value)) {
|
|
3773
|
+
this.__layout.opacityChanged || this.__layout.opacityChange();
|
|
3774
|
+
if (oldValue === 0 || value === 0)
|
|
3775
|
+
doBoundsType(this);
|
|
3776
|
+
}
|
|
3738
3777
|
}
|
|
3739
3778
|
}));
|
|
3740
3779
|
}
|
|
3741
3780
|
function sortType(defaultValue) {
|
|
3742
3781
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3743
3782
|
set(value) {
|
|
3744
|
-
this.__setAttr(key, value)
|
|
3745
|
-
|
|
3746
|
-
|
|
3783
|
+
if (this.__setAttr(key, value)) {
|
|
3784
|
+
this.__layout.surfaceChanged || this.__layout.surfaceChange();
|
|
3785
|
+
this.waitParent(() => { this.parent.__layout.childrenSortChange(); });
|
|
3786
|
+
}
|
|
3747
3787
|
}
|
|
3748
3788
|
}));
|
|
3749
3789
|
}
|
|
3750
3790
|
function maskType(defaultValue) {
|
|
3751
3791
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3752
3792
|
set(value) {
|
|
3753
|
-
this.__setAttr(key, value)
|
|
3754
|
-
|
|
3755
|
-
|
|
3793
|
+
if (this.__setAttr(key, value)) {
|
|
3794
|
+
this.__layout.boxChanged || this.__layout.boxChange();
|
|
3795
|
+
this.waitParent(() => { this.parent.__updateMask(value); });
|
|
3796
|
+
}
|
|
3756
3797
|
}
|
|
3757
3798
|
}));
|
|
3758
3799
|
}
|
|
3759
3800
|
function eraserType(defaultValue) {
|
|
3760
3801
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3761
3802
|
set(value) {
|
|
3762
|
-
this.__setAttr(key, value);
|
|
3763
|
-
this.waitParent(() => { this.parent.__updateEraser(value); });
|
|
3803
|
+
this.__setAttr(key, value) && this.waitParent(() => { this.parent.__updateEraser(value); });
|
|
3764
3804
|
}
|
|
3765
3805
|
}));
|
|
3766
3806
|
}
|
|
3767
3807
|
function hitType(defaultValue) {
|
|
3768
3808
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3769
3809
|
set(value) {
|
|
3770
|
-
this.__setAttr(key, value)
|
|
3771
|
-
|
|
3772
|
-
|
|
3810
|
+
if (this.__setAttr(key, value)) {
|
|
3811
|
+
if (Debug.showHitView) {
|
|
3812
|
+
this.__layout.surfaceChanged || this.__layout.surfaceChange();
|
|
3813
|
+
}
|
|
3814
|
+
if (this.leafer)
|
|
3815
|
+
this.leafer.updateCursor();
|
|
3773
3816
|
}
|
|
3774
|
-
if (this.leafer)
|
|
3775
|
-
this.leafer.updateCursor();
|
|
3776
3817
|
}
|
|
3777
3818
|
}));
|
|
3778
3819
|
}
|
|
@@ -3813,9 +3854,7 @@ function defineDataProcessor(target, key, defaultValue) {
|
|
|
3813
3854
|
},
|
|
3814
3855
|
set(value) {
|
|
3815
3856
|
this[computedKey] = value;
|
|
3816
|
-
}
|
|
3817
|
-
configurable: true,
|
|
3818
|
-
enumerable: true
|
|
3857
|
+
}
|
|
3819
3858
|
};
|
|
3820
3859
|
if (defaultValue === undefined) {
|
|
3821
3860
|
property.get = function () { return this[computedKey]; };
|
|
@@ -3823,13 +3862,25 @@ function defineDataProcessor(target, key, defaultValue) {
|
|
|
3823
3862
|
else if (key === 'width') {
|
|
3824
3863
|
property.get = function () {
|
|
3825
3864
|
const v = this[computedKey];
|
|
3826
|
-
|
|
3865
|
+
if (v === undefined) {
|
|
3866
|
+
const t = this;
|
|
3867
|
+
return t._height && t.__naturalWidth && t.__useNaturalRatio ? t._height * t.__naturalWidth / t.__naturalHeight : t.__naturalWidth || defaultValue;
|
|
3868
|
+
}
|
|
3869
|
+
else {
|
|
3870
|
+
return v;
|
|
3871
|
+
}
|
|
3827
3872
|
};
|
|
3828
3873
|
}
|
|
3829
3874
|
else if (key === 'height') {
|
|
3830
3875
|
property.get = function () {
|
|
3831
3876
|
const v = this[computedKey];
|
|
3832
|
-
|
|
3877
|
+
if (v === undefined) {
|
|
3878
|
+
const t = this;
|
|
3879
|
+
return t._width && t.__naturalHeight && t.__useNaturalRatio ? t._width * t.__naturalHeight / t.__naturalWidth : t.__naturalHeight || defaultValue;
|
|
3880
|
+
}
|
|
3881
|
+
else {
|
|
3882
|
+
return v;
|
|
3883
|
+
}
|
|
3833
3884
|
};
|
|
3834
3885
|
}
|
|
3835
3886
|
let descriptor, find = data;
|
|
@@ -3843,7 +3894,7 @@ function defineDataProcessor(target, key, defaultValue) {
|
|
|
3843
3894
|
property.set = data[setMethodName];
|
|
3844
3895
|
delete data[setMethodName];
|
|
3845
3896
|
}
|
|
3846
|
-
|
|
3897
|
+
defineKey(data, key, property);
|
|
3847
3898
|
}
|
|
3848
3899
|
|
|
3849
3900
|
const debug$8 = new Debug('rewrite');
|
|
@@ -4044,13 +4095,6 @@ const LeafHelper = {
|
|
|
4044
4095
|
return true;
|
|
4045
4096
|
p = p.parent;
|
|
4046
4097
|
}
|
|
4047
|
-
},
|
|
4048
|
-
hasParentAutoLayout(p) {
|
|
4049
|
-
while (p.parent) {
|
|
4050
|
-
p = p.parent;
|
|
4051
|
-
if (p.__hasAutoLayout)
|
|
4052
|
-
return true;
|
|
4053
|
-
}
|
|
4054
4098
|
}
|
|
4055
4099
|
};
|
|
4056
4100
|
const L = LeafHelper;
|
|
@@ -4070,13 +4114,13 @@ const LeafBoundsHelper = {
|
|
|
4070
4114
|
return target.__world;
|
|
4071
4115
|
},
|
|
4072
4116
|
localBoxBounds(target) {
|
|
4073
|
-
return target.__.eraser ? null : (target.__local || target.__layout);
|
|
4117
|
+
return target.__.eraser || target.__.visible === 0 ? null : (target.__local || target.__layout);
|
|
4074
4118
|
},
|
|
4075
4119
|
localStrokeBounds(target) {
|
|
4076
|
-
return target.__.eraser ? null : target.__layout.localStrokeBounds;
|
|
4120
|
+
return target.__.eraser || target.__.visible === 0 ? null : target.__layout.localStrokeBounds;
|
|
4077
4121
|
},
|
|
4078
4122
|
localRenderBounds(target) {
|
|
4079
|
-
return target.__.eraser ? null : target.__layout.localRenderBounds;
|
|
4123
|
+
return target.__.eraser || target.__.visible === 0 ? null : target.__layout.localRenderBounds;
|
|
4080
4124
|
},
|
|
4081
4125
|
maskLocalBoxBounds(target) {
|
|
4082
4126
|
return target.__.mask ? target.__localBoxBounds : null;
|
|
@@ -4182,11 +4226,19 @@ const WaitHelper = {
|
|
|
4182
4226
|
|
|
4183
4227
|
const { getRelativeWorld: getRelativeWorld$1 } = LeafHelper;
|
|
4184
4228
|
const { toOuterOf: toOuterOf$2, getPoints, copy: copy$6 } = BoundsHelper;
|
|
4229
|
+
const localContent = '_localContentBounds';
|
|
4230
|
+
const worldContent = '_worldContentBounds', worldBox = '_worldBoxBounds', worldStroke = '_worldStrokeBounds';
|
|
4185
4231
|
class LeafLayout {
|
|
4232
|
+
get contentBounds() { return this._contentBounds || this.boxBounds; }
|
|
4233
|
+
set contentBounds(bounds) { this._contentBounds = bounds; }
|
|
4186
4234
|
get strokeBounds() { return this._strokeBounds || this.boxBounds; }
|
|
4187
4235
|
get renderBounds() { return this._renderBounds || this.boxBounds; }
|
|
4236
|
+
get localContentBounds() { toOuterOf$2(this.contentBounds, this.leaf.__localMatrix, this[localContent] || (this[localContent] = {})); return this[localContent]; }
|
|
4188
4237
|
get localStrokeBounds() { return this._localStrokeBounds || this; }
|
|
4189
4238
|
get localRenderBounds() { return this._localRenderBounds || this; }
|
|
4239
|
+
get worldContentBounds() { toOuterOf$2(this.contentBounds, this.leaf.__world, this[worldContent] || (this[worldContent] = {})); return this[worldContent]; }
|
|
4240
|
+
get worldBoxBounds() { toOuterOf$2(this.boxBounds, this.leaf.__world, this[worldBox] || (this[worldBox] = {})); return this[worldBox]; }
|
|
4241
|
+
get worldStrokeBounds() { toOuterOf$2(this.strokeBounds, this.leaf.__world, this[worldStroke] || (this[worldStroke] = {})); return this[worldStroke]; }
|
|
4190
4242
|
get a() { return 1; }
|
|
4191
4243
|
get b() { return 0; }
|
|
4192
4244
|
get c() { return 0; }
|
|
@@ -4269,7 +4321,6 @@ class LeafLayout {
|
|
|
4269
4321
|
case 'content':
|
|
4270
4322
|
if (this.contentBounds)
|
|
4271
4323
|
return this.contentBounds;
|
|
4272
|
-
case 'margin':
|
|
4273
4324
|
case 'box':
|
|
4274
4325
|
return this.boxBounds;
|
|
4275
4326
|
case 'stroke':
|
|
@@ -4282,8 +4333,9 @@ class LeafLayout {
|
|
|
4282
4333
|
return this.localRenderBounds;
|
|
4283
4334
|
case 'stroke':
|
|
4284
4335
|
return this.localStrokeBounds;
|
|
4285
|
-
case 'margin':
|
|
4286
4336
|
case 'content':
|
|
4337
|
+
if (this.contentBounds)
|
|
4338
|
+
return this.localContentBounds;
|
|
4287
4339
|
case 'box':
|
|
4288
4340
|
return this.leaf.__localBoxBounds;
|
|
4289
4341
|
}
|
|
@@ -4292,15 +4344,13 @@ class LeafLayout {
|
|
|
4292
4344
|
switch (type) {
|
|
4293
4345
|
case 'render':
|
|
4294
4346
|
return this.leaf.__world;
|
|
4347
|
+
case 'stroke':
|
|
4348
|
+
return this.worldStrokeBounds;
|
|
4295
4349
|
case 'content':
|
|
4296
4350
|
if (this.contentBounds)
|
|
4297
|
-
return this.
|
|
4298
|
-
case 'margin':
|
|
4351
|
+
return this.worldContentBounds;
|
|
4299
4352
|
case 'box':
|
|
4300
|
-
return this.
|
|
4301
|
-
case 'margin':
|
|
4302
|
-
case 'stroke':
|
|
4303
|
-
return this.getWorldStrokeBounds();
|
|
4353
|
+
return this.worldBoxBounds;
|
|
4304
4354
|
}
|
|
4305
4355
|
}
|
|
4306
4356
|
getLayoutBounds(type, relative = 'world', unscale) {
|
|
@@ -4363,20 +4413,24 @@ class LeafLayout {
|
|
|
4363
4413
|
points.forEach(point => leaf.innerToWorld(point, null, false, relativeLeaf));
|
|
4364
4414
|
return points;
|
|
4365
4415
|
}
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
return this._worldContentBounds;
|
|
4416
|
+
shrinkContent() {
|
|
4417
|
+
const { x, y, width, height } = this.boxBounds;
|
|
4418
|
+
this._contentBounds = { x, y, width, height };
|
|
4370
4419
|
}
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4420
|
+
spreadStroke() {
|
|
4421
|
+
const { x, y, width, height } = this.strokeBounds;
|
|
4422
|
+
this._strokeBounds = { x, y, width, height };
|
|
4423
|
+
this._localStrokeBounds = { x, y, width, height };
|
|
4424
|
+
if (!this.renderSpread)
|
|
4425
|
+
this.spreadRenderCancel();
|
|
4375
4426
|
}
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4427
|
+
spreadRender() {
|
|
4428
|
+
const { x, y, width, height } = this.renderBounds;
|
|
4429
|
+
this._renderBounds = { x, y, width, height };
|
|
4430
|
+
this._localRenderBounds = { x, y, width, height };
|
|
4431
|
+
}
|
|
4432
|
+
shrinkContentCancel() {
|
|
4433
|
+
this._contentBounds = undefined;
|
|
4380
4434
|
}
|
|
4381
4435
|
spreadStrokeCancel() {
|
|
4382
4436
|
const same = this.renderBounds === this.strokeBounds;
|
|
@@ -4389,18 +4443,6 @@ class LeafLayout {
|
|
|
4389
4443
|
this._renderBounds = this._strokeBounds;
|
|
4390
4444
|
this._localRenderBounds = this._localStrokeBounds;
|
|
4391
4445
|
}
|
|
4392
|
-
spreadStroke() {
|
|
4393
|
-
const { x, y, width, height } = this.strokeBounds;
|
|
4394
|
-
this._strokeBounds = { x, y, width, height };
|
|
4395
|
-
this._localStrokeBounds = { x, y, width, height };
|
|
4396
|
-
if (!this.renderSpread)
|
|
4397
|
-
this.spreadRenderCancel();
|
|
4398
|
-
}
|
|
4399
|
-
spreadRender() {
|
|
4400
|
-
const { x, y, width, height } = this.renderBounds;
|
|
4401
|
-
this._renderBounds = { x, y, width, height };
|
|
4402
|
-
this._localRenderBounds = { x, y, width, height };
|
|
4403
|
-
}
|
|
4404
4446
|
boxChange() {
|
|
4405
4447
|
this.boxChanged = true;
|
|
4406
4448
|
this.localBoxChanged || this.localBoxChange();
|
|
@@ -4487,24 +4529,40 @@ const LeafEventer = {
|
|
|
4487
4529
|
});
|
|
4488
4530
|
},
|
|
4489
4531
|
off(type, listener, options) {
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
|
|
4495
|
-
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4532
|
+
if (type) {
|
|
4533
|
+
const typeList = typeof type === 'string' ? type.split(' ') : type;
|
|
4534
|
+
if (listener) {
|
|
4535
|
+
let capture;
|
|
4536
|
+
if (options)
|
|
4537
|
+
capture = typeof options === 'boolean' ? options : options.capture;
|
|
4538
|
+
let events, index;
|
|
4539
|
+
const map = __getListenerMap(this, capture);
|
|
4540
|
+
typeList.forEach(type => {
|
|
4541
|
+
if (type) {
|
|
4542
|
+
events = map[type];
|
|
4543
|
+
if (events) {
|
|
4544
|
+
index = events.findIndex(item => item.listener === listener);
|
|
4545
|
+
if (index > -1)
|
|
4546
|
+
events.splice(index, 1);
|
|
4547
|
+
if (!events.length)
|
|
4548
|
+
delete map[type];
|
|
4549
|
+
}
|
|
4550
|
+
}
|
|
4551
|
+
});
|
|
4506
4552
|
}
|
|
4507
|
-
|
|
4553
|
+
else {
|
|
4554
|
+
const { __bubbleMap: b, __captureMap: c } = this;
|
|
4555
|
+
typeList.forEach(type => {
|
|
4556
|
+
if (b)
|
|
4557
|
+
delete b[type];
|
|
4558
|
+
if (c)
|
|
4559
|
+
delete c[type];
|
|
4560
|
+
});
|
|
4561
|
+
}
|
|
4562
|
+
}
|
|
4563
|
+
else {
|
|
4564
|
+
this.__bubbleMap = this.__captureMap = undefined;
|
|
4565
|
+
}
|
|
4508
4566
|
},
|
|
4509
4567
|
on_(type, listener, bind, options) {
|
|
4510
4568
|
if (bind)
|
|
@@ -4768,10 +4826,10 @@ const LeafDataProxy = {
|
|
|
4768
4826
|
};
|
|
4769
4827
|
|
|
4770
4828
|
const { setLayout, multiplyParent: multiplyParent$1, translateInner, defaultWorld } = MatrixHelper;
|
|
4771
|
-
const { toPoint, tempPoint: tempPoint$1 } = AroundHelper;
|
|
4829
|
+
const { toPoint: toPoint$3, tempPoint: tempPoint$1 } = AroundHelper;
|
|
4772
4830
|
const LeafMatrix = {
|
|
4773
4831
|
__updateWorldMatrix() {
|
|
4774
|
-
multiplyParent$1(this.__local || this.__layout, this.parent ? this.parent.__world : defaultWorld, this.__world, !!this.__layout.affectScaleOrRotation, this.__);
|
|
4832
|
+
multiplyParent$1(this.__local || this.__layout, this.parent ? this.parent.__world : defaultWorld, this.__world, !!this.__layout.affectScaleOrRotation, this.__, this.parent && this.parent.__);
|
|
4775
4833
|
},
|
|
4776
4834
|
__updateLocalMatrix() {
|
|
4777
4835
|
if (this.__local) {
|
|
@@ -4782,18 +4840,18 @@ const LeafMatrix = {
|
|
|
4782
4840
|
layout.scaleChanged = layout.rotationChanged = false;
|
|
4783
4841
|
}
|
|
4784
4842
|
}
|
|
4785
|
-
local.e = data.x;
|
|
4786
|
-
local.f = data.y;
|
|
4787
|
-
if (data.around) {
|
|
4788
|
-
toPoint(data.around, layout.boxBounds, tempPoint$1);
|
|
4789
|
-
translateInner(local, -tempPoint$1.x, -tempPoint$1.y);
|
|
4843
|
+
local.e = data.x + data.offsetX;
|
|
4844
|
+
local.f = data.y + data.offsetY;
|
|
4845
|
+
if (data.around || data.origin) {
|
|
4846
|
+
toPoint$3(data.around || data.origin, layout.boxBounds, tempPoint$1);
|
|
4847
|
+
translateInner(local, -tempPoint$1.x, -tempPoint$1.y, data.origin);
|
|
4790
4848
|
}
|
|
4791
4849
|
}
|
|
4792
4850
|
this.__layout.matrixChanged = false;
|
|
4793
4851
|
}
|
|
4794
4852
|
};
|
|
4795
4853
|
|
|
4796
|
-
const { updateMatrix: updateMatrix$1, updateAllMatrix: updateAllMatrix$2
|
|
4854
|
+
const { updateMatrix: updateMatrix$1, updateAllMatrix: updateAllMatrix$2 } = LeafHelper;
|
|
4797
4855
|
const { updateBounds: updateBounds$1 } = BranchHelper;
|
|
4798
4856
|
const { toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$5 } = BoundsHelper;
|
|
4799
4857
|
const { toBounds: toBounds$2 } = PathBounds;
|
|
@@ -4812,7 +4870,6 @@ const LeafBounds = {
|
|
|
4812
4870
|
this.__updatePath();
|
|
4813
4871
|
this.__updateRenderPath();
|
|
4814
4872
|
this.__updateBoxBounds();
|
|
4815
|
-
layout.boxChanged = false;
|
|
4816
4873
|
layout.resized = true;
|
|
4817
4874
|
}
|
|
4818
4875
|
if (layout.localBoxChanged) {
|
|
@@ -4826,12 +4883,12 @@ const LeafBounds = {
|
|
|
4826
4883
|
if (this.parent)
|
|
4827
4884
|
this.parent.__layout.boxChange();
|
|
4828
4885
|
}
|
|
4886
|
+
layout.boxChanged = false;
|
|
4829
4887
|
if (layout.strokeChanged) {
|
|
4830
4888
|
layout.strokeSpread = this.__updateStrokeSpread();
|
|
4831
4889
|
if (layout.strokeSpread) {
|
|
4832
|
-
if (layout.strokeBounds === layout.boxBounds)
|
|
4890
|
+
if (layout.strokeBounds === layout.boxBounds)
|
|
4833
4891
|
layout.spreadStroke();
|
|
4834
|
-
}
|
|
4835
4892
|
this.__updateStrokeBounds();
|
|
4836
4893
|
this.__updateLocalStrokeBounds();
|
|
4837
4894
|
}
|
|
@@ -4839,7 +4896,7 @@ const LeafBounds = {
|
|
|
4839
4896
|
layout.spreadStrokeCancel();
|
|
4840
4897
|
}
|
|
4841
4898
|
layout.strokeChanged = false;
|
|
4842
|
-
if (layout.renderSpread)
|
|
4899
|
+
if (layout.renderSpread || layout.strokeSpread !== layout.strokeBoxSpread)
|
|
4843
4900
|
layout.renderChanged = true;
|
|
4844
4901
|
if (this.parent)
|
|
4845
4902
|
this.parent.__layout.strokeChange();
|
|
@@ -4848,9 +4905,8 @@ const LeafBounds = {
|
|
|
4848
4905
|
if (layout.renderChanged) {
|
|
4849
4906
|
layout.renderSpread = this.__updateRenderSpread();
|
|
4850
4907
|
if (layout.renderSpread) {
|
|
4851
|
-
if (layout.renderBounds === layout.boxBounds || layout.renderBounds === layout.strokeBounds)
|
|
4908
|
+
if (layout.renderBounds === layout.boxBounds || layout.renderBounds === layout.strokeBounds)
|
|
4852
4909
|
layout.spreadRender();
|
|
4853
|
-
}
|
|
4854
4910
|
this.__updateRenderBounds();
|
|
4855
4911
|
this.__updateLocalRenderBounds();
|
|
4856
4912
|
}
|
|
@@ -4890,10 +4946,15 @@ const LeafBounds = {
|
|
|
4890
4946
|
__updateAutoLayout() {
|
|
4891
4947
|
this.__layout.matrixChanged = true;
|
|
4892
4948
|
if (this.isBranch) {
|
|
4893
|
-
if (this.leafer)
|
|
4949
|
+
if (this.leafer && this.leafer.ready)
|
|
4894
4950
|
this.leafer.layouter.addExtra(this);
|
|
4895
|
-
if (
|
|
4896
|
-
|
|
4951
|
+
if (this.__.flow) {
|
|
4952
|
+
if (this.__layout.boxChanged)
|
|
4953
|
+
this.__updateFlowLayout();
|
|
4954
|
+
updateAllMatrix$2(this);
|
|
4955
|
+
updateBounds$1(this, this);
|
|
4956
|
+
if (this.__.__autoSide)
|
|
4957
|
+
this.__updateBoxBounds();
|
|
4897
4958
|
}
|
|
4898
4959
|
else {
|
|
4899
4960
|
updateAllMatrix$2(this);
|
|
@@ -4910,12 +4971,13 @@ const LeafBounds = {
|
|
|
4910
4971
|
data.__naturalHeight = layout.boxBounds.height;
|
|
4911
4972
|
},
|
|
4912
4973
|
__updateStrokeBounds() {
|
|
4913
|
-
|
|
4974
|
+
const layout = this.__layout;
|
|
4975
|
+
copyAndSpread$1(layout.strokeBounds, layout.boxBounds, layout.strokeBoxSpread);
|
|
4914
4976
|
},
|
|
4915
4977
|
__updateRenderBounds() {
|
|
4916
|
-
const
|
|
4917
|
-
renderSpread > 0 ? copyAndSpread$1(renderBounds,
|
|
4918
|
-
}
|
|
4978
|
+
const layout = this.__layout;
|
|
4979
|
+
layout.renderSpread > 0 ? copyAndSpread$1(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$5(layout.renderBounds, layout.strokeBounds);
|
|
4980
|
+
}
|
|
4919
4981
|
};
|
|
4920
4982
|
|
|
4921
4983
|
const LeafRender = {
|
|
@@ -4924,6 +4986,8 @@ const LeafRender = {
|
|
|
4924
4986
|
canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
|
|
4925
4987
|
canvas.opacity = this.__.opacity;
|
|
4926
4988
|
if (this.__.__single) {
|
|
4989
|
+
if (this.__.eraser === 'path')
|
|
4990
|
+
return this.__renderEraser(canvas, options);
|
|
4927
4991
|
const tempCanvas = canvas.getSameCanvas(true, true);
|
|
4928
4992
|
this.__draw(tempCanvas, options);
|
|
4929
4993
|
if (this.__worldFlipped) {
|
|
@@ -4966,6 +5030,8 @@ const BranchRender = {
|
|
|
4966
5030
|
__render(canvas, options) {
|
|
4967
5031
|
if (this.__worldOpacity) {
|
|
4968
5032
|
if (this.__.__single) {
|
|
5033
|
+
if (this.__.eraser === 'path')
|
|
5034
|
+
return this.__renderEraser(canvas, options);
|
|
4969
5035
|
const tempCanvas = canvas.getSameCanvas(false, true);
|
|
4970
5036
|
this.__renderBranch(tempCanvas, options);
|
|
4971
5037
|
const nowWorld = this.__getNowWorld(options);
|
|
@@ -5031,7 +5097,7 @@ let Leaf = class Leaf {
|
|
|
5031
5097
|
get __worldFlipped() { return this.__world.scaleX < 0 || this.__world.scaleY < 0; }
|
|
5032
5098
|
get __onlyHitMask() { return this.__hasMask && !this.__.hitChildren; }
|
|
5033
5099
|
get __ignoreHitWorld() { return (this.__hasMask || this.__hasEraser) && this.__.hitChildren; }
|
|
5034
|
-
get pathInputed() { return
|
|
5100
|
+
get pathInputed() { return this.__.__pathInputed; }
|
|
5035
5101
|
constructor(data) {
|
|
5036
5102
|
this.innerId = create(LEAF);
|
|
5037
5103
|
this.reset(data);
|
|
@@ -5105,7 +5171,9 @@ let Leaf = class Leaf {
|
|
|
5105
5171
|
setProxyAttr(_attrName, _newValue) { }
|
|
5106
5172
|
getProxyAttr(_attrName) { return undefined; }
|
|
5107
5173
|
find(_condition, _options) { return undefined; }
|
|
5174
|
+
findTag(_tag) { return undefined; }
|
|
5108
5175
|
findOne(_condition, _options) { return undefined; }
|
|
5176
|
+
findId(_id) { return undefined; }
|
|
5109
5177
|
focus(_value) { }
|
|
5110
5178
|
forceUpdate(attrName) {
|
|
5111
5179
|
if (attrName === undefined)
|
|
@@ -5127,9 +5195,11 @@ let Leaf = class Leaf {
|
|
|
5127
5195
|
__updateLocalStrokeBounds() { }
|
|
5128
5196
|
__updateLocalRenderBounds() { }
|
|
5129
5197
|
__updateBoxBounds() { }
|
|
5198
|
+
__updateContentBounds() { }
|
|
5130
5199
|
__updateStrokeBounds() { }
|
|
5131
5200
|
__updateRenderBounds() { }
|
|
5132
5201
|
__updateAutoLayout() { }
|
|
5202
|
+
__updateFlowLayout() { }
|
|
5133
5203
|
__updateNaturalSize() { }
|
|
5134
5204
|
__updateStrokeSpread() { return 0; }
|
|
5135
5205
|
__updateRenderSpread() { return 0; }
|
|
@@ -5137,6 +5207,13 @@ let Leaf = class Leaf {
|
|
|
5137
5207
|
__updateEraser(value) {
|
|
5138
5208
|
this.__hasEraser = value ? true : this.children.some(item => item.__.eraser);
|
|
5139
5209
|
}
|
|
5210
|
+
__renderEraser(canvas, options) {
|
|
5211
|
+
canvas.save();
|
|
5212
|
+
this.__clip(canvas, options);
|
|
5213
|
+
const { renderBounds: r } = this.__layout;
|
|
5214
|
+
canvas.clearRect(r.x, r.y, r.width, r.height);
|
|
5215
|
+
canvas.restore();
|
|
5216
|
+
}
|
|
5140
5217
|
__updateMask(value) {
|
|
5141
5218
|
this.__hasMask = value ? true : this.children.some(item => item.__.mask);
|
|
5142
5219
|
}
|
|
@@ -5317,8 +5394,8 @@ let Leaf = class Leaf {
|
|
|
5317
5394
|
emit(_type, _event, _capture) { }
|
|
5318
5395
|
emitEvent(_event, _capture) { }
|
|
5319
5396
|
hasEvent(_type, _capture) { return false; }
|
|
5320
|
-
static changeAttr(attrName, defaultValue) {
|
|
5321
|
-
defineDataProcessor(this.prototype, attrName, defaultValue);
|
|
5397
|
+
static changeAttr(attrName, defaultValue, fn) {
|
|
5398
|
+
fn ? this.addAttr(attrName, defaultValue, fn) : defineDataProcessor(this.prototype, attrName, defaultValue);
|
|
5322
5399
|
}
|
|
5323
5400
|
static addAttr(attrName, defaultValue, fn) {
|
|
5324
5401
|
if (!fn)
|
|
@@ -5632,6 +5709,9 @@ class LeafLevelList {
|
|
|
5632
5709
|
}
|
|
5633
5710
|
}
|
|
5634
5711
|
|
|
5712
|
+
const version = "1.0.0-rc.24";
|
|
5713
|
+
const inviteCode = {};
|
|
5714
|
+
|
|
5635
5715
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
5636
5716
|
get allowBackgroundColor() { return false; }
|
|
5637
5717
|
init() {
|
|
@@ -6292,7 +6372,7 @@ class Renderer {
|
|
|
6292
6372
|
canvas.clear();
|
|
6293
6373
|
}
|
|
6294
6374
|
else {
|
|
6295
|
-
bounds.spread(
|
|
6375
|
+
bounds.spread(10 + 1 / this.canvas.pixelRatio).ceil();
|
|
6296
6376
|
canvas.clearWorld(bounds, true);
|
|
6297
6377
|
canvas.clipWorld(bounds, true);
|
|
6298
6378
|
}
|
|
@@ -6364,8 +6444,11 @@ class Renderer {
|
|
|
6364
6444
|
if (!bounds.includes(this.target.__world) || this.needFill || !e.samePixelRatio) {
|
|
6365
6445
|
this.addBlock(this.canvas.bounds);
|
|
6366
6446
|
this.target.forceUpdate('surface');
|
|
6447
|
+
return;
|
|
6367
6448
|
}
|
|
6368
6449
|
}
|
|
6450
|
+
this.addBlock(new Bounds(0, 0, 1, 1));
|
|
6451
|
+
this.changed = true;
|
|
6369
6452
|
}
|
|
6370
6453
|
__onLayoutEnd(event) {
|
|
6371
6454
|
if (event.data)
|
|
@@ -6538,6 +6621,7 @@ class Picker {
|
|
|
6538
6621
|
}
|
|
6539
6622
|
|
|
6540
6623
|
const { Yes, NoAndSkip, YesAndSkip } = Answer;
|
|
6624
|
+
const idCondition = {}, classNameCondition = {}, tagCondition = {};
|
|
6541
6625
|
class Selector {
|
|
6542
6626
|
constructor(target, userConfig) {
|
|
6543
6627
|
this.config = {};
|
|
@@ -6547,7 +6631,8 @@ class Selector {
|
|
|
6547
6631
|
id: (leaf, name) => leaf.id === name ? (this.idMap[name] = leaf, 1) : 0,
|
|
6548
6632
|
innerId: (leaf, innerId) => leaf.innerId === innerId ? (this.innerIdMap[innerId] = leaf, 1) : 0,
|
|
6549
6633
|
className: (leaf, name) => leaf.className === name ? 1 : 0,
|
|
6550
|
-
tag: (leaf, name) => leaf.__tag === name ? 1 : 0
|
|
6634
|
+
tag: (leaf, name) => leaf.__tag === name ? 1 : 0,
|
|
6635
|
+
tags: (leaf, nameMap) => nameMap[leaf.__tag] ? 1 : 0
|
|
6551
6636
|
};
|
|
6552
6637
|
this.target = target;
|
|
6553
6638
|
if (userConfig)
|
|
@@ -6563,12 +6648,25 @@ class Selector {
|
|
|
6563
6648
|
case 'string':
|
|
6564
6649
|
switch (condition[0]) {
|
|
6565
6650
|
case '#':
|
|
6566
|
-
|
|
6567
|
-
|
|
6651
|
+
idCondition.id = condition.substring(1), condition = idCondition;
|
|
6652
|
+
break;
|
|
6568
6653
|
case '.':
|
|
6569
|
-
|
|
6654
|
+
classNameCondition.className = condition.substring(1), condition = classNameCondition;
|
|
6655
|
+
break;
|
|
6570
6656
|
default:
|
|
6571
|
-
|
|
6657
|
+
tagCondition.tag = condition, condition = tagCondition;
|
|
6658
|
+
}
|
|
6659
|
+
case 'object':
|
|
6660
|
+
if (condition.id !== undefined) {
|
|
6661
|
+
const leaf = this.getById(condition.id, branch);
|
|
6662
|
+
return one ? leaf : (leaf ? [leaf] : []);
|
|
6663
|
+
}
|
|
6664
|
+
else if (condition.tag) {
|
|
6665
|
+
const { tag } = condition, isArray = tag instanceof Array;
|
|
6666
|
+
return this.getByMethod(isArray ? this.methods.tags : this.methods.tag, branch, one, isArray ? DataHelper.toMap(tag) : tag);
|
|
6667
|
+
}
|
|
6668
|
+
else {
|
|
6669
|
+
return this.getByMethod(this.methods.className, branch, one, condition.className);
|
|
6572
6670
|
}
|
|
6573
6671
|
case 'function':
|
|
6574
6672
|
return this.getByMethod(condition, branch, one, options);
|
|
@@ -6691,10 +6789,11 @@ function stateType(defaultValue) {
|
|
|
6691
6789
|
function arrowType(defaultValue) {
|
|
6692
6790
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
6693
6791
|
set(value) {
|
|
6694
|
-
this.__setAttr(key, value)
|
|
6695
|
-
|
|
6696
|
-
|
|
6697
|
-
|
|
6792
|
+
if (this.__setAttr(key, value)) {
|
|
6793
|
+
const data = this.__;
|
|
6794
|
+
data.__useArrow = data.startArrow !== 'none' || data.endArrow !== 'none';
|
|
6795
|
+
doStrokeType(this);
|
|
6796
|
+
}
|
|
6698
6797
|
}
|
|
6699
6798
|
}));
|
|
6700
6799
|
}
|
|
@@ -6867,7 +6966,7 @@ class UIData extends LeafData {
|
|
|
6867
6966
|
const UnitConvert = {
|
|
6868
6967
|
number(value, percentRefer) {
|
|
6869
6968
|
if (typeof value === 'object')
|
|
6870
|
-
return value.type === 'percent' ? value.value
|
|
6969
|
+
return value.type === 'percent' ? value.value * percentRefer : value.value;
|
|
6871
6970
|
return value;
|
|
6872
6971
|
}
|
|
6873
6972
|
};
|
|
@@ -6876,7 +6975,7 @@ class GroupData extends UIData {
|
|
|
6876
6975
|
}
|
|
6877
6976
|
|
|
6878
6977
|
class BoxData extends GroupData {
|
|
6879
|
-
get __boxStroke() { return
|
|
6978
|
+
get __boxStroke() { return !this.__pathInputed; }
|
|
6880
6979
|
}
|
|
6881
6980
|
|
|
6882
6981
|
class LeaferData extends GroupData {
|
|
@@ -6889,11 +6988,11 @@ class LineData extends UIData {
|
|
|
6889
6988
|
}
|
|
6890
6989
|
|
|
6891
6990
|
class RectData extends UIData {
|
|
6892
|
-
get __boxStroke() { return
|
|
6991
|
+
get __boxStroke() { return !this.__pathInputed; }
|
|
6893
6992
|
}
|
|
6894
6993
|
|
|
6895
6994
|
class EllipseData extends UIData {
|
|
6896
|
-
get __boxStroke() { return
|
|
6995
|
+
get __boxStroke() { return !this.__pathInputed; }
|
|
6897
6996
|
}
|
|
6898
6997
|
|
|
6899
6998
|
class PolygonData extends UIData {
|
|
@@ -6920,6 +7019,7 @@ const fontWeightMap = {
|
|
|
6920
7019
|
'black': 900
|
|
6921
7020
|
};
|
|
6922
7021
|
class TextData extends UIData {
|
|
7022
|
+
get __useNaturalRatio() { return false; }
|
|
6923
7023
|
setFontWeight(value) {
|
|
6924
7024
|
if (typeof value === 'string') {
|
|
6925
7025
|
this.__setInput('fontWeight', value);
|
|
@@ -6961,19 +7061,18 @@ class CanvasData extends RectData {
|
|
|
6961
7061
|
const UIBounds = {
|
|
6962
7062
|
__updateStrokeSpread() {
|
|
6963
7063
|
let width = 0, boxWidth = 0;
|
|
6964
|
-
const
|
|
6965
|
-
if ((stroke || hitStroke === 'all') && strokeWidth && strokeAlign !== 'inside') {
|
|
7064
|
+
const data = this.__, { strokeAlign, strokeWidth } = data;
|
|
7065
|
+
if ((data.stroke || data.hitStroke === 'all') && strokeWidth && strokeAlign !== 'inside') {
|
|
6966
7066
|
boxWidth = width = strokeAlign === 'center' ? strokeWidth / 2 : strokeWidth;
|
|
6967
|
-
if (!
|
|
6968
|
-
const
|
|
6969
|
-
const
|
|
6970
|
-
const storkeCapAddWidth = strokeCap === 'none' ? 0 : strokeWidth;
|
|
7067
|
+
if (!data.__boxStroke) {
|
|
7068
|
+
const miterLimitAddWidth = data.__isLinePath ? 0 : 10 * width;
|
|
7069
|
+
const storkeCapAddWidth = data.strokeCap === 'none' ? 0 : strokeWidth;
|
|
6971
7070
|
width += Math.max(miterLimitAddWidth, storkeCapAddWidth);
|
|
6972
7071
|
}
|
|
6973
7072
|
}
|
|
6974
|
-
|
|
6975
|
-
if (this.__.__useArrow)
|
|
7073
|
+
if (data.__useArrow)
|
|
6976
7074
|
width += strokeWidth * 5;
|
|
7075
|
+
this.__layout.strokeBoxSpread = boxWidth;
|
|
6977
7076
|
return width;
|
|
6978
7077
|
},
|
|
6979
7078
|
__updateRenderSpread() {
|
|
@@ -6993,7 +7092,7 @@ const UIBounds = {
|
|
|
6993
7092
|
if (backgroundBlur)
|
|
6994
7093
|
shapeWidth = Math.max(shapeWidth, backgroundBlur);
|
|
6995
7094
|
this.__layout.renderShapeSpread = shapeWidth;
|
|
6996
|
-
return width;
|
|
7095
|
+
return width + (this.__layout.strokeSpread || 0);
|
|
6997
7096
|
}
|
|
6998
7097
|
};
|
|
6999
7098
|
|
|
@@ -7084,7 +7183,7 @@ function drawFast(ui, canvas, options) {
|
|
|
7084
7183
|
|
|
7085
7184
|
const RectRender = {
|
|
7086
7185
|
__drawFast(canvas, options) {
|
|
7087
|
-
|
|
7186
|
+
let { width, height, fill, stroke, __drawAfterFill } = this.__;
|
|
7088
7187
|
if (fill) {
|
|
7089
7188
|
canvas.fillStyle = fill;
|
|
7090
7189
|
canvas.fillRect(0, 0, width, height);
|
|
@@ -7102,7 +7201,16 @@ const RectRender = {
|
|
|
7102
7201
|
canvas.strokeRect(0, 0, width, height);
|
|
7103
7202
|
break;
|
|
7104
7203
|
case 'inside':
|
|
7105
|
-
|
|
7204
|
+
width -= __strokeWidth, height -= __strokeWidth;
|
|
7205
|
+
if (width < 0 || height < 0) {
|
|
7206
|
+
canvas.save();
|
|
7207
|
+
this.__clip(canvas, options);
|
|
7208
|
+
canvas.strokeRect(half, half, width, height);
|
|
7209
|
+
canvas.restore();
|
|
7210
|
+
}
|
|
7211
|
+
else {
|
|
7212
|
+
canvas.strokeRect(half, half, width, height);
|
|
7213
|
+
}
|
|
7106
7214
|
break;
|
|
7107
7215
|
case 'outside':
|
|
7108
7216
|
canvas.strokeRect(-half, -half, width + __strokeWidth, height + __strokeWidth);
|
|
@@ -7130,11 +7238,14 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
7130
7238
|
return scaleX !== scaleY ? { x: scaleX, y: scaleY } : scaleX;
|
|
7131
7239
|
}
|
|
7132
7240
|
get pen() {
|
|
7133
|
-
|
|
7241
|
+
const { path } = this.__;
|
|
7242
|
+
pen.set(this.path = path || []);
|
|
7243
|
+
if (!path)
|
|
7244
|
+
this.__drawPathByBox(pen);
|
|
7134
7245
|
return pen;
|
|
7135
7246
|
}
|
|
7136
7247
|
get editConfig() { return undefined; }
|
|
7137
|
-
get editOuter() { return 'EditTool'; }
|
|
7248
|
+
get editOuter() { return this.__.__isLinePath ? 'LineEditTool' : 'EditTool'; }
|
|
7138
7249
|
get editInner() { return 'PathEditor'; }
|
|
7139
7250
|
constructor(data) {
|
|
7140
7251
|
super(data);
|
|
@@ -7148,22 +7259,22 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
7148
7259
|
}
|
|
7149
7260
|
createProxyData() { return undefined; }
|
|
7150
7261
|
find(_condition, _options) { return undefined; }
|
|
7262
|
+
findTag(tag) { return this.find({ tag }); }
|
|
7151
7263
|
findOne(_condition, _options) { return undefined; }
|
|
7264
|
+
findId(id) { return this.findOne({ id }); }
|
|
7152
7265
|
getPath(curve, pathForRender) {
|
|
7153
7266
|
this.__layout.update();
|
|
7154
7267
|
let path = pathForRender ? this.__.__pathForRender : this.__.path;
|
|
7155
|
-
if (!path)
|
|
7156
|
-
|
|
7157
|
-
if (width || height) {
|
|
7158
|
-
pen.set(path = []);
|
|
7159
|
-
this.__drawPathByBox(pen);
|
|
7160
|
-
}
|
|
7161
|
-
}
|
|
7268
|
+
if (!path)
|
|
7269
|
+
pen.set(path = []), this.__drawPathByBox(pen);
|
|
7162
7270
|
return curve ? PathConvert.toCanvasData(path, true) : path;
|
|
7163
7271
|
}
|
|
7164
7272
|
getPathString(curve, pathForRender) {
|
|
7165
7273
|
return PathConvert.stringify(this.getPath(curve, pathForRender));
|
|
7166
7274
|
}
|
|
7275
|
+
load() {
|
|
7276
|
+
this.__.__computePaint();
|
|
7277
|
+
}
|
|
7167
7278
|
__onUpdateSize() {
|
|
7168
7279
|
if (this.__.__input) {
|
|
7169
7280
|
const data = this.__;
|
|
@@ -7249,7 +7360,7 @@ __decorate([
|
|
|
7249
7360
|
opacityType(1)
|
|
7250
7361
|
], UI.prototype, "opacity", void 0);
|
|
7251
7362
|
__decorate([
|
|
7252
|
-
|
|
7363
|
+
visibleType(true)
|
|
7253
7364
|
], UI.prototype, "visible", void 0);
|
|
7254
7365
|
__decorate([
|
|
7255
7366
|
stateType(false)
|
|
@@ -7266,9 +7377,6 @@ __decorate([
|
|
|
7266
7377
|
__decorate([
|
|
7267
7378
|
maskType(false)
|
|
7268
7379
|
], UI.prototype, "mask", void 0);
|
|
7269
|
-
__decorate([
|
|
7270
|
-
surfaceType('pixel')
|
|
7271
|
-
], UI.prototype, "maskType", void 0);
|
|
7272
7380
|
__decorate([
|
|
7273
7381
|
eraserType(false)
|
|
7274
7382
|
], UI.prototype, "eraser", void 0);
|
|
@@ -7299,9 +7407,75 @@ __decorate([
|
|
|
7299
7407
|
__decorate([
|
|
7300
7408
|
rotationType(0, true)
|
|
7301
7409
|
], UI.prototype, "skewY", void 0);
|
|
7410
|
+
__decorate([
|
|
7411
|
+
positionType(0, true)
|
|
7412
|
+
], UI.prototype, "offsetX", void 0);
|
|
7413
|
+
__decorate([
|
|
7414
|
+
positionType(0, true)
|
|
7415
|
+
], UI.prototype, "offsetY", void 0);
|
|
7416
|
+
__decorate([
|
|
7417
|
+
positionType(0, true)
|
|
7418
|
+
], UI.prototype, "scrollX", void 0);
|
|
7419
|
+
__decorate([
|
|
7420
|
+
positionType(0, true)
|
|
7421
|
+
], UI.prototype, "scrollY", void 0);
|
|
7422
|
+
__decorate([
|
|
7423
|
+
autoLayoutType()
|
|
7424
|
+
], UI.prototype, "origin", void 0);
|
|
7302
7425
|
__decorate([
|
|
7303
7426
|
autoLayoutType()
|
|
7304
7427
|
], UI.prototype, "around", void 0);
|
|
7428
|
+
__decorate([
|
|
7429
|
+
dataType(false)
|
|
7430
|
+
], UI.prototype, "lazy", void 0);
|
|
7431
|
+
__decorate([
|
|
7432
|
+
naturalBoundsType(1)
|
|
7433
|
+
], UI.prototype, "pixelRatio", void 0);
|
|
7434
|
+
__decorate([
|
|
7435
|
+
pathInputType()
|
|
7436
|
+
], UI.prototype, "path", void 0);
|
|
7437
|
+
__decorate([
|
|
7438
|
+
pathType()
|
|
7439
|
+
], UI.prototype, "windingRule", void 0);
|
|
7440
|
+
__decorate([
|
|
7441
|
+
pathType(true)
|
|
7442
|
+
], UI.prototype, "closed", void 0);
|
|
7443
|
+
__decorate([
|
|
7444
|
+
autoLayoutType(false)
|
|
7445
|
+
], UI.prototype, "flow", void 0);
|
|
7446
|
+
__decorate([
|
|
7447
|
+
boundsType(0)
|
|
7448
|
+
], UI.prototype, "padding", void 0);
|
|
7449
|
+
__decorate([
|
|
7450
|
+
boundsType(0)
|
|
7451
|
+
], UI.prototype, "gap", void 0);
|
|
7452
|
+
__decorate([
|
|
7453
|
+
boundsType('top-left')
|
|
7454
|
+
], UI.prototype, "align", void 0);
|
|
7455
|
+
__decorate([
|
|
7456
|
+
boundsType(false)
|
|
7457
|
+
], UI.prototype, "wrap", void 0);
|
|
7458
|
+
__decorate([
|
|
7459
|
+
boundsType('box')
|
|
7460
|
+
], UI.prototype, "itemBox", void 0);
|
|
7461
|
+
__decorate([
|
|
7462
|
+
boundsType(true)
|
|
7463
|
+
], UI.prototype, "inFlow", void 0);
|
|
7464
|
+
__decorate([
|
|
7465
|
+
boundsType()
|
|
7466
|
+
], UI.prototype, "autoWidth", void 0);
|
|
7467
|
+
__decorate([
|
|
7468
|
+
boundsType()
|
|
7469
|
+
], UI.prototype, "autoHeight", void 0);
|
|
7470
|
+
__decorate([
|
|
7471
|
+
boundsType()
|
|
7472
|
+
], UI.prototype, "autoBox", void 0);
|
|
7473
|
+
__decorate([
|
|
7474
|
+
boundsType()
|
|
7475
|
+
], UI.prototype, "widthRange", void 0);
|
|
7476
|
+
__decorate([
|
|
7477
|
+
boundsType()
|
|
7478
|
+
], UI.prototype, "heightRange", void 0);
|
|
7305
7479
|
__decorate([
|
|
7306
7480
|
dataType(false)
|
|
7307
7481
|
], UI.prototype, "draggable", void 0);
|
|
@@ -7311,9 +7485,6 @@ __decorate([
|
|
|
7311
7485
|
__decorate([
|
|
7312
7486
|
dataType(false)
|
|
7313
7487
|
], UI.prototype, "editable", void 0);
|
|
7314
|
-
__decorate([
|
|
7315
|
-
dataType('size')
|
|
7316
|
-
], UI.prototype, "editSize", void 0);
|
|
7317
7488
|
__decorate([
|
|
7318
7489
|
hitType(true)
|
|
7319
7490
|
], UI.prototype, "hittable", void 0);
|
|
@@ -7368,21 +7539,6 @@ __decorate([
|
|
|
7368
7539
|
__decorate([
|
|
7369
7540
|
strokeType(10)
|
|
7370
7541
|
], UI.prototype, "miterLimit", void 0);
|
|
7371
|
-
__decorate([
|
|
7372
|
-
dataType(false)
|
|
7373
|
-
], UI.prototype, "lazy", void 0);
|
|
7374
|
-
__decorate([
|
|
7375
|
-
naturalBoundsType(1)
|
|
7376
|
-
], UI.prototype, "pixelRatio", void 0);
|
|
7377
|
-
__decorate([
|
|
7378
|
-
pathInputType()
|
|
7379
|
-
], UI.prototype, "path", void 0);
|
|
7380
|
-
__decorate([
|
|
7381
|
-
pathType()
|
|
7382
|
-
], UI.prototype, "windingRule", void 0);
|
|
7383
|
-
__decorate([
|
|
7384
|
-
pathType(true)
|
|
7385
|
-
], UI.prototype, "closed", void 0);
|
|
7386
7542
|
__decorate([
|
|
7387
7543
|
arrowType('none')
|
|
7388
7544
|
], UI.prototype, "startArrow", void 0);
|
|
@@ -7513,6 +7669,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
7513
7669
|
get layoutLocked() { return !this.layouter.running; }
|
|
7514
7670
|
get FPS() { return this.renderer ? this.renderer.FPS : 60; }
|
|
7515
7671
|
get cursorPoint() { return (this.interaction && this.interaction.hoverData) || { x: this.width / 2, y: this.height / 2 }; }
|
|
7672
|
+
get clientBounds() { return this.canvas && this.canvas.getClientBounds(); }
|
|
7516
7673
|
constructor(userConfig, data) {
|
|
7517
7674
|
super(data);
|
|
7518
7675
|
this.config = {
|
|
@@ -7616,9 +7773,6 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
7616
7773
|
const data = DataHelper.copyAttrs({}, size, canvasSizeAttrs);
|
|
7617
7774
|
Object.keys(data).forEach(key => this[key] = data[key]);
|
|
7618
7775
|
}
|
|
7619
|
-
forceFullRender() {
|
|
7620
|
-
this.forceRender();
|
|
7621
|
-
}
|
|
7622
7776
|
forceRender(bounds) {
|
|
7623
7777
|
this.renderer.addBlock(bounds ? new Bounds(bounds) : this.canvas.bounds);
|
|
7624
7778
|
if (this.viewReady)
|
|
@@ -7673,7 +7827,8 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
7673
7827
|
this.__changeFill(newValue);
|
|
7674
7828
|
}
|
|
7675
7829
|
else if (attrName === 'hittable') {
|
|
7676
|
-
this.
|
|
7830
|
+
if (!this.parent)
|
|
7831
|
+
this.canvas.hittable = newValue;
|
|
7677
7832
|
}
|
|
7678
7833
|
}
|
|
7679
7834
|
return super.__setAttr(attrName, newValue);
|
|
@@ -7696,7 +7851,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
7696
7851
|
this.canvas.backgroundColor = newValue;
|
|
7697
7852
|
}
|
|
7698
7853
|
else {
|
|
7699
|
-
this.
|
|
7854
|
+
this.forceRender();
|
|
7700
7855
|
}
|
|
7701
7856
|
}
|
|
7702
7857
|
__onCreated() {
|
|
@@ -7791,6 +7946,9 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
7791
7946
|
zoom(_zoomType, _padding, _fixedScale) { return undefined; }
|
|
7792
7947
|
getValidMove(moveX, moveY) { return { x: moveX, y: moveY }; }
|
|
7793
7948
|
getValidScale(changeScale) { return changeScale; }
|
|
7949
|
+
getWorldPointByClient(clientPoint, updateClient) {
|
|
7950
|
+
return this.interaction && this.interaction.getLocal(clientPoint, updateClient);
|
|
7951
|
+
}
|
|
7794
7952
|
__checkUpdateLayout() {
|
|
7795
7953
|
this.__layout.update();
|
|
7796
7954
|
}
|
|
@@ -7873,8 +8031,8 @@ Rect = __decorate([
|
|
|
7873
8031
|
|
|
7874
8032
|
const rect$1 = Rect.prototype;
|
|
7875
8033
|
const group$1 = Group.prototype;
|
|
7876
|
-
const
|
|
7877
|
-
const { copy: copy$3, add } = BoundsHelper;
|
|
8034
|
+
const childrenRenderBounds = {};
|
|
8035
|
+
const { copy: copy$3, add, includes: includes$1 } = BoundsHelper;
|
|
7878
8036
|
let Box = class Box extends Group {
|
|
7879
8037
|
get __tag() { return 'Box'; }
|
|
7880
8038
|
get isBranchLeaf() { return true; }
|
|
@@ -7885,24 +8043,29 @@ let Box = class Box extends Group {
|
|
|
7885
8043
|
__updateStrokeSpread() { return 0; }
|
|
7886
8044
|
__updateRectRenderSpread() { return 0; }
|
|
7887
8045
|
__updateRenderSpread() {
|
|
7888
|
-
|
|
7889
|
-
const hide = this.__.__drawAfterFill = this.__.overflow === 'hide';
|
|
7890
|
-
return (width || hide) ? width : -1;
|
|
8046
|
+
return this.__updateRectRenderSpread() || -1;
|
|
7891
8047
|
}
|
|
7892
8048
|
__updateRectBoxBounds() { }
|
|
7893
8049
|
__updateBoxBounds() {
|
|
7894
8050
|
const data = this.__;
|
|
7895
|
-
if (
|
|
7896
|
-
if (
|
|
7897
|
-
this.leafer.
|
|
7898
|
-
|
|
7899
|
-
|
|
7900
|
-
|
|
7901
|
-
|
|
7902
|
-
|
|
7903
|
-
|
|
7904
|
-
|
|
8051
|
+
if (this.children.length) {
|
|
8052
|
+
if (data.__autoSide) {
|
|
8053
|
+
if (this.leafer && this.leafer.ready)
|
|
8054
|
+
this.leafer.layouter.addExtra(this);
|
|
8055
|
+
super.__updateBoxBounds();
|
|
8056
|
+
if (!data.__autoSize) {
|
|
8057
|
+
const b = this.__layout.boxBounds;
|
|
8058
|
+
if (!data.__autoWidth)
|
|
8059
|
+
b.x = 0, b.width = data.width;
|
|
8060
|
+
if (!data.__autoHeight)
|
|
8061
|
+
b.y = 0, b.height = data.height;
|
|
8062
|
+
}
|
|
7905
8063
|
}
|
|
8064
|
+
else {
|
|
8065
|
+
this.__updateRectBoxBounds();
|
|
8066
|
+
}
|
|
8067
|
+
if (data.flow)
|
|
8068
|
+
this.__updateContentBounds();
|
|
7906
8069
|
}
|
|
7907
8070
|
else {
|
|
7908
8071
|
this.__updateRectBoxBounds();
|
|
@@ -7910,13 +8073,20 @@ let Box = class Box extends Group {
|
|
|
7910
8073
|
}
|
|
7911
8074
|
__updateStrokeBounds() { }
|
|
7912
8075
|
__updateRenderBounds() {
|
|
7913
|
-
|
|
7914
|
-
|
|
7915
|
-
|
|
7916
|
-
copy$3(bounds$1, renderBounds);
|
|
8076
|
+
let isOverflow;
|
|
8077
|
+
const { renderBounds } = this.__layout;
|
|
8078
|
+
if (this.children.length) {
|
|
7917
8079
|
super.__updateRenderBounds();
|
|
7918
|
-
|
|
8080
|
+
copy$3(childrenRenderBounds, renderBounds);
|
|
8081
|
+
this.__updateRectRenderBounds();
|
|
8082
|
+
isOverflow = !includes$1(renderBounds, childrenRenderBounds) || undefined;
|
|
8083
|
+
}
|
|
8084
|
+
else {
|
|
8085
|
+
this.__updateRectRenderBounds();
|
|
7919
8086
|
}
|
|
8087
|
+
this.isOverflow !== isOverflow && (this.isOverflow = isOverflow);
|
|
8088
|
+
if (isOverflow && !(this.__.__drawAfterFill = this.__.overflow === 'hide'))
|
|
8089
|
+
add(renderBounds, childrenRenderBounds);
|
|
7920
8090
|
}
|
|
7921
8091
|
__updateRectRenderBounds() { }
|
|
7922
8092
|
__updateRectChange() { }
|
|
@@ -7932,16 +8102,27 @@ let Box = class Box extends Group {
|
|
|
7932
8102
|
}
|
|
7933
8103
|
else {
|
|
7934
8104
|
this.__renderRect(canvas, options);
|
|
7935
|
-
this.
|
|
8105
|
+
if (this.children.length)
|
|
8106
|
+
this.__renderGroup(canvas, options);
|
|
7936
8107
|
}
|
|
7937
8108
|
}
|
|
7938
8109
|
__drawAfterFill(canvas, options) {
|
|
7939
|
-
|
|
7940
|
-
|
|
7941
|
-
|
|
7942
|
-
|
|
7943
|
-
|
|
8110
|
+
const { length } = this.children;
|
|
8111
|
+
if (this.isOverflow) {
|
|
8112
|
+
canvas.save();
|
|
8113
|
+
canvas.clip();
|
|
8114
|
+
if (length)
|
|
8115
|
+
this.__renderGroup(canvas, options);
|
|
8116
|
+
canvas.restore();
|
|
8117
|
+
}
|
|
8118
|
+
else {
|
|
8119
|
+
if (length)
|
|
8120
|
+
this.__renderGroup(canvas, options);
|
|
8121
|
+
}
|
|
8122
|
+
if (this.__.stroke && length) {
|
|
8123
|
+
canvas.setWorld(this.__nowWorld);
|
|
7944
8124
|
this.__drawRenderPath(canvas);
|
|
8125
|
+
}
|
|
7945
8126
|
}
|
|
7946
8127
|
};
|
|
7947
8128
|
__decorate([
|
|
@@ -8079,9 +8260,10 @@ let Line = class Line extends UI {
|
|
|
8079
8260
|
super(data);
|
|
8080
8261
|
}
|
|
8081
8262
|
__updatePath() {
|
|
8082
|
-
const
|
|
8083
|
-
|
|
8084
|
-
|
|
8263
|
+
const data = this.__;
|
|
8264
|
+
const path = data.path = [];
|
|
8265
|
+
if (data.points) {
|
|
8266
|
+
drawPoints$1(path, data.points, false, data.closed);
|
|
8085
8267
|
}
|
|
8086
8268
|
else {
|
|
8087
8269
|
moveTo$2(path, 0, 0);
|
|
@@ -8316,7 +8498,7 @@ Canvas = __decorate([
|
|
|
8316
8498
|
registerUI()
|
|
8317
8499
|
], Canvas);
|
|
8318
8500
|
|
|
8319
|
-
const { copyAndSpread, includes, spread, setList } = BoundsHelper;
|
|
8501
|
+
const { copyAndSpread, includes, isSame: isSame$1, spread, setList } = BoundsHelper;
|
|
8320
8502
|
let Text = class Text extends UI {
|
|
8321
8503
|
get __tag() { return 'Text'; }
|
|
8322
8504
|
get editInner() { return 'TextEditor'; }
|
|
@@ -8389,7 +8571,7 @@ let Text = class Text extends UI {
|
|
|
8389
8571
|
if (italic)
|
|
8390
8572
|
b.width += fontSize * 0.16;
|
|
8391
8573
|
const contentBounds = includes(b, bounds) ? b : bounds;
|
|
8392
|
-
if (contentBounds
|
|
8574
|
+
if (!isSame$1(contentBounds, layout.contentBounds)) {
|
|
8393
8575
|
layout.contentBounds = contentBounds;
|
|
8394
8576
|
layout.renderChanged = true;
|
|
8395
8577
|
setList(data.__textBoxBounds = {}, [b, bounds]);
|
|
@@ -8417,9 +8599,6 @@ __decorate([
|
|
|
8417
8599
|
__decorate([
|
|
8418
8600
|
boundsType(0)
|
|
8419
8601
|
], Text.prototype, "height", void 0);
|
|
8420
|
-
__decorate([
|
|
8421
|
-
boundsType(0)
|
|
8422
|
-
], Text.prototype, "padding", void 0);
|
|
8423
8602
|
__decorate([
|
|
8424
8603
|
surfaceType('#000000')
|
|
8425
8604
|
], Text.prototype, "fill", void 0);
|
|
@@ -8454,7 +8633,7 @@ __decorate([
|
|
|
8454
8633
|
boundsType(0)
|
|
8455
8634
|
], Text.prototype, "letterSpacing", void 0);
|
|
8456
8635
|
__decorate([
|
|
8457
|
-
boundsType({ type: 'percent', value:
|
|
8636
|
+
boundsType({ type: 'percent', value: 1.5 })
|
|
8458
8637
|
], Text.prototype, "lineHeight", void 0);
|
|
8459
8638
|
__decorate([
|
|
8460
8639
|
boundsType(0)
|
|
@@ -8548,8 +8727,6 @@ function penPathType() {
|
|
|
8548
8727
|
};
|
|
8549
8728
|
}
|
|
8550
8729
|
|
|
8551
|
-
const version = "1.0.0-rc.21";
|
|
8552
|
-
|
|
8553
8730
|
let App = class App extends Leafer {
|
|
8554
8731
|
get __tag() { return 'App'; }
|
|
8555
8732
|
get isApp() { return true; }
|
|
@@ -8642,8 +8819,10 @@ let App = class App extends Leafer {
|
|
|
8642
8819
|
this.renderer.update();
|
|
8643
8820
|
}
|
|
8644
8821
|
__render(canvas, options) {
|
|
8645
|
-
if (options.matrix)
|
|
8646
|
-
|
|
8822
|
+
if (options.matrix) {
|
|
8823
|
+
const { a, b, c, d, e, f } = options.matrix;
|
|
8824
|
+
canvas.setTransform(a, b, c, d, e, f);
|
|
8825
|
+
}
|
|
8647
8826
|
this.children.forEach(leafer => canvas.copyWorld(leafer.canvas));
|
|
8648
8827
|
}
|
|
8649
8828
|
__onResize(event) {
|
|
@@ -9647,8 +9826,8 @@ class InteractionBase {
|
|
|
9647
9826
|
}
|
|
9648
9827
|
tap(data) {
|
|
9649
9828
|
const { pointer } = this.config;
|
|
9650
|
-
const
|
|
9651
|
-
if (!pointer.tapMore &&
|
|
9829
|
+
const hasLong = this.longTap(data);
|
|
9830
|
+
if (!pointer.tapMore && hasLong)
|
|
9652
9831
|
return;
|
|
9653
9832
|
if (!this.waitTap)
|
|
9654
9833
|
return;
|
|
@@ -9770,6 +9949,10 @@ class InteractionBase {
|
|
|
9770
9949
|
setCursor(cursor) {
|
|
9771
9950
|
this.cursor = cursor;
|
|
9772
9951
|
}
|
|
9952
|
+
getLocal(clientPoint, updateClient) {
|
|
9953
|
+
const clientBounds = this.canvas.getClientBounds(updateClient);
|
|
9954
|
+
return { x: clientPoint.clientX - clientBounds.x, y: clientPoint.clientY - clientBounds.y };
|
|
9955
|
+
}
|
|
9773
9956
|
emitTap(data) {
|
|
9774
9957
|
this.emit(PointerEvent.TAP, data);
|
|
9775
9958
|
this.emit(PointerEvent.CLICK, data);
|
|
@@ -9799,14 +9982,14 @@ class InteractionBase {
|
|
|
9799
9982
|
}, this.config.pointer.longPressTime);
|
|
9800
9983
|
}
|
|
9801
9984
|
longTap(data) {
|
|
9802
|
-
let
|
|
9985
|
+
let hasLong;
|
|
9803
9986
|
if (this.longPressed) {
|
|
9804
9987
|
this.emit(PointerEvent.LONG_TAP, data);
|
|
9805
|
-
if (pathHasEventType(data.path, PointerEvent.LONG_TAP))
|
|
9806
|
-
|
|
9988
|
+
if (pathHasEventType(data.path, PointerEvent.LONG_TAP) || pathHasEventType(data.path, PointerEvent.LONG_PRESS))
|
|
9989
|
+
hasLong = true;
|
|
9807
9990
|
}
|
|
9808
9991
|
this.longPressWaitCancel();
|
|
9809
|
-
return
|
|
9992
|
+
return hasLong;
|
|
9810
9993
|
}
|
|
9811
9994
|
longPressWaitCancel() {
|
|
9812
9995
|
clearTimeout(this.longPressTimer);
|
|
@@ -10072,15 +10255,12 @@ class Interaction extends InteractionBase {
|
|
|
10072
10255
|
this.onTouchCancel();
|
|
10073
10256
|
}
|
|
10074
10257
|
}
|
|
10075
|
-
getLocal(
|
|
10076
|
-
if (
|
|
10077
|
-
|
|
10078
|
-
if (p.x !== undefined) {
|
|
10079
|
-
return { x: p.x, y: p.y };
|
|
10258
|
+
getLocal(clientPoint, updateClient) {
|
|
10259
|
+
if (clientPoint.x !== undefined) {
|
|
10260
|
+
return { x: clientPoint.x, y: clientPoint.y };
|
|
10080
10261
|
}
|
|
10081
10262
|
else {
|
|
10082
|
-
|
|
10083
|
-
return { x: p.clientX - clientBounds.x, y: p.clientY - clientBounds.y };
|
|
10263
|
+
return super.getLocal(clientPoint, updateClient);
|
|
10084
10264
|
}
|
|
10085
10265
|
}
|
|
10086
10266
|
getTouches(touches) {
|
|
@@ -10367,7 +10547,7 @@ function shape(ui, current, options) {
|
|
|
10367
10547
|
}
|
|
10368
10548
|
else {
|
|
10369
10549
|
const { renderShapeSpread: spread } = ui.__layout;
|
|
10370
|
-
const worldClipBounds = getIntersectData(spread ? getSpread(current.bounds, spread * scaleX, spread *
|
|
10550
|
+
const worldClipBounds = getIntersectData(spread ? getSpread(current.bounds, scaleX === scaleY ? spread * scaleX : [spread * scaleY, spread * scaleX]) : current.bounds, nowWorld);
|
|
10371
10551
|
fitMatrix = current.bounds.getFitMatrix(worldClipBounds);
|
|
10372
10552
|
let { a: fitScaleX, d: fitScaleY } = fitMatrix;
|
|
10373
10553
|
if (fitMatrix.a < 1) {
|
|
@@ -10467,10 +10647,10 @@ function clipMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
|
10467
10647
|
rotate(transform, rotation);
|
|
10468
10648
|
data.transform = transform;
|
|
10469
10649
|
}
|
|
10470
|
-
function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation,
|
|
10650
|
+
function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align) {
|
|
10471
10651
|
const transform = get$4();
|
|
10472
10652
|
if (rotation) {
|
|
10473
|
-
if (
|
|
10653
|
+
if (align === 'center') {
|
|
10474
10654
|
rotateOfOuter$2(transform, { x: width / 2, y: height / 2 }, rotation);
|
|
10475
10655
|
}
|
|
10476
10656
|
else {
|
|
@@ -10503,12 +10683,12 @@ function createData(leafPaint, image, paint, box) {
|
|
|
10503
10683
|
let { width, height } = image;
|
|
10504
10684
|
if (paint.padding)
|
|
10505
10685
|
box = tempBox.set(box).shrink(paint.padding);
|
|
10506
|
-
const { opacity, mode,
|
|
10686
|
+
const { opacity, mode, align, offset, scale, size, rotation, blendMode, repeat } = paint;
|
|
10507
10687
|
const sameBox = box.width === width && box.height === height;
|
|
10508
10688
|
if (blendMode)
|
|
10509
10689
|
leafPaint.blendMode = blendMode;
|
|
10510
10690
|
const data = leafPaint.data = { mode };
|
|
10511
|
-
const swapSize =
|
|
10691
|
+
const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
|
|
10512
10692
|
const swapWidth = swapSize ? height : width, swapHeight = swapSize ? width : height;
|
|
10513
10693
|
let x = 0, y = 0, scaleX, scaleY;
|
|
10514
10694
|
if (!mode || mode === 'cover' || mode === 'fit') {
|
|
@@ -10526,11 +10706,11 @@ function createData(leafPaint, image, paint, box) {
|
|
|
10526
10706
|
scaleX = typeof scale === 'number' ? scale : scale.x;
|
|
10527
10707
|
scaleY = typeof scale === 'number' ? scale : scale.y;
|
|
10528
10708
|
}
|
|
10529
|
-
if (
|
|
10709
|
+
if (align) {
|
|
10530
10710
|
const imageBounds = { x, y, width: swapWidth, height: swapHeight };
|
|
10531
10711
|
if (scaleX)
|
|
10532
10712
|
imageBounds.width *= scaleX, imageBounds.height *= scaleY;
|
|
10533
|
-
|
|
10713
|
+
AlignHelper.toPoint(align, imageBounds, box, tempPoint, true);
|
|
10534
10714
|
x += tempPoint.x, y += tempPoint.y;
|
|
10535
10715
|
}
|
|
10536
10716
|
if (offset)
|
|
@@ -10547,7 +10727,7 @@ function createData(leafPaint, image, paint, box) {
|
|
|
10547
10727
|
break;
|
|
10548
10728
|
case 'repeat':
|
|
10549
10729
|
if (!sameBox || scaleX || rotation)
|
|
10550
|
-
repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation,
|
|
10730
|
+
repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align);
|
|
10551
10731
|
if (!repeat)
|
|
10552
10732
|
data.repeat = 'repeat';
|
|
10553
10733
|
break;
|
|
@@ -10818,13 +10998,14 @@ const PaintImageModule = {
|
|
|
10818
10998
|
recycleImage
|
|
10819
10999
|
};
|
|
10820
11000
|
|
|
10821
|
-
const
|
|
10822
|
-
const
|
|
11001
|
+
const { toPoint: toPoint$2 } = AroundHelper;
|
|
11002
|
+
const realFrom$2 = {};
|
|
11003
|
+
const realTo$2 = {};
|
|
10823
11004
|
function linearGradient(paint, box) {
|
|
10824
11005
|
let { from, to, type, blendMode, opacity } = paint;
|
|
10825
|
-
from ||
|
|
10826
|
-
to ||
|
|
10827
|
-
const style = Platform.canvas.createLinearGradient(
|
|
11006
|
+
toPoint$2(from || 'top', box, realFrom$2);
|
|
11007
|
+
toPoint$2(to || 'bottom', box, realTo$2);
|
|
11008
|
+
const style = Platform.canvas.createLinearGradient(realFrom$2.x, realFrom$2.y, realTo$2.x, realTo$2.y);
|
|
10828
11009
|
applyStops(style, paint.stops, opacity);
|
|
10829
11010
|
const data = { type, style };
|
|
10830
11011
|
if (blendMode)
|
|
@@ -10835,23 +11016,25 @@ function applyStops(gradient, stops, opacity) {
|
|
|
10835
11016
|
let stop;
|
|
10836
11017
|
for (let i = 0, len = stops.length; i < len; i++) {
|
|
10837
11018
|
stop = stops[i];
|
|
10838
|
-
|
|
11019
|
+
if (typeof stop === 'string') {
|
|
11020
|
+
gradient.addColorStop(i / (len - 1), ColorConvert.string(stop, opacity));
|
|
11021
|
+
}
|
|
11022
|
+
else {
|
|
11023
|
+
gradient.addColorStop(stop.offset, ColorConvert.string(stop.color, opacity));
|
|
11024
|
+
}
|
|
10839
11025
|
}
|
|
10840
11026
|
}
|
|
10841
11027
|
|
|
10842
|
-
const {
|
|
11028
|
+
const { getAngle: getAngle$1, getDistance: getDistance$1 } = PointHelper;
|
|
10843
11029
|
const { get: get$1, rotateOfOuter: rotateOfOuter$1, scaleOfOuter: scaleOfOuter$1 } = MatrixHelper;
|
|
10844
|
-
const
|
|
10845
|
-
const defaultTo$1 = { x: 0.5, y: 1 };
|
|
11030
|
+
const { toPoint: toPoint$1 } = AroundHelper;
|
|
10846
11031
|
const realFrom$1 = {};
|
|
10847
11032
|
const realTo$1 = {};
|
|
10848
11033
|
function radialGradient(paint, box) {
|
|
10849
11034
|
let { from, to, type, opacity, blendMode, stretch } = paint;
|
|
10850
|
-
from ||
|
|
10851
|
-
to ||
|
|
10852
|
-
const {
|
|
10853
|
-
set$1(realFrom$1, x + from.x * width, y + from.y * height);
|
|
10854
|
-
set$1(realTo$1, x + to.x * width, y + to.y * height);
|
|
11035
|
+
toPoint$1(from || 'center', box, realFrom$1);
|
|
11036
|
+
toPoint$1(to || 'bottom', box, realTo$1);
|
|
11037
|
+
const { width, height } = box;
|
|
10855
11038
|
let transform;
|
|
10856
11039
|
if (width !== height || stretch) {
|
|
10857
11040
|
transform = get$1();
|
|
@@ -10866,19 +11049,16 @@ function radialGradient(paint, box) {
|
|
|
10866
11049
|
return data;
|
|
10867
11050
|
}
|
|
10868
11051
|
|
|
10869
|
-
const {
|
|
11052
|
+
const { getAngle, getDistance } = PointHelper;
|
|
10870
11053
|
const { get, rotateOfOuter, scaleOfOuter } = MatrixHelper;
|
|
10871
|
-
const
|
|
10872
|
-
const defaultTo = { x: 0.5, y: 1 };
|
|
11054
|
+
const { toPoint } = AroundHelper;
|
|
10873
11055
|
const realFrom = {};
|
|
10874
11056
|
const realTo = {};
|
|
10875
11057
|
function conicGradient(paint, box) {
|
|
10876
11058
|
let { from, to, type, opacity, blendMode, stretch } = paint;
|
|
10877
|
-
from ||
|
|
10878
|
-
to ||
|
|
10879
|
-
const {
|
|
10880
|
-
set(realFrom, x + from.x * width, y + from.y * height);
|
|
10881
|
-
set(realTo, x + to.x * width, y + to.y * height);
|
|
11059
|
+
toPoint(from || 'center', box, realFrom);
|
|
11060
|
+
toPoint(to || 'bottom', box, realTo);
|
|
11061
|
+
const { width, height } = box;
|
|
10882
11062
|
const transform = get();
|
|
10883
11063
|
const angle = getAngle(realFrom, realTo);
|
|
10884
11064
|
if (Platform.conicGradientRotate90) {
|
|
@@ -11032,7 +11212,7 @@ Group.prototype.__renderMask = function (canvas, options) {
|
|
|
11032
11212
|
maskEnd(this, currentMask, canvas, contentCanvas, maskCanvas, maskOpacity);
|
|
11033
11213
|
maskCanvas = contentCanvas = null;
|
|
11034
11214
|
}
|
|
11035
|
-
if (child.__.
|
|
11215
|
+
if (child.__.mask === 'path') {
|
|
11036
11216
|
if (child.opacity < 1) {
|
|
11037
11217
|
currentMask = 'opacity-path';
|
|
11038
11218
|
maskOpacity = child.opacity;
|
|
@@ -11053,7 +11233,7 @@ Group.prototype.__renderMask = function (canvas, options) {
|
|
|
11053
11233
|
contentCanvas = getCanvas(canvas);
|
|
11054
11234
|
child.__render(maskCanvas, options);
|
|
11055
11235
|
}
|
|
11056
|
-
if (child.__.
|
|
11236
|
+
if (child.__.mask !== 'clipping')
|
|
11057
11237
|
continue;
|
|
11058
11238
|
}
|
|
11059
11239
|
if (excludeRenderBounds(child, options))
|
|
@@ -11354,11 +11534,11 @@ function layoutChar(drawData, style, width, _height) {
|
|
|
11354
11534
|
if (mode === WordMode) {
|
|
11355
11535
|
wordChar = { char: '', x: charX };
|
|
11356
11536
|
charX = toWordChar(word.data, charX, wordChar);
|
|
11357
|
-
if (wordChar.char !== ' ')
|
|
11537
|
+
if (row.isOverflow || wordChar.char !== ' ')
|
|
11358
11538
|
row.data.push(wordChar);
|
|
11359
11539
|
}
|
|
11360
11540
|
else {
|
|
11361
|
-
charX = toChar(word.data, charX, row.data);
|
|
11541
|
+
charX = toChar(word.data, charX, row.data, row.isOverflow);
|
|
11362
11542
|
}
|
|
11363
11543
|
if (!row.paraEnd && addWordWidth) {
|
|
11364
11544
|
charX += addWordWidth;
|
|
@@ -11385,9 +11565,9 @@ function toWordChar(data, charX, wordChar) {
|
|
|
11385
11565
|
});
|
|
11386
11566
|
return charX;
|
|
11387
11567
|
}
|
|
11388
|
-
function toChar(data, charX, rowData) {
|
|
11568
|
+
function toChar(data, charX, rowData, isOverflow) {
|
|
11389
11569
|
data.forEach(char => {
|
|
11390
|
-
if (char.char !== ' ') {
|
|
11570
|
+
if (isOverflow || char.char !== ' ') {
|
|
11391
11571
|
char.x = charX;
|
|
11392
11572
|
rowData.push(char);
|
|
11393
11573
|
}
|
|
@@ -11419,12 +11599,14 @@ function layoutText(drawData, style) {
|
|
|
11419
11599
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
11420
11600
|
row = rows[i];
|
|
11421
11601
|
row.x = x;
|
|
11422
|
-
|
|
11423
|
-
|
|
11424
|
-
|
|
11425
|
-
|
|
11426
|
-
|
|
11427
|
-
|
|
11602
|
+
if (row.width < width || (row.width > width && !__clipText)) {
|
|
11603
|
+
switch (textAlign) {
|
|
11604
|
+
case 'center':
|
|
11605
|
+
row.x += (width - row.width) / 2;
|
|
11606
|
+
break;
|
|
11607
|
+
case 'right':
|
|
11608
|
+
row.x += width - row.width;
|
|
11609
|
+
}
|
|
11428
11610
|
}
|
|
11429
11611
|
if (row.paraStart && paraSpacing && i > 0)
|
|
11430
11612
|
starY += paraSpacing;
|
|
@@ -11464,11 +11646,13 @@ function clipText(drawData, style) {
|
|
|
11464
11646
|
const { rows, overflow } = drawData;
|
|
11465
11647
|
let { textOverflow } = style;
|
|
11466
11648
|
rows.splice(overflow);
|
|
11467
|
-
if (textOverflow !== '
|
|
11468
|
-
if (textOverflow === '
|
|
11649
|
+
if (textOverflow && textOverflow !== 'show') {
|
|
11650
|
+
if (textOverflow === 'hide')
|
|
11651
|
+
textOverflow = '';
|
|
11652
|
+
else if (textOverflow === 'ellipsis')
|
|
11469
11653
|
textOverflow = '...';
|
|
11470
11654
|
let char, charRight;
|
|
11471
|
-
const ellipsisWidth = Platform.canvas.measureText(textOverflow).width;
|
|
11655
|
+
const ellipsisWidth = textOverflow ? Platform.canvas.measureText(textOverflow).width : 0;
|
|
11472
11656
|
const right = style.x + style.width - ellipsisWidth;
|
|
11473
11657
|
const list = style.textWrap === 'none' ? rows : [rows[overflow - 1]];
|
|
11474
11658
|
list.forEach(row => {
|
|
@@ -11636,8 +11820,12 @@ const ExportModule = {
|
|
|
11636
11820
|
let renderBounds, trimBounds, scaleX = 1, scaleY = 1;
|
|
11637
11821
|
const { worldTransform, isLeafer, isFrame } = leaf;
|
|
11638
11822
|
const { slice, trim, onCanvas } = options;
|
|
11639
|
-
|
|
11640
|
-
|
|
11823
|
+
let scale = options.scale || 1;
|
|
11824
|
+
let pixelRatio = options.pixelRatio || 1;
|
|
11825
|
+
if (leaf.isApp) {
|
|
11826
|
+
scale *= pixelRatio;
|
|
11827
|
+
pixelRatio = leaf.app.pixelRatio;
|
|
11828
|
+
}
|
|
11641
11829
|
const screenshot = options.screenshot || leaf.isApp;
|
|
11642
11830
|
const fill = (isLeafer && screenshot) ? (options.fill === undefined ? leaf.fill : options.fill) : options.fill;
|
|
11643
11831
|
const needFill = FileHelper.isOpaqueImage(filename) || fill, matrix = new Matrix();
|
|
@@ -11805,4 +11993,4 @@ LeaferCanvas.prototype.updateViewSize = function () {
|
|
|
11805
11993
|
}
|
|
11806
11994
|
};
|
|
11807
11995
|
|
|
11808
|
-
export { AnimateEvent, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragEvent, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Export, FileHelper, Frame, FrameData, Group, GroupData, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, LeaferTypeCreator, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, RotateEvent, Run, Selector, Star, StarData, State, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, ZoomEvent, affectRenderBoundsType, affectStrokeBoundsType, arrowType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, layoutProcessor, maskType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, stateType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix, tempPoint$3 as tempPoint, useCanvas, useModule, version, zoomLayerType };
|
|
11996
|
+
export { AlignHelper, AnimateEvent, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragEvent, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Export, FileHelper, Frame, FrameData, Group, GroupData, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, LeaferTypeCreator, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, RotateEvent, Run, Selector, Star, StarData, State, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, ZoomEvent, affectRenderBoundsType, affectStrokeBoundsType, arrowType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, inviteCode, layoutProcessor, maskType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, stateType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix, tempPoint$3 as tempPoint, useCanvas, useModule, version, visibleType, zoomLayerType };
|