@leafer-draw/worker 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/worker.esm.js +60 -49
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.js +499 -326
- package/dist/worker.min.js +1 -1
- package/dist/worker.module.js +497 -327
- package/dist/worker.module.min.js +1 -1
- package/package.json +6 -6
package/dist/worker.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$1 = 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$6 = 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$5 } = 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
|
-
|
|
4416
|
+
shrinkContent() {
|
|
4417
|
+
const { x, y, width, height } = this.boxBounds;
|
|
4418
|
+
this._contentBounds = { x, y, width, height };
|
|
4419
|
+
}
|
|
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();
|
|
4370
4426
|
}
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4427
|
+
spreadRender() {
|
|
4428
|
+
const { x, y, width, height } = this.renderBounds;
|
|
4429
|
+
this._renderBounds = { x, y, width, height };
|
|
4430
|
+
this._localRenderBounds = { x, y, width, height };
|
|
4375
4431
|
}
|
|
4376
|
-
|
|
4377
|
-
this.
|
|
4378
|
-
toOuterOf$2(this.strokeBounds, this.leaf.__world, this._worldStrokeBounds);
|
|
4379
|
-
return this._worldStrokeBounds;
|
|
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$4 } = 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$4(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 true; }
|
|
5637
5717
|
init() {
|
|
@@ -6173,7 +6253,7 @@ class Renderer {
|
|
|
6173
6253
|
canvas.clear();
|
|
6174
6254
|
}
|
|
6175
6255
|
else {
|
|
6176
|
-
bounds.spread(
|
|
6256
|
+
bounds.spread(10 + 1 / this.canvas.pixelRatio).ceil();
|
|
6177
6257
|
canvas.clearWorld(bounds, true);
|
|
6178
6258
|
canvas.clipWorld(bounds, true);
|
|
6179
6259
|
}
|
|
@@ -6245,8 +6325,11 @@ class Renderer {
|
|
|
6245
6325
|
if (!bounds.includes(this.target.__world) || this.needFill || !e.samePixelRatio) {
|
|
6246
6326
|
this.addBlock(this.canvas.bounds);
|
|
6247
6327
|
this.target.forceUpdate('surface');
|
|
6328
|
+
return;
|
|
6248
6329
|
}
|
|
6249
6330
|
}
|
|
6331
|
+
this.addBlock(new Bounds(0, 0, 1, 1));
|
|
6332
|
+
this.changed = true;
|
|
6250
6333
|
}
|
|
6251
6334
|
__onLayoutEnd(event) {
|
|
6252
6335
|
if (event.data)
|
|
@@ -6320,10 +6403,11 @@ function stateType(defaultValue) {
|
|
|
6320
6403
|
function arrowType(defaultValue) {
|
|
6321
6404
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
6322
6405
|
set(value) {
|
|
6323
|
-
this.__setAttr(key, value)
|
|
6324
|
-
|
|
6325
|
-
|
|
6326
|
-
|
|
6406
|
+
if (this.__setAttr(key, value)) {
|
|
6407
|
+
const data = this.__;
|
|
6408
|
+
data.__useArrow = data.startArrow !== 'none' || data.endArrow !== 'none';
|
|
6409
|
+
doStrokeType(this);
|
|
6410
|
+
}
|
|
6327
6411
|
}
|
|
6328
6412
|
}));
|
|
6329
6413
|
}
|
|
@@ -6496,7 +6580,7 @@ class UIData extends LeafData {
|
|
|
6496
6580
|
const UnitConvert = {
|
|
6497
6581
|
number(value, percentRefer) {
|
|
6498
6582
|
if (typeof value === 'object')
|
|
6499
|
-
return value.type === 'percent' ? value.value
|
|
6583
|
+
return value.type === 'percent' ? value.value * percentRefer : value.value;
|
|
6500
6584
|
return value;
|
|
6501
6585
|
}
|
|
6502
6586
|
};
|
|
@@ -6505,7 +6589,7 @@ class GroupData extends UIData {
|
|
|
6505
6589
|
}
|
|
6506
6590
|
|
|
6507
6591
|
class BoxData extends GroupData {
|
|
6508
|
-
get __boxStroke() { return
|
|
6592
|
+
get __boxStroke() { return !this.__pathInputed; }
|
|
6509
6593
|
}
|
|
6510
6594
|
|
|
6511
6595
|
class LeaferData extends GroupData {
|
|
@@ -6518,11 +6602,11 @@ class LineData extends UIData {
|
|
|
6518
6602
|
}
|
|
6519
6603
|
|
|
6520
6604
|
class RectData extends UIData {
|
|
6521
|
-
get __boxStroke() { return
|
|
6605
|
+
get __boxStroke() { return !this.__pathInputed; }
|
|
6522
6606
|
}
|
|
6523
6607
|
|
|
6524
6608
|
class EllipseData extends UIData {
|
|
6525
|
-
get __boxStroke() { return
|
|
6609
|
+
get __boxStroke() { return !this.__pathInputed; }
|
|
6526
6610
|
}
|
|
6527
6611
|
|
|
6528
6612
|
class PolygonData extends UIData {
|
|
@@ -6549,6 +6633,7 @@ const fontWeightMap = {
|
|
|
6549
6633
|
'black': 900
|
|
6550
6634
|
};
|
|
6551
6635
|
class TextData extends UIData {
|
|
6636
|
+
get __useNaturalRatio() { return false; }
|
|
6552
6637
|
setFontWeight(value) {
|
|
6553
6638
|
if (typeof value === 'string') {
|
|
6554
6639
|
this.__setInput('fontWeight', value);
|
|
@@ -6590,19 +6675,18 @@ class CanvasData extends RectData {
|
|
|
6590
6675
|
const UIBounds = {
|
|
6591
6676
|
__updateStrokeSpread() {
|
|
6592
6677
|
let width = 0, boxWidth = 0;
|
|
6593
|
-
const
|
|
6594
|
-
if ((stroke || hitStroke === 'all') && strokeWidth && strokeAlign !== 'inside') {
|
|
6678
|
+
const data = this.__, { strokeAlign, strokeWidth } = data;
|
|
6679
|
+
if ((data.stroke || data.hitStroke === 'all') && strokeWidth && strokeAlign !== 'inside') {
|
|
6595
6680
|
boxWidth = width = strokeAlign === 'center' ? strokeWidth / 2 : strokeWidth;
|
|
6596
|
-
if (!
|
|
6597
|
-
const
|
|
6598
|
-
const
|
|
6599
|
-
const storkeCapAddWidth = strokeCap === 'none' ? 0 : strokeWidth;
|
|
6681
|
+
if (!data.__boxStroke) {
|
|
6682
|
+
const miterLimitAddWidth = data.__isLinePath ? 0 : 10 * width;
|
|
6683
|
+
const storkeCapAddWidth = data.strokeCap === 'none' ? 0 : strokeWidth;
|
|
6600
6684
|
width += Math.max(miterLimitAddWidth, storkeCapAddWidth);
|
|
6601
6685
|
}
|
|
6602
6686
|
}
|
|
6603
|
-
|
|
6604
|
-
if (this.__.__useArrow)
|
|
6687
|
+
if (data.__useArrow)
|
|
6605
6688
|
width += strokeWidth * 5;
|
|
6689
|
+
this.__layout.strokeBoxSpread = boxWidth;
|
|
6606
6690
|
return width;
|
|
6607
6691
|
},
|
|
6608
6692
|
__updateRenderSpread() {
|
|
@@ -6622,7 +6706,7 @@ const UIBounds = {
|
|
|
6622
6706
|
if (backgroundBlur)
|
|
6623
6707
|
shapeWidth = Math.max(shapeWidth, backgroundBlur);
|
|
6624
6708
|
this.__layout.renderShapeSpread = shapeWidth;
|
|
6625
|
-
return width;
|
|
6709
|
+
return width + (this.__layout.strokeSpread || 0);
|
|
6626
6710
|
}
|
|
6627
6711
|
};
|
|
6628
6712
|
|
|
@@ -6713,7 +6797,7 @@ function drawFast(ui, canvas, options) {
|
|
|
6713
6797
|
|
|
6714
6798
|
const RectRender = {
|
|
6715
6799
|
__drawFast(canvas, options) {
|
|
6716
|
-
|
|
6800
|
+
let { width, height, fill, stroke, __drawAfterFill } = this.__;
|
|
6717
6801
|
if (fill) {
|
|
6718
6802
|
canvas.fillStyle = fill;
|
|
6719
6803
|
canvas.fillRect(0, 0, width, height);
|
|
@@ -6731,7 +6815,16 @@ const RectRender = {
|
|
|
6731
6815
|
canvas.strokeRect(0, 0, width, height);
|
|
6732
6816
|
break;
|
|
6733
6817
|
case 'inside':
|
|
6734
|
-
|
|
6818
|
+
width -= __strokeWidth, height -= __strokeWidth;
|
|
6819
|
+
if (width < 0 || height < 0) {
|
|
6820
|
+
canvas.save();
|
|
6821
|
+
this.__clip(canvas, options);
|
|
6822
|
+
canvas.strokeRect(half, half, width, height);
|
|
6823
|
+
canvas.restore();
|
|
6824
|
+
}
|
|
6825
|
+
else {
|
|
6826
|
+
canvas.strokeRect(half, half, width, height);
|
|
6827
|
+
}
|
|
6735
6828
|
break;
|
|
6736
6829
|
case 'outside':
|
|
6737
6830
|
canvas.strokeRect(-half, -half, width + __strokeWidth, height + __strokeWidth);
|
|
@@ -6759,11 +6852,14 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
6759
6852
|
return scaleX !== scaleY ? { x: scaleX, y: scaleY } : scaleX;
|
|
6760
6853
|
}
|
|
6761
6854
|
get pen() {
|
|
6762
|
-
|
|
6855
|
+
const { path } = this.__;
|
|
6856
|
+
pen.set(this.path = path || []);
|
|
6857
|
+
if (!path)
|
|
6858
|
+
this.__drawPathByBox(pen);
|
|
6763
6859
|
return pen;
|
|
6764
6860
|
}
|
|
6765
6861
|
get editConfig() { return undefined; }
|
|
6766
|
-
get editOuter() { return 'EditTool'; }
|
|
6862
|
+
get editOuter() { return this.__.__isLinePath ? 'LineEditTool' : 'EditTool'; }
|
|
6767
6863
|
get editInner() { return 'PathEditor'; }
|
|
6768
6864
|
constructor(data) {
|
|
6769
6865
|
super(data);
|
|
@@ -6777,22 +6873,22 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
6777
6873
|
}
|
|
6778
6874
|
createProxyData() { return undefined; }
|
|
6779
6875
|
find(_condition, _options) { return undefined; }
|
|
6876
|
+
findTag(tag) { return this.find({ tag }); }
|
|
6780
6877
|
findOne(_condition, _options) { return undefined; }
|
|
6878
|
+
findId(id) { return this.findOne({ id }); }
|
|
6781
6879
|
getPath(curve, pathForRender) {
|
|
6782
6880
|
this.__layout.update();
|
|
6783
6881
|
let path = pathForRender ? this.__.__pathForRender : this.__.path;
|
|
6784
|
-
if (!path)
|
|
6785
|
-
|
|
6786
|
-
if (width || height) {
|
|
6787
|
-
pen.set(path = []);
|
|
6788
|
-
this.__drawPathByBox(pen);
|
|
6789
|
-
}
|
|
6790
|
-
}
|
|
6882
|
+
if (!path)
|
|
6883
|
+
pen.set(path = []), this.__drawPathByBox(pen);
|
|
6791
6884
|
return curve ? PathConvert.toCanvasData(path, true) : path;
|
|
6792
6885
|
}
|
|
6793
6886
|
getPathString(curve, pathForRender) {
|
|
6794
6887
|
return PathConvert.stringify(this.getPath(curve, pathForRender));
|
|
6795
6888
|
}
|
|
6889
|
+
load() {
|
|
6890
|
+
this.__.__computePaint();
|
|
6891
|
+
}
|
|
6796
6892
|
__onUpdateSize() {
|
|
6797
6893
|
if (this.__.__input) {
|
|
6798
6894
|
const data = this.__;
|
|
@@ -6878,7 +6974,7 @@ __decorate([
|
|
|
6878
6974
|
opacityType(1)
|
|
6879
6975
|
], UI.prototype, "opacity", void 0);
|
|
6880
6976
|
__decorate([
|
|
6881
|
-
|
|
6977
|
+
visibleType(true)
|
|
6882
6978
|
], UI.prototype, "visible", void 0);
|
|
6883
6979
|
__decorate([
|
|
6884
6980
|
stateType(false)
|
|
@@ -6895,9 +6991,6 @@ __decorate([
|
|
|
6895
6991
|
__decorate([
|
|
6896
6992
|
maskType(false)
|
|
6897
6993
|
], UI.prototype, "mask", void 0);
|
|
6898
|
-
__decorate([
|
|
6899
|
-
surfaceType('pixel')
|
|
6900
|
-
], UI.prototype, "maskType", void 0);
|
|
6901
6994
|
__decorate([
|
|
6902
6995
|
eraserType(false)
|
|
6903
6996
|
], UI.prototype, "eraser", void 0);
|
|
@@ -6928,9 +7021,75 @@ __decorate([
|
|
|
6928
7021
|
__decorate([
|
|
6929
7022
|
rotationType(0, true)
|
|
6930
7023
|
], UI.prototype, "skewY", void 0);
|
|
7024
|
+
__decorate([
|
|
7025
|
+
positionType(0, true)
|
|
7026
|
+
], UI.prototype, "offsetX", void 0);
|
|
7027
|
+
__decorate([
|
|
7028
|
+
positionType(0, true)
|
|
7029
|
+
], UI.prototype, "offsetY", void 0);
|
|
7030
|
+
__decorate([
|
|
7031
|
+
positionType(0, true)
|
|
7032
|
+
], UI.prototype, "scrollX", void 0);
|
|
7033
|
+
__decorate([
|
|
7034
|
+
positionType(0, true)
|
|
7035
|
+
], UI.prototype, "scrollY", void 0);
|
|
7036
|
+
__decorate([
|
|
7037
|
+
autoLayoutType()
|
|
7038
|
+
], UI.prototype, "origin", void 0);
|
|
6931
7039
|
__decorate([
|
|
6932
7040
|
autoLayoutType()
|
|
6933
7041
|
], UI.prototype, "around", void 0);
|
|
7042
|
+
__decorate([
|
|
7043
|
+
dataType(false)
|
|
7044
|
+
], UI.prototype, "lazy", void 0);
|
|
7045
|
+
__decorate([
|
|
7046
|
+
naturalBoundsType(1)
|
|
7047
|
+
], UI.prototype, "pixelRatio", void 0);
|
|
7048
|
+
__decorate([
|
|
7049
|
+
pathInputType()
|
|
7050
|
+
], UI.prototype, "path", void 0);
|
|
7051
|
+
__decorate([
|
|
7052
|
+
pathType()
|
|
7053
|
+
], UI.prototype, "windingRule", void 0);
|
|
7054
|
+
__decorate([
|
|
7055
|
+
pathType(true)
|
|
7056
|
+
], UI.prototype, "closed", void 0);
|
|
7057
|
+
__decorate([
|
|
7058
|
+
autoLayoutType(false)
|
|
7059
|
+
], UI.prototype, "flow", void 0);
|
|
7060
|
+
__decorate([
|
|
7061
|
+
boundsType(0)
|
|
7062
|
+
], UI.prototype, "padding", void 0);
|
|
7063
|
+
__decorate([
|
|
7064
|
+
boundsType(0)
|
|
7065
|
+
], UI.prototype, "gap", void 0);
|
|
7066
|
+
__decorate([
|
|
7067
|
+
boundsType('top-left')
|
|
7068
|
+
], UI.prototype, "align", void 0);
|
|
7069
|
+
__decorate([
|
|
7070
|
+
boundsType(false)
|
|
7071
|
+
], UI.prototype, "wrap", void 0);
|
|
7072
|
+
__decorate([
|
|
7073
|
+
boundsType('box')
|
|
7074
|
+
], UI.prototype, "itemBox", void 0);
|
|
7075
|
+
__decorate([
|
|
7076
|
+
boundsType(true)
|
|
7077
|
+
], UI.prototype, "inFlow", void 0);
|
|
7078
|
+
__decorate([
|
|
7079
|
+
boundsType()
|
|
7080
|
+
], UI.prototype, "autoWidth", void 0);
|
|
7081
|
+
__decorate([
|
|
7082
|
+
boundsType()
|
|
7083
|
+
], UI.prototype, "autoHeight", void 0);
|
|
7084
|
+
__decorate([
|
|
7085
|
+
boundsType()
|
|
7086
|
+
], UI.prototype, "autoBox", void 0);
|
|
7087
|
+
__decorate([
|
|
7088
|
+
boundsType()
|
|
7089
|
+
], UI.prototype, "widthRange", void 0);
|
|
7090
|
+
__decorate([
|
|
7091
|
+
boundsType()
|
|
7092
|
+
], UI.prototype, "heightRange", void 0);
|
|
6934
7093
|
__decorate([
|
|
6935
7094
|
dataType(false)
|
|
6936
7095
|
], UI.prototype, "draggable", void 0);
|
|
@@ -6940,9 +7099,6 @@ __decorate([
|
|
|
6940
7099
|
__decorate([
|
|
6941
7100
|
dataType(false)
|
|
6942
7101
|
], UI.prototype, "editable", void 0);
|
|
6943
|
-
__decorate([
|
|
6944
|
-
dataType('size')
|
|
6945
|
-
], UI.prototype, "editSize", void 0);
|
|
6946
7102
|
__decorate([
|
|
6947
7103
|
hitType(true)
|
|
6948
7104
|
], UI.prototype, "hittable", void 0);
|
|
@@ -6997,21 +7153,6 @@ __decorate([
|
|
|
6997
7153
|
__decorate([
|
|
6998
7154
|
strokeType(10)
|
|
6999
7155
|
], UI.prototype, "miterLimit", void 0);
|
|
7000
|
-
__decorate([
|
|
7001
|
-
dataType(false)
|
|
7002
|
-
], UI.prototype, "lazy", void 0);
|
|
7003
|
-
__decorate([
|
|
7004
|
-
naturalBoundsType(1)
|
|
7005
|
-
], UI.prototype, "pixelRatio", void 0);
|
|
7006
|
-
__decorate([
|
|
7007
|
-
pathInputType()
|
|
7008
|
-
], UI.prototype, "path", void 0);
|
|
7009
|
-
__decorate([
|
|
7010
|
-
pathType()
|
|
7011
|
-
], UI.prototype, "windingRule", void 0);
|
|
7012
|
-
__decorate([
|
|
7013
|
-
pathType(true)
|
|
7014
|
-
], UI.prototype, "closed", void 0);
|
|
7015
7156
|
__decorate([
|
|
7016
7157
|
arrowType('none')
|
|
7017
7158
|
], UI.prototype, "startArrow", void 0);
|
|
@@ -7142,6 +7283,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
7142
7283
|
get layoutLocked() { return !this.layouter.running; }
|
|
7143
7284
|
get FPS() { return this.renderer ? this.renderer.FPS : 60; }
|
|
7144
7285
|
get cursorPoint() { return (this.interaction && this.interaction.hoverData) || { x: this.width / 2, y: this.height / 2 }; }
|
|
7286
|
+
get clientBounds() { return this.canvas && this.canvas.getClientBounds(); }
|
|
7145
7287
|
constructor(userConfig, data) {
|
|
7146
7288
|
super(data);
|
|
7147
7289
|
this.config = {
|
|
@@ -7245,9 +7387,6 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
7245
7387
|
const data = DataHelper.copyAttrs({}, size, canvasSizeAttrs);
|
|
7246
7388
|
Object.keys(data).forEach(key => this[key] = data[key]);
|
|
7247
7389
|
}
|
|
7248
|
-
forceFullRender() {
|
|
7249
|
-
this.forceRender();
|
|
7250
|
-
}
|
|
7251
7390
|
forceRender(bounds) {
|
|
7252
7391
|
this.renderer.addBlock(bounds ? new Bounds(bounds) : this.canvas.bounds);
|
|
7253
7392
|
if (this.viewReady)
|
|
@@ -7302,7 +7441,8 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
7302
7441
|
this.__changeFill(newValue);
|
|
7303
7442
|
}
|
|
7304
7443
|
else if (attrName === 'hittable') {
|
|
7305
|
-
this.
|
|
7444
|
+
if (!this.parent)
|
|
7445
|
+
this.canvas.hittable = newValue;
|
|
7306
7446
|
}
|
|
7307
7447
|
}
|
|
7308
7448
|
return super.__setAttr(attrName, newValue);
|
|
@@ -7325,7 +7465,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
7325
7465
|
this.canvas.backgroundColor = newValue;
|
|
7326
7466
|
}
|
|
7327
7467
|
else {
|
|
7328
|
-
this.
|
|
7468
|
+
this.forceRender();
|
|
7329
7469
|
}
|
|
7330
7470
|
}
|
|
7331
7471
|
__onCreated() {
|
|
@@ -7420,6 +7560,9 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
7420
7560
|
zoom(_zoomType, _padding, _fixedScale) { return undefined; }
|
|
7421
7561
|
getValidMove(moveX, moveY) { return { x: moveX, y: moveY }; }
|
|
7422
7562
|
getValidScale(changeScale) { return changeScale; }
|
|
7563
|
+
getWorldPointByClient(clientPoint, updateClient) {
|
|
7564
|
+
return this.interaction && this.interaction.getLocal(clientPoint, updateClient);
|
|
7565
|
+
}
|
|
7423
7566
|
__checkUpdateLayout() {
|
|
7424
7567
|
this.__layout.update();
|
|
7425
7568
|
}
|
|
@@ -7502,8 +7645,8 @@ Rect = __decorate([
|
|
|
7502
7645
|
|
|
7503
7646
|
const rect = Rect.prototype;
|
|
7504
7647
|
const group = Group.prototype;
|
|
7505
|
-
const
|
|
7506
|
-
const { copy: copy$2, add } = BoundsHelper;
|
|
7648
|
+
const childrenRenderBounds = {};
|
|
7649
|
+
const { copy: copy$2, add, includes: includes$1 } = BoundsHelper;
|
|
7507
7650
|
let Box = class Box extends Group {
|
|
7508
7651
|
get __tag() { return 'Box'; }
|
|
7509
7652
|
get isBranchLeaf() { return true; }
|
|
@@ -7514,24 +7657,29 @@ let Box = class Box extends Group {
|
|
|
7514
7657
|
__updateStrokeSpread() { return 0; }
|
|
7515
7658
|
__updateRectRenderSpread() { return 0; }
|
|
7516
7659
|
__updateRenderSpread() {
|
|
7517
|
-
|
|
7518
|
-
const hide = this.__.__drawAfterFill = this.__.overflow === 'hide';
|
|
7519
|
-
return (width || hide) ? width : -1;
|
|
7660
|
+
return this.__updateRectRenderSpread() || -1;
|
|
7520
7661
|
}
|
|
7521
7662
|
__updateRectBoxBounds() { }
|
|
7522
7663
|
__updateBoxBounds() {
|
|
7523
7664
|
const data = this.__;
|
|
7524
|
-
if (
|
|
7525
|
-
if (
|
|
7526
|
-
this.leafer.
|
|
7527
|
-
|
|
7528
|
-
|
|
7529
|
-
|
|
7530
|
-
|
|
7531
|
-
|
|
7532
|
-
|
|
7533
|
-
|
|
7665
|
+
if (this.children.length) {
|
|
7666
|
+
if (data.__autoSide) {
|
|
7667
|
+
if (this.leafer && this.leafer.ready)
|
|
7668
|
+
this.leafer.layouter.addExtra(this);
|
|
7669
|
+
super.__updateBoxBounds();
|
|
7670
|
+
if (!data.__autoSize) {
|
|
7671
|
+
const b = this.__layout.boxBounds;
|
|
7672
|
+
if (!data.__autoWidth)
|
|
7673
|
+
b.x = 0, b.width = data.width;
|
|
7674
|
+
if (!data.__autoHeight)
|
|
7675
|
+
b.y = 0, b.height = data.height;
|
|
7676
|
+
}
|
|
7677
|
+
}
|
|
7678
|
+
else {
|
|
7679
|
+
this.__updateRectBoxBounds();
|
|
7534
7680
|
}
|
|
7681
|
+
if (data.flow)
|
|
7682
|
+
this.__updateContentBounds();
|
|
7535
7683
|
}
|
|
7536
7684
|
else {
|
|
7537
7685
|
this.__updateRectBoxBounds();
|
|
@@ -7539,13 +7687,20 @@ let Box = class Box extends Group {
|
|
|
7539
7687
|
}
|
|
7540
7688
|
__updateStrokeBounds() { }
|
|
7541
7689
|
__updateRenderBounds() {
|
|
7542
|
-
|
|
7543
|
-
|
|
7544
|
-
|
|
7545
|
-
copy$2(bounds$1, renderBounds);
|
|
7690
|
+
let isOverflow;
|
|
7691
|
+
const { renderBounds } = this.__layout;
|
|
7692
|
+
if (this.children.length) {
|
|
7546
7693
|
super.__updateRenderBounds();
|
|
7547
|
-
|
|
7694
|
+
copy$2(childrenRenderBounds, renderBounds);
|
|
7695
|
+
this.__updateRectRenderBounds();
|
|
7696
|
+
isOverflow = !includes$1(renderBounds, childrenRenderBounds) || undefined;
|
|
7697
|
+
}
|
|
7698
|
+
else {
|
|
7699
|
+
this.__updateRectRenderBounds();
|
|
7548
7700
|
}
|
|
7701
|
+
this.isOverflow !== isOverflow && (this.isOverflow = isOverflow);
|
|
7702
|
+
if (isOverflow && !(this.__.__drawAfterFill = this.__.overflow === 'hide'))
|
|
7703
|
+
add(renderBounds, childrenRenderBounds);
|
|
7549
7704
|
}
|
|
7550
7705
|
__updateRectRenderBounds() { }
|
|
7551
7706
|
__updateRectChange() { }
|
|
@@ -7561,16 +7716,27 @@ let Box = class Box extends Group {
|
|
|
7561
7716
|
}
|
|
7562
7717
|
else {
|
|
7563
7718
|
this.__renderRect(canvas, options);
|
|
7564
|
-
this.
|
|
7719
|
+
if (this.children.length)
|
|
7720
|
+
this.__renderGroup(canvas, options);
|
|
7565
7721
|
}
|
|
7566
7722
|
}
|
|
7567
7723
|
__drawAfterFill(canvas, options) {
|
|
7568
|
-
|
|
7569
|
-
|
|
7570
|
-
|
|
7571
|
-
|
|
7572
|
-
|
|
7724
|
+
const { length } = this.children;
|
|
7725
|
+
if (this.isOverflow) {
|
|
7726
|
+
canvas.save();
|
|
7727
|
+
canvas.clip();
|
|
7728
|
+
if (length)
|
|
7729
|
+
this.__renderGroup(canvas, options);
|
|
7730
|
+
canvas.restore();
|
|
7731
|
+
}
|
|
7732
|
+
else {
|
|
7733
|
+
if (length)
|
|
7734
|
+
this.__renderGroup(canvas, options);
|
|
7735
|
+
}
|
|
7736
|
+
if (this.__.stroke && length) {
|
|
7737
|
+
canvas.setWorld(this.__nowWorld);
|
|
7573
7738
|
this.__drawRenderPath(canvas);
|
|
7739
|
+
}
|
|
7574
7740
|
}
|
|
7575
7741
|
};
|
|
7576
7742
|
__decorate([
|
|
@@ -7708,9 +7874,10 @@ let Line = class Line extends UI {
|
|
|
7708
7874
|
super(data);
|
|
7709
7875
|
}
|
|
7710
7876
|
__updatePath() {
|
|
7711
|
-
const
|
|
7712
|
-
|
|
7713
|
-
|
|
7877
|
+
const data = this.__;
|
|
7878
|
+
const path = data.path = [];
|
|
7879
|
+
if (data.points) {
|
|
7880
|
+
drawPoints$1(path, data.points, false, data.closed);
|
|
7714
7881
|
}
|
|
7715
7882
|
else {
|
|
7716
7883
|
moveTo$2(path, 0, 0);
|
|
@@ -7945,7 +8112,7 @@ Canvas = __decorate([
|
|
|
7945
8112
|
registerUI()
|
|
7946
8113
|
], Canvas);
|
|
7947
8114
|
|
|
7948
|
-
const { copyAndSpread, includes, spread, setList } = BoundsHelper;
|
|
8115
|
+
const { copyAndSpread, includes, isSame: isSame$1, spread, setList } = BoundsHelper;
|
|
7949
8116
|
let Text = class Text extends UI {
|
|
7950
8117
|
get __tag() { return 'Text'; }
|
|
7951
8118
|
get editInner() { return 'TextEditor'; }
|
|
@@ -8018,7 +8185,7 @@ let Text = class Text extends UI {
|
|
|
8018
8185
|
if (italic)
|
|
8019
8186
|
b.width += fontSize * 0.16;
|
|
8020
8187
|
const contentBounds = includes(b, bounds) ? b : bounds;
|
|
8021
|
-
if (contentBounds
|
|
8188
|
+
if (!isSame$1(contentBounds, layout.contentBounds)) {
|
|
8022
8189
|
layout.contentBounds = contentBounds;
|
|
8023
8190
|
layout.renderChanged = true;
|
|
8024
8191
|
setList(data.__textBoxBounds = {}, [b, bounds]);
|
|
@@ -8046,9 +8213,6 @@ __decorate([
|
|
|
8046
8213
|
__decorate([
|
|
8047
8214
|
boundsType(0)
|
|
8048
8215
|
], Text.prototype, "height", void 0);
|
|
8049
|
-
__decorate([
|
|
8050
|
-
boundsType(0)
|
|
8051
|
-
], Text.prototype, "padding", void 0);
|
|
8052
8216
|
__decorate([
|
|
8053
8217
|
surfaceType('#000000')
|
|
8054
8218
|
], Text.prototype, "fill", void 0);
|
|
@@ -8083,7 +8247,7 @@ __decorate([
|
|
|
8083
8247
|
boundsType(0)
|
|
8084
8248
|
], Text.prototype, "letterSpacing", void 0);
|
|
8085
8249
|
__decorate([
|
|
8086
|
-
boundsType({ type: 'percent', value:
|
|
8250
|
+
boundsType({ type: 'percent', value: 1.5 })
|
|
8087
8251
|
], Text.prototype, "lineHeight", void 0);
|
|
8088
8252
|
__decorate([
|
|
8089
8253
|
boundsType(0)
|
|
@@ -8177,8 +8341,6 @@ function penPathType() {
|
|
|
8177
8341
|
};
|
|
8178
8342
|
}
|
|
8179
8343
|
|
|
8180
|
-
const version = "1.0.0-rc.21";
|
|
8181
|
-
|
|
8182
8344
|
function fillText(ui, canvas) {
|
|
8183
8345
|
let row;
|
|
8184
8346
|
const { rows, decorationY, decorationHeight } = ui.__.__textDrawData;
|
|
@@ -8398,7 +8560,7 @@ function shape(ui, current, options) {
|
|
|
8398
8560
|
}
|
|
8399
8561
|
else {
|
|
8400
8562
|
const { renderShapeSpread: spread } = ui.__layout;
|
|
8401
|
-
const worldClipBounds = getIntersectData(spread ? getSpread(current.bounds, spread * scaleX, spread *
|
|
8563
|
+
const worldClipBounds = getIntersectData(spread ? getSpread(current.bounds, scaleX === scaleY ? spread * scaleX : [spread * scaleY, spread * scaleX]) : current.bounds, nowWorld);
|
|
8402
8564
|
fitMatrix = current.bounds.getFitMatrix(worldClipBounds);
|
|
8403
8565
|
let { a: fitScaleX, d: fitScaleY } = fitMatrix;
|
|
8404
8566
|
if (fitMatrix.a < 1) {
|
|
@@ -8498,10 +8660,10 @@ function clipMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
|
8498
8660
|
rotate(transform, rotation);
|
|
8499
8661
|
data.transform = transform;
|
|
8500
8662
|
}
|
|
8501
|
-
function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation,
|
|
8663
|
+
function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align) {
|
|
8502
8664
|
const transform = get$4();
|
|
8503
8665
|
if (rotation) {
|
|
8504
|
-
if (
|
|
8666
|
+
if (align === 'center') {
|
|
8505
8667
|
rotateOfOuter$2(transform, { x: width / 2, y: height / 2 }, rotation);
|
|
8506
8668
|
}
|
|
8507
8669
|
else {
|
|
@@ -8534,12 +8696,12 @@ function createData(leafPaint, image, paint, box) {
|
|
|
8534
8696
|
let { width, height } = image;
|
|
8535
8697
|
if (paint.padding)
|
|
8536
8698
|
box = tempBox.set(box).shrink(paint.padding);
|
|
8537
|
-
const { opacity, mode,
|
|
8699
|
+
const { opacity, mode, align, offset, scale, size, rotation, blendMode, repeat } = paint;
|
|
8538
8700
|
const sameBox = box.width === width && box.height === height;
|
|
8539
8701
|
if (blendMode)
|
|
8540
8702
|
leafPaint.blendMode = blendMode;
|
|
8541
8703
|
const data = leafPaint.data = { mode };
|
|
8542
|
-
const swapSize =
|
|
8704
|
+
const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
|
|
8543
8705
|
const swapWidth = swapSize ? height : width, swapHeight = swapSize ? width : height;
|
|
8544
8706
|
let x = 0, y = 0, scaleX, scaleY;
|
|
8545
8707
|
if (!mode || mode === 'cover' || mode === 'fit') {
|
|
@@ -8557,11 +8719,11 @@ function createData(leafPaint, image, paint, box) {
|
|
|
8557
8719
|
scaleX = typeof scale === 'number' ? scale : scale.x;
|
|
8558
8720
|
scaleY = typeof scale === 'number' ? scale : scale.y;
|
|
8559
8721
|
}
|
|
8560
|
-
if (
|
|
8722
|
+
if (align) {
|
|
8561
8723
|
const imageBounds = { x, y, width: swapWidth, height: swapHeight };
|
|
8562
8724
|
if (scaleX)
|
|
8563
8725
|
imageBounds.width *= scaleX, imageBounds.height *= scaleY;
|
|
8564
|
-
|
|
8726
|
+
AlignHelper.toPoint(align, imageBounds, box, tempPoint, true);
|
|
8565
8727
|
x += tempPoint.x, y += tempPoint.y;
|
|
8566
8728
|
}
|
|
8567
8729
|
if (offset)
|
|
@@ -8578,7 +8740,7 @@ function createData(leafPaint, image, paint, box) {
|
|
|
8578
8740
|
break;
|
|
8579
8741
|
case 'repeat':
|
|
8580
8742
|
if (!sameBox || scaleX || rotation)
|
|
8581
|
-
repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation,
|
|
8743
|
+
repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align);
|
|
8582
8744
|
if (!repeat)
|
|
8583
8745
|
data.repeat = 'repeat';
|
|
8584
8746
|
break;
|
|
@@ -8849,13 +9011,14 @@ const PaintImageModule = {
|
|
|
8849
9011
|
recycleImage
|
|
8850
9012
|
};
|
|
8851
9013
|
|
|
8852
|
-
const
|
|
8853
|
-
const
|
|
9014
|
+
const { toPoint: toPoint$2 } = AroundHelper;
|
|
9015
|
+
const realFrom$2 = {};
|
|
9016
|
+
const realTo$2 = {};
|
|
8854
9017
|
function linearGradient(paint, box) {
|
|
8855
9018
|
let { from, to, type, blendMode, opacity } = paint;
|
|
8856
|
-
from ||
|
|
8857
|
-
to ||
|
|
8858
|
-
const style = Platform.canvas.createLinearGradient(
|
|
9019
|
+
toPoint$2(from || 'top', box, realFrom$2);
|
|
9020
|
+
toPoint$2(to || 'bottom', box, realTo$2);
|
|
9021
|
+
const style = Platform.canvas.createLinearGradient(realFrom$2.x, realFrom$2.y, realTo$2.x, realTo$2.y);
|
|
8859
9022
|
applyStops(style, paint.stops, opacity);
|
|
8860
9023
|
const data = { type, style };
|
|
8861
9024
|
if (blendMode)
|
|
@@ -8866,23 +9029,25 @@ function applyStops(gradient, stops, opacity) {
|
|
|
8866
9029
|
let stop;
|
|
8867
9030
|
for (let i = 0, len = stops.length; i < len; i++) {
|
|
8868
9031
|
stop = stops[i];
|
|
8869
|
-
|
|
9032
|
+
if (typeof stop === 'string') {
|
|
9033
|
+
gradient.addColorStop(i / (len - 1), ColorConvert.string(stop, opacity));
|
|
9034
|
+
}
|
|
9035
|
+
else {
|
|
9036
|
+
gradient.addColorStop(stop.offset, ColorConvert.string(stop.color, opacity));
|
|
9037
|
+
}
|
|
8870
9038
|
}
|
|
8871
9039
|
}
|
|
8872
9040
|
|
|
8873
|
-
const {
|
|
9041
|
+
const { getAngle: getAngle$1, getDistance: getDistance$1 } = PointHelper;
|
|
8874
9042
|
const { get: get$1, rotateOfOuter: rotateOfOuter$1, scaleOfOuter: scaleOfOuter$1 } = MatrixHelper;
|
|
8875
|
-
const
|
|
8876
|
-
const defaultTo$1 = { x: 0.5, y: 1 };
|
|
9043
|
+
const { toPoint: toPoint$1 } = AroundHelper;
|
|
8877
9044
|
const realFrom$1 = {};
|
|
8878
9045
|
const realTo$1 = {};
|
|
8879
9046
|
function radialGradient(paint, box) {
|
|
8880
9047
|
let { from, to, type, opacity, blendMode, stretch } = paint;
|
|
8881
|
-
from ||
|
|
8882
|
-
to ||
|
|
8883
|
-
const {
|
|
8884
|
-
set$1(realFrom$1, x + from.x * width, y + from.y * height);
|
|
8885
|
-
set$1(realTo$1, x + to.x * width, y + to.y * height);
|
|
9048
|
+
toPoint$1(from || 'center', box, realFrom$1);
|
|
9049
|
+
toPoint$1(to || 'bottom', box, realTo$1);
|
|
9050
|
+
const { width, height } = box;
|
|
8886
9051
|
let transform;
|
|
8887
9052
|
if (width !== height || stretch) {
|
|
8888
9053
|
transform = get$1();
|
|
@@ -8897,19 +9062,16 @@ function radialGradient(paint, box) {
|
|
|
8897
9062
|
return data;
|
|
8898
9063
|
}
|
|
8899
9064
|
|
|
8900
|
-
const {
|
|
9065
|
+
const { getAngle, getDistance } = PointHelper;
|
|
8901
9066
|
const { get, rotateOfOuter, scaleOfOuter } = MatrixHelper;
|
|
8902
|
-
const
|
|
8903
|
-
const defaultTo = { x: 0.5, y: 1 };
|
|
9067
|
+
const { toPoint } = AroundHelper;
|
|
8904
9068
|
const realFrom = {};
|
|
8905
9069
|
const realTo = {};
|
|
8906
9070
|
function conicGradient(paint, box) {
|
|
8907
9071
|
let { from, to, type, opacity, blendMode, stretch } = paint;
|
|
8908
|
-
from ||
|
|
8909
|
-
to ||
|
|
8910
|
-
const {
|
|
8911
|
-
set(realFrom, x + from.x * width, y + from.y * height);
|
|
8912
|
-
set(realTo, x + to.x * width, y + to.y * height);
|
|
9072
|
+
toPoint(from || 'center', box, realFrom);
|
|
9073
|
+
toPoint(to || 'bottom', box, realTo);
|
|
9074
|
+
const { width, height } = box;
|
|
8913
9075
|
const transform = get();
|
|
8914
9076
|
const angle = getAngle(realFrom, realTo);
|
|
8915
9077
|
if (Platform.conicGradientRotate90) {
|
|
@@ -9063,7 +9225,7 @@ Group.prototype.__renderMask = function (canvas, options) {
|
|
|
9063
9225
|
maskEnd(this, currentMask, canvas, contentCanvas, maskCanvas, maskOpacity);
|
|
9064
9226
|
maskCanvas = contentCanvas = null;
|
|
9065
9227
|
}
|
|
9066
|
-
if (child.__.
|
|
9228
|
+
if (child.__.mask === 'path') {
|
|
9067
9229
|
if (child.opacity < 1) {
|
|
9068
9230
|
currentMask = 'opacity-path';
|
|
9069
9231
|
maskOpacity = child.opacity;
|
|
@@ -9084,7 +9246,7 @@ Group.prototype.__renderMask = function (canvas, options) {
|
|
|
9084
9246
|
contentCanvas = getCanvas(canvas);
|
|
9085
9247
|
child.__render(maskCanvas, options);
|
|
9086
9248
|
}
|
|
9087
|
-
if (child.__.
|
|
9249
|
+
if (child.__.mask !== 'clipping')
|
|
9088
9250
|
continue;
|
|
9089
9251
|
}
|
|
9090
9252
|
if (excludeRenderBounds(child, options))
|
|
@@ -9385,11 +9547,11 @@ function layoutChar(drawData, style, width, _height) {
|
|
|
9385
9547
|
if (mode === WordMode) {
|
|
9386
9548
|
wordChar = { char: '', x: charX };
|
|
9387
9549
|
charX = toWordChar(word.data, charX, wordChar);
|
|
9388
|
-
if (wordChar.char !== ' ')
|
|
9550
|
+
if (row.isOverflow || wordChar.char !== ' ')
|
|
9389
9551
|
row.data.push(wordChar);
|
|
9390
9552
|
}
|
|
9391
9553
|
else {
|
|
9392
|
-
charX = toChar(word.data, charX, row.data);
|
|
9554
|
+
charX = toChar(word.data, charX, row.data, row.isOverflow);
|
|
9393
9555
|
}
|
|
9394
9556
|
if (!row.paraEnd && addWordWidth) {
|
|
9395
9557
|
charX += addWordWidth;
|
|
@@ -9416,9 +9578,9 @@ function toWordChar(data, charX, wordChar) {
|
|
|
9416
9578
|
});
|
|
9417
9579
|
return charX;
|
|
9418
9580
|
}
|
|
9419
|
-
function toChar(data, charX, rowData) {
|
|
9581
|
+
function toChar(data, charX, rowData, isOverflow) {
|
|
9420
9582
|
data.forEach(char => {
|
|
9421
|
-
if (char.char !== ' ') {
|
|
9583
|
+
if (isOverflow || char.char !== ' ') {
|
|
9422
9584
|
char.x = charX;
|
|
9423
9585
|
rowData.push(char);
|
|
9424
9586
|
}
|
|
@@ -9450,12 +9612,14 @@ function layoutText(drawData, style) {
|
|
|
9450
9612
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
9451
9613
|
row = rows[i];
|
|
9452
9614
|
row.x = x;
|
|
9453
|
-
|
|
9454
|
-
|
|
9455
|
-
|
|
9456
|
-
|
|
9457
|
-
|
|
9458
|
-
|
|
9615
|
+
if (row.width < width || (row.width > width && !__clipText)) {
|
|
9616
|
+
switch (textAlign) {
|
|
9617
|
+
case 'center':
|
|
9618
|
+
row.x += (width - row.width) / 2;
|
|
9619
|
+
break;
|
|
9620
|
+
case 'right':
|
|
9621
|
+
row.x += width - row.width;
|
|
9622
|
+
}
|
|
9459
9623
|
}
|
|
9460
9624
|
if (row.paraStart && paraSpacing && i > 0)
|
|
9461
9625
|
starY += paraSpacing;
|
|
@@ -9495,11 +9659,13 @@ function clipText(drawData, style) {
|
|
|
9495
9659
|
const { rows, overflow } = drawData;
|
|
9496
9660
|
let { textOverflow } = style;
|
|
9497
9661
|
rows.splice(overflow);
|
|
9498
|
-
if (textOverflow !== '
|
|
9499
|
-
if (textOverflow === '
|
|
9662
|
+
if (textOverflow && textOverflow !== 'show') {
|
|
9663
|
+
if (textOverflow === 'hide')
|
|
9664
|
+
textOverflow = '';
|
|
9665
|
+
else if (textOverflow === 'ellipsis')
|
|
9500
9666
|
textOverflow = '...';
|
|
9501
9667
|
let char, charRight;
|
|
9502
|
-
const ellipsisWidth = Platform.canvas.measureText(textOverflow).width;
|
|
9668
|
+
const ellipsisWidth = textOverflow ? Platform.canvas.measureText(textOverflow).width : 0;
|
|
9503
9669
|
const right = style.x + style.width - ellipsisWidth;
|
|
9504
9670
|
const list = style.textWrap === 'none' ? rows : [rows[overflow - 1]];
|
|
9505
9671
|
list.forEach(row => {
|
|
@@ -9667,8 +9833,12 @@ const ExportModule = {
|
|
|
9667
9833
|
let renderBounds, trimBounds, scaleX = 1, scaleY = 1;
|
|
9668
9834
|
const { worldTransform, isLeafer, isFrame } = leaf;
|
|
9669
9835
|
const { slice, trim, onCanvas } = options;
|
|
9670
|
-
|
|
9671
|
-
|
|
9836
|
+
let scale = options.scale || 1;
|
|
9837
|
+
let pixelRatio = options.pixelRatio || 1;
|
|
9838
|
+
if (leaf.isApp) {
|
|
9839
|
+
scale *= pixelRatio;
|
|
9840
|
+
pixelRatio = leaf.app.pixelRatio;
|
|
9841
|
+
}
|
|
9672
9842
|
const screenshot = options.screenshot || leaf.isApp;
|
|
9673
9843
|
const fill = (isLeafer && screenshot) ? (options.fill === undefined ? leaf.fill : options.fill) : options.fill;
|
|
9674
9844
|
const needFill = FileHelper.isOpaqueImage(filename) || fill, matrix = new Matrix();
|
|
@@ -9798,4 +9968,4 @@ Object.assign(Export, ExportModule);
|
|
|
9798
9968
|
|
|
9799
9969
|
useCanvas();
|
|
9800
9970
|
|
|
9801
|
-
export { AnimateEvent, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, DataHelper, Debug, Direction4, Direction9, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Export, FileHelper, Frame, FrameData, Group, GroupData, Image, ImageData, ImageEvent, ImageManager, IncrementId, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, Line, LineData, MathHelper, Matrix, MatrixHelper, 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, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Run, Star, StarData, State, StringNumberMap, TaskItem, TaskProcessor, Text, TextConvert, TextData, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, 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 };
|
|
9971
|
+
export { AlignHelper, AnimateEvent, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, DataHelper, Debug, Direction4, Direction9, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Export, FileHelper, Frame, FrameData, Group, GroupData, Image, ImageData, ImageEvent, ImageManager, IncrementId, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, Line, LineData, MathHelper, Matrix, MatrixHelper, 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, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Run, Star, StarData, State, StringNumberMap, TaskItem, TaskProcessor, Text, TextConvert, TextData, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, 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 };
|