leafer-ui 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/README.md +1 -1
- package/dist/web.esm.js +81 -61
- package/dist/web.esm.min.js +1 -1
- package/dist/web.js +534 -346
- package/dist/web.min.js +1 -1
- package/dist/web.module.js +532 -347
- package/dist/web.module.min.js +1 -1
- package/package.json +11 -11
package/dist/web.js
CHANGED
|
@@ -6,7 +6,7 @@ var LeaferUI = (function (exports) {
|
|
|
6
6
|
hitCanvasSize: 100,
|
|
7
7
|
maxCacheSize: 2560 * 1600,
|
|
8
8
|
maxPatternSize: 4096 * 2160,
|
|
9
|
-
suffix: '
|
|
9
|
+
suffix: '',
|
|
10
10
|
crossOrigin: 'anonymous'
|
|
11
11
|
}
|
|
12
12
|
};
|
|
@@ -36,24 +36,12 @@ var LeaferUI = (function (exports) {
|
|
|
36
36
|
const { round, pow: pow$1, PI: PI$4 } = Math;
|
|
37
37
|
const MathHelper = {
|
|
38
38
|
within(value, min, max) {
|
|
39
|
-
if (value < min)
|
|
39
|
+
if (min !== undefined && value < min)
|
|
40
40
|
value = min;
|
|
41
|
-
if (value > max)
|
|
41
|
+
if (max !== undefined && value > max)
|
|
42
42
|
value = max;
|
|
43
43
|
return value;
|
|
44
44
|
},
|
|
45
|
-
minus(value, isFourNumber) {
|
|
46
|
-
if (value instanceof Array) {
|
|
47
|
-
if (isFourNumber)
|
|
48
|
-
value = MathHelper.fourNumber(value, 0);
|
|
49
|
-
for (let i = 0; i < value.length; i++)
|
|
50
|
-
value[i] = -value[i];
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
value = -value;
|
|
54
|
-
}
|
|
55
|
-
return value;
|
|
56
|
-
},
|
|
57
45
|
fourNumber(num, maxValue) {
|
|
58
46
|
let data;
|
|
59
47
|
if (num instanceof Array) {
|
|
@@ -150,9 +138,11 @@ var LeaferUI = (function (exports) {
|
|
|
150
138
|
t.e += x;
|
|
151
139
|
t.f += y;
|
|
152
140
|
},
|
|
153
|
-
translateInner(t, x, y) {
|
|
141
|
+
translateInner(t, x, y, isMoveOrigin) {
|
|
154
142
|
t.e += t.a * x + t.c * y;
|
|
155
143
|
t.f += t.b * x + t.d * y;
|
|
144
|
+
if (isMoveOrigin)
|
|
145
|
+
t.e -= x, t.f -= y;
|
|
156
146
|
},
|
|
157
147
|
scale(t, scaleX, scaleY = scaleX) {
|
|
158
148
|
t.a *= scaleX;
|
|
@@ -219,8 +209,10 @@ var LeaferUI = (function (exports) {
|
|
|
219
209
|
t.e = child.e * a + child.f * c + e;
|
|
220
210
|
t.f = child.e * b + child.f * d + f;
|
|
221
211
|
},
|
|
222
|
-
multiplyParent(t, parent, to, abcdChanged, childScaleData) {
|
|
223
|
-
|
|
212
|
+
multiplyParent(t, parent, to, abcdChanged, childScaleData, scrollData) {
|
|
213
|
+
let { e, f } = t;
|
|
214
|
+
if (scrollData)
|
|
215
|
+
e += scrollData.scrollX, f += scrollData.scrollY;
|
|
224
216
|
to || (to = t);
|
|
225
217
|
if (abcdChanged === undefined)
|
|
226
218
|
abcdChanged = t.a !== 1 || t.b || t.c || t.d !== 1;
|
|
@@ -341,7 +333,7 @@ var LeaferUI = (function (exports) {
|
|
|
341
333
|
t.e = x;
|
|
342
334
|
t.f = y;
|
|
343
335
|
if (origin)
|
|
344
|
-
M$6.translateInner(t, -origin.x, -origin.y);
|
|
336
|
+
M$6.translateInner(t, -origin.x, -origin.y, true);
|
|
345
337
|
},
|
|
346
338
|
getLayout(t, origin, firstSkewY) {
|
|
347
339
|
const { a, b, c, d, e, f } = t;
|
|
@@ -761,7 +753,7 @@ var LeaferUI = (function (exports) {
|
|
|
761
753
|
const { floor, ceil: ceil$2 } = Math;
|
|
762
754
|
let right$1, bottom$1, boundsRight, boundsBottom;
|
|
763
755
|
const point = {};
|
|
764
|
-
const toPoint$
|
|
756
|
+
const toPoint$5 = {};
|
|
765
757
|
const BoundsHelper = {
|
|
766
758
|
tempBounds: {},
|
|
767
759
|
set(t, x = 0, y = 0, width = 0, height = 0) {
|
|
@@ -776,15 +768,17 @@ var LeaferUI = (function (exports) {
|
|
|
776
768
|
t.width = bounds.width;
|
|
777
769
|
t.height = bounds.height;
|
|
778
770
|
},
|
|
779
|
-
copyAndSpread(t, bounds,
|
|
780
|
-
if (
|
|
781
|
-
const four = fourNumber(
|
|
782
|
-
|
|
771
|
+
copyAndSpread(t, bounds, spread, isShrink) {
|
|
772
|
+
if (spread instanceof Array) {
|
|
773
|
+
const four = fourNumber(spread);
|
|
774
|
+
isShrink
|
|
775
|
+
? B.set(t, bounds.x + four[3], bounds.y + four[0], bounds.width - four[1] - four[3], bounds.height - four[2] - four[0])
|
|
776
|
+
: B.set(t, bounds.x - four[3], bounds.y - four[0], bounds.width + four[1] + four[3], bounds.height + four[2] + four[0]);
|
|
783
777
|
}
|
|
784
778
|
else {
|
|
785
|
-
if (
|
|
786
|
-
|
|
787
|
-
B.set(t, bounds.x -
|
|
779
|
+
if (isShrink)
|
|
780
|
+
spread = -spread;
|
|
781
|
+
B.set(t, bounds.x - spread, bounds.y - spread, bounds.width + spread * 2, bounds.height + spread * 2);
|
|
788
782
|
}
|
|
789
783
|
},
|
|
790
784
|
minX(t) { return t.width > 0 ? t.x : t.x + t.width; },
|
|
@@ -861,17 +855,17 @@ var LeaferUI = (function (exports) {
|
|
|
861
855
|
else {
|
|
862
856
|
point.x = t.x;
|
|
863
857
|
point.y = t.y;
|
|
864
|
-
toOuterPoint$1(matrix, point, toPoint$
|
|
865
|
-
setPoint$3(tempPointBounds$1, toPoint$
|
|
858
|
+
toOuterPoint$1(matrix, point, toPoint$5);
|
|
859
|
+
setPoint$3(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
|
|
866
860
|
point.x = t.x + t.width;
|
|
867
|
-
toOuterPoint$1(matrix, point, toPoint$
|
|
868
|
-
addPoint$3(tempPointBounds$1, toPoint$
|
|
861
|
+
toOuterPoint$1(matrix, point, toPoint$5);
|
|
862
|
+
addPoint$3(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
|
|
869
863
|
point.y = t.y + t.height;
|
|
870
|
-
toOuterPoint$1(matrix, point, toPoint$
|
|
871
|
-
addPoint$3(tempPointBounds$1, toPoint$
|
|
864
|
+
toOuterPoint$1(matrix, point, toPoint$5);
|
|
865
|
+
addPoint$3(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
|
|
872
866
|
point.x = t.x;
|
|
873
|
-
toOuterPoint$1(matrix, point, toPoint$
|
|
874
|
-
addPoint$3(tempPointBounds$1, toPoint$
|
|
867
|
+
toOuterPoint$1(matrix, point, toPoint$5);
|
|
868
|
+
addPoint$3(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
|
|
875
869
|
toBounds$4(tempPointBounds$1, to);
|
|
876
870
|
}
|
|
877
871
|
},
|
|
@@ -884,13 +878,16 @@ var LeaferUI = (function (exports) {
|
|
|
884
878
|
const scale = Math.min(baseScale, Math.min(t.width / put.width, t.height / put.height));
|
|
885
879
|
return new Matrix(scale, 0, 0, scale, -put.x * scale, -put.y * scale);
|
|
886
880
|
},
|
|
887
|
-
getSpread(t,
|
|
881
|
+
getSpread(t, spread) {
|
|
888
882
|
const n = {};
|
|
889
|
-
B.copyAndSpread(n, t,
|
|
883
|
+
B.copyAndSpread(n, t, spread);
|
|
890
884
|
return n;
|
|
891
885
|
},
|
|
892
|
-
spread(t,
|
|
893
|
-
B.copyAndSpread(t, t,
|
|
886
|
+
spread(t, spread) {
|
|
887
|
+
B.copyAndSpread(t, t, spread);
|
|
888
|
+
},
|
|
889
|
+
shrink(t, shrink) {
|
|
890
|
+
B.copyAndSpread(t, t, shrink, true);
|
|
894
891
|
},
|
|
895
892
|
ceil(t) {
|
|
896
893
|
const { x, y } = t;
|
|
@@ -1070,12 +1067,12 @@ var LeaferUI = (function (exports) {
|
|
|
1070
1067
|
getFitMatrix(put, baseScale) {
|
|
1071
1068
|
return BoundsHelper.getFitMatrix(this, put, baseScale);
|
|
1072
1069
|
}
|
|
1073
|
-
spread(fourNumber
|
|
1074
|
-
BoundsHelper.spread(this, fourNumber
|
|
1070
|
+
spread(fourNumber) {
|
|
1071
|
+
BoundsHelper.spread(this, fourNumber);
|
|
1075
1072
|
return this;
|
|
1076
1073
|
}
|
|
1077
1074
|
shrink(fourNumber) {
|
|
1078
|
-
BoundsHelper.
|
|
1075
|
+
BoundsHelper.shrink(this, fourNumber);
|
|
1079
1076
|
return this;
|
|
1080
1077
|
}
|
|
1081
1078
|
ceil() {
|
|
@@ -1192,6 +1189,10 @@ var LeaferUI = (function (exports) {
|
|
|
1192
1189
|
Direction9[Direction9["bottomLeft"] = 6] = "bottomLeft";
|
|
1193
1190
|
Direction9[Direction9["left"] = 7] = "left";
|
|
1194
1191
|
Direction9[Direction9["center"] = 8] = "center";
|
|
1192
|
+
Direction9[Direction9["top-left"] = 0] = "top-left";
|
|
1193
|
+
Direction9[Direction9["top-right"] = 2] = "top-right";
|
|
1194
|
+
Direction9[Direction9["bottom-right"] = 4] = "bottom-right";
|
|
1195
|
+
Direction9[Direction9["bottom-left"] = 6] = "bottom-left";
|
|
1195
1196
|
})(exports.Direction9 || (exports.Direction9 = {}));
|
|
1196
1197
|
|
|
1197
1198
|
const directionData = [
|
|
@@ -1205,6 +1206,7 @@ var LeaferUI = (function (exports) {
|
|
|
1205
1206
|
{ x: 0, y: 0.5 },
|
|
1206
1207
|
{ x: 0.5, y: 0.5 }
|
|
1207
1208
|
];
|
|
1209
|
+
directionData.forEach(item => item.type = 'percent');
|
|
1208
1210
|
const AroundHelper = {
|
|
1209
1211
|
directionData,
|
|
1210
1212
|
tempPoint: {},
|
|
@@ -1212,15 +1214,19 @@ var LeaferUI = (function (exports) {
|
|
|
1212
1214
|
toPoint(around, bounds, to, onlySize, pointBounds) {
|
|
1213
1215
|
to || (to = {});
|
|
1214
1216
|
const point = get$5(around);
|
|
1215
|
-
to.x = point.x
|
|
1216
|
-
to.y = point.y
|
|
1217
|
-
if (
|
|
1218
|
-
to.x
|
|
1219
|
-
to.y
|
|
1220
|
-
if (
|
|
1221
|
-
to.x -=
|
|
1222
|
-
|
|
1223
|
-
|
|
1217
|
+
to.x = point.x;
|
|
1218
|
+
to.y = point.y;
|
|
1219
|
+
if (point.type === 'percent') {
|
|
1220
|
+
to.x *= bounds.width;
|
|
1221
|
+
to.y *= bounds.height;
|
|
1222
|
+
if (pointBounds) {
|
|
1223
|
+
to.x -= pointBounds.x;
|
|
1224
|
+
to.y -= pointBounds.y;
|
|
1225
|
+
if (point.x)
|
|
1226
|
+
to.x -= (point.x === 1) ? pointBounds.width : (point.x === 0.5 ? point.x * pointBounds.width : 0);
|
|
1227
|
+
if (point.y)
|
|
1228
|
+
to.y -= (point.y === 1) ? pointBounds.height : (point.y === 0.5 ? point.y * pointBounds.height : 0);
|
|
1229
|
+
}
|
|
1224
1230
|
}
|
|
1225
1231
|
if (!onlySize) {
|
|
1226
1232
|
to.x += bounds.x;
|
|
@@ -1232,6 +1238,13 @@ var LeaferUI = (function (exports) {
|
|
|
1232
1238
|
return typeof around === 'string' ? directionData[exports.Direction9[around]] : around;
|
|
1233
1239
|
}
|
|
1234
1240
|
|
|
1241
|
+
const { toPoint: toPoint$4 } = AroundHelper;
|
|
1242
|
+
const AlignHelper = {
|
|
1243
|
+
toPoint(align, contentBounds, bounds, to, onlySize) {
|
|
1244
|
+
toPoint$4(align, bounds, to, onlySize, contentBounds);
|
|
1245
|
+
}
|
|
1246
|
+
};
|
|
1247
|
+
|
|
1235
1248
|
const StringNumberMap = {
|
|
1236
1249
|
'0': 1,
|
|
1237
1250
|
'1': 1,
|
|
@@ -1464,13 +1477,21 @@ var LeaferUI = (function (exports) {
|
|
|
1464
1477
|
},
|
|
1465
1478
|
clone(data) {
|
|
1466
1479
|
return JSON.parse(JSON.stringify(data));
|
|
1480
|
+
},
|
|
1481
|
+
toMap(list) {
|
|
1482
|
+
const map = {};
|
|
1483
|
+
for (let i = 0, len = list.length; i < len; i++)
|
|
1484
|
+
map[list[i]] = true;
|
|
1485
|
+
return map;
|
|
1467
1486
|
}
|
|
1468
1487
|
};
|
|
1469
1488
|
const { assign } = DataHelper;
|
|
1470
1489
|
|
|
1471
1490
|
class LeafData {
|
|
1491
|
+
get __useNaturalRatio() { return true; }
|
|
1492
|
+
get __isLinePath() { return this.path && this.path.length === 6; }
|
|
1472
1493
|
get __blendMode() {
|
|
1473
|
-
if (this.eraser)
|
|
1494
|
+
if (this.eraser && this.eraser !== 'path')
|
|
1474
1495
|
return 'destination-out';
|
|
1475
1496
|
const { blendMode } = this;
|
|
1476
1497
|
return blendMode === 'pass-through' ? null : blendMode;
|
|
@@ -1966,6 +1987,11 @@ var LeaferUI = (function (exports) {
|
|
|
1966
1987
|
}
|
|
1967
1988
|
updateViewSize() { }
|
|
1968
1989
|
updateClientBounds() { }
|
|
1990
|
+
getClientBounds(update) {
|
|
1991
|
+
if (update)
|
|
1992
|
+
this.updateClientBounds();
|
|
1993
|
+
return this.clientBounds || this.bounds;
|
|
1994
|
+
}
|
|
1969
1995
|
startAutoLayout(_autoBounds, _listener) { }
|
|
1970
1996
|
stopAutoLayout() { }
|
|
1971
1997
|
setCursor(_cursor) { }
|
|
@@ -2100,7 +2126,7 @@ var LeaferUI = (function (exports) {
|
|
|
2100
2126
|
}
|
|
2101
2127
|
clear() {
|
|
2102
2128
|
const { pixelRatio } = this;
|
|
2103
|
-
this.clearRect(0, 0, this.width * pixelRatio, this.height * pixelRatio);
|
|
2129
|
+
this.clearRect(0, 0, this.width * pixelRatio + 2, this.height * pixelRatio + 2);
|
|
2104
2130
|
}
|
|
2105
2131
|
isSameSize(size) {
|
|
2106
2132
|
return this.width === size.width && this.height === size.height && this.pixelRatio === size.pixelRatio;
|
|
@@ -2217,7 +2243,7 @@ var LeaferUI = (function (exports) {
|
|
|
2217
2243
|
|
|
2218
2244
|
const { sin: sin$3, cos: cos$3, atan2: atan2$1, ceil: ceil$1, abs: abs$3, PI: PI$2, sqrt: sqrt$1, pow } = Math;
|
|
2219
2245
|
const { setPoint: setPoint$2, addPoint: addPoint$2 } = TwoPointBoundsHelper;
|
|
2220
|
-
const { set
|
|
2246
|
+
const { set } = PointHelper;
|
|
2221
2247
|
const { M: M$5, L: L$6, C: C$5, Q: Q$4, Z: Z$5 } = PathCommandMap;
|
|
2222
2248
|
const tempPoint$2 = {};
|
|
2223
2249
|
const BezierHelper = {
|
|
@@ -2295,9 +2321,9 @@ var LeaferUI = (function (exports) {
|
|
|
2295
2321
|
addPoint$2(setPointBounds, x1, y1);
|
|
2296
2322
|
}
|
|
2297
2323
|
if (setStartPoint)
|
|
2298
|
-
set
|
|
2324
|
+
set(setStartPoint, fromX, fromY);
|
|
2299
2325
|
if (setEndPoint)
|
|
2300
|
-
set
|
|
2326
|
+
set(setEndPoint, x1, y1);
|
|
2301
2327
|
return;
|
|
2302
2328
|
}
|
|
2303
2329
|
const anticlockwise = BAx * CBy - CBx * BAy < 0;
|
|
@@ -2346,7 +2372,7 @@ var LeaferUI = (function (exports) {
|
|
|
2346
2372
|
if (setPointBounds)
|
|
2347
2373
|
setPoint$2(setPointBounds, fromX, fromY);
|
|
2348
2374
|
if (setStartPoint)
|
|
2349
|
-
set
|
|
2375
|
+
set(setStartPoint, fromX, fromY);
|
|
2350
2376
|
for (let i = 0; i < parts; i++) {
|
|
2351
2377
|
endCos = cos$3(endRadian);
|
|
2352
2378
|
endSin = sin$3(endRadian);
|
|
@@ -2368,7 +2394,7 @@ var LeaferUI = (function (exports) {
|
|
|
2368
2394
|
endRadian += partRadian;
|
|
2369
2395
|
}
|
|
2370
2396
|
if (setEndPoint)
|
|
2371
|
-
set
|
|
2397
|
+
set(setEndPoint, cx + x, cy + y);
|
|
2372
2398
|
},
|
|
2373
2399
|
quadraticCurveTo(data, fromX, fromY, x1, y1, toX, toY) {
|
|
2374
2400
|
data.push(C$5, (fromX + 2 * x1) / 3, (fromY + 2 * y1) / 3, (toX + 2 * x1) / 3, (toY + 2 * y1) / 3, toX, toY);
|
|
@@ -2514,11 +2540,15 @@ var LeaferUI = (function (exports) {
|
|
|
2514
2540
|
char = pathString[i];
|
|
2515
2541
|
if (StringNumberMap[char]) {
|
|
2516
2542
|
if (char === '.') {
|
|
2517
|
-
current.dot
|
|
2518
|
-
if (current.dot > 1) {
|
|
2543
|
+
if (current.dot) {
|
|
2519
2544
|
pushData(data, num);
|
|
2520
2545
|
num = '';
|
|
2521
2546
|
}
|
|
2547
|
+
current.dot++;
|
|
2548
|
+
}
|
|
2549
|
+
if (num === '0' && char !== '.') {
|
|
2550
|
+
pushData(data, num);
|
|
2551
|
+
num = '';
|
|
2522
2552
|
}
|
|
2523
2553
|
num += char;
|
|
2524
2554
|
}
|
|
@@ -3608,7 +3638,9 @@ var LeaferUI = (function (exports) {
|
|
|
3608
3638
|
}
|
|
3609
3639
|
}
|
|
3610
3640
|
|
|
3611
|
-
function defineKey(target, key, descriptor) {
|
|
3641
|
+
function defineKey(target, key, descriptor, noConfigurable) {
|
|
3642
|
+
if (!noConfigurable)
|
|
3643
|
+
descriptor.configurable = descriptor.enumerable = true;
|
|
3612
3644
|
Object.defineProperty(target, key, descriptor);
|
|
3613
3645
|
}
|
|
3614
3646
|
function getDescriptor(object, name) {
|
|
@@ -3627,9 +3659,7 @@ var LeaferUI = (function (exports) {
|
|
|
3627
3659
|
function defineLeafAttr(target, key, defaultValue, partDescriptor) {
|
|
3628
3660
|
const defaultDescriptor = {
|
|
3629
3661
|
get() { return this.__getAttr(key); },
|
|
3630
|
-
set(value) { this.__setAttr(key, value); }
|
|
3631
|
-
configurable: true,
|
|
3632
|
-
enumerable: true
|
|
3662
|
+
set(value) { this.__setAttr(key, value); }
|
|
3633
3663
|
};
|
|
3634
3664
|
defineKey(target, key, Object.assign(defaultDescriptor, partDescriptor || {}));
|
|
3635
3665
|
defineDataProcessor(target, key, defaultValue);
|
|
@@ -3640,35 +3670,33 @@ var LeaferUI = (function (exports) {
|
|
|
3640
3670
|
function positionType(defaultValue, checkFiniteNumber) {
|
|
3641
3671
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3642
3672
|
set(value) {
|
|
3643
|
-
this.__setAttr(key, value, checkFiniteNumber);
|
|
3644
|
-
this.__layout.matrixChanged || this.__layout.matrixChange();
|
|
3673
|
+
this.__setAttr(key, value, checkFiniteNumber) && (this.__layout.matrixChanged || this.__layout.matrixChange());
|
|
3645
3674
|
}
|
|
3646
3675
|
}));
|
|
3647
3676
|
}
|
|
3648
3677
|
function autoLayoutType(defaultValue) {
|
|
3649
3678
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3650
3679
|
set(value) {
|
|
3651
|
-
this.__setAttr(key, value)
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3680
|
+
if (this.__setAttr(key, value)) {
|
|
3681
|
+
this.__layout.matrixChanged || this.__layout.matrixChange();
|
|
3682
|
+
this.__hasAutoLayout = !!value;
|
|
3683
|
+
if (!this.__local)
|
|
3684
|
+
this.__layout.createLocal();
|
|
3685
|
+
}
|
|
3656
3686
|
}
|
|
3657
3687
|
}));
|
|
3658
3688
|
}
|
|
3659
3689
|
function scaleType(defaultValue, checkFiniteNumber) {
|
|
3660
3690
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3661
3691
|
set(value) {
|
|
3662
|
-
this.__setAttr(key, value, checkFiniteNumber);
|
|
3663
|
-
this.__layout.scaleChanged || this.__layout.scaleChange();
|
|
3692
|
+
this.__setAttr(key, value, checkFiniteNumber) && (this.__layout.scaleChanged || this.__layout.scaleChange());
|
|
3664
3693
|
}
|
|
3665
3694
|
}));
|
|
3666
3695
|
}
|
|
3667
3696
|
function rotationType(defaultValue, checkFiniteNumber) {
|
|
3668
3697
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3669
3698
|
set(value) {
|
|
3670
|
-
this.__setAttr(key, value, checkFiniteNumber);
|
|
3671
|
-
this.__layout.rotationChanged || this.__layout.rotationChange();
|
|
3699
|
+
this.__setAttr(key, value, checkFiniteNumber) && (this.__layout.rotationChanged || this.__layout.rotationChange());
|
|
3672
3700
|
}
|
|
3673
3701
|
}));
|
|
3674
3702
|
}
|
|
@@ -3682,9 +3710,7 @@ var LeaferUI = (function (exports) {
|
|
|
3682
3710
|
function naturalBoundsType(defaultValue) {
|
|
3683
3711
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3684
3712
|
set(value) {
|
|
3685
|
-
this.__setAttr(key, value);
|
|
3686
|
-
doBoundsType(this);
|
|
3687
|
-
this.__.__removeNaturalSize();
|
|
3713
|
+
this.__setAttr(key, value) && (doBoundsType(this), this.__.__removeNaturalSize());
|
|
3688
3714
|
}
|
|
3689
3715
|
}));
|
|
3690
3716
|
}
|
|
@@ -3696,8 +3722,11 @@ var LeaferUI = (function (exports) {
|
|
|
3696
3722
|
function pathInputType(defaultValue) {
|
|
3697
3723
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3698
3724
|
set(value) {
|
|
3699
|
-
|
|
3700
|
-
|
|
3725
|
+
const data = this.__;
|
|
3726
|
+
if (data.__pathInputed !== 2)
|
|
3727
|
+
data.__pathInputed = value ? 1 : 0;
|
|
3728
|
+
if (!value)
|
|
3729
|
+
data.__pathForRender = undefined;
|
|
3701
3730
|
this.__setAttr(key, value);
|
|
3702
3731
|
doBoundsType(this);
|
|
3703
3732
|
}
|
|
@@ -3728,54 +3757,66 @@ var LeaferUI = (function (exports) {
|
|
|
3728
3757
|
function surfaceType(defaultValue) {
|
|
3729
3758
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3730
3759
|
set(value) {
|
|
3731
|
-
this.__setAttr(key, value);
|
|
3732
|
-
this.__layout.surfaceChanged || this.__layout.surfaceChange();
|
|
3760
|
+
this.__setAttr(key, value) && (this.__layout.surfaceChanged || this.__layout.surfaceChange());
|
|
3733
3761
|
}
|
|
3734
3762
|
}));
|
|
3735
3763
|
}
|
|
3736
3764
|
function opacityType(defaultValue) {
|
|
3737
3765
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3738
3766
|
set(value) {
|
|
3739
|
-
this.__setAttr(key, value);
|
|
3740
|
-
|
|
3767
|
+
this.__setAttr(key, value) && (this.__layout.opacityChanged || this.__layout.opacityChange());
|
|
3768
|
+
}
|
|
3769
|
+
}));
|
|
3770
|
+
}
|
|
3771
|
+
function visibleType(defaultValue) {
|
|
3772
|
+
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3773
|
+
set(value) {
|
|
3774
|
+
const oldValue = this.visible;
|
|
3775
|
+
if (this.__setAttr(key, value)) {
|
|
3776
|
+
this.__layout.opacityChanged || this.__layout.opacityChange();
|
|
3777
|
+
if (oldValue === 0 || value === 0)
|
|
3778
|
+
doBoundsType(this);
|
|
3779
|
+
}
|
|
3741
3780
|
}
|
|
3742
3781
|
}));
|
|
3743
3782
|
}
|
|
3744
3783
|
function sortType(defaultValue) {
|
|
3745
3784
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3746
3785
|
set(value) {
|
|
3747
|
-
this.__setAttr(key, value)
|
|
3748
|
-
|
|
3749
|
-
|
|
3786
|
+
if (this.__setAttr(key, value)) {
|
|
3787
|
+
this.__layout.surfaceChanged || this.__layout.surfaceChange();
|
|
3788
|
+
this.waitParent(() => { this.parent.__layout.childrenSortChange(); });
|
|
3789
|
+
}
|
|
3750
3790
|
}
|
|
3751
3791
|
}));
|
|
3752
3792
|
}
|
|
3753
3793
|
function maskType(defaultValue) {
|
|
3754
3794
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3755
3795
|
set(value) {
|
|
3756
|
-
this.__setAttr(key, value)
|
|
3757
|
-
|
|
3758
|
-
|
|
3796
|
+
if (this.__setAttr(key, value)) {
|
|
3797
|
+
this.__layout.boxChanged || this.__layout.boxChange();
|
|
3798
|
+
this.waitParent(() => { this.parent.__updateMask(value); });
|
|
3799
|
+
}
|
|
3759
3800
|
}
|
|
3760
3801
|
}));
|
|
3761
3802
|
}
|
|
3762
3803
|
function eraserType(defaultValue) {
|
|
3763
3804
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3764
3805
|
set(value) {
|
|
3765
|
-
this.__setAttr(key, value);
|
|
3766
|
-
this.waitParent(() => { this.parent.__updateEraser(value); });
|
|
3806
|
+
this.__setAttr(key, value) && this.waitParent(() => { this.parent.__updateEraser(value); });
|
|
3767
3807
|
}
|
|
3768
3808
|
}));
|
|
3769
3809
|
}
|
|
3770
3810
|
function hitType(defaultValue) {
|
|
3771
3811
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3772
3812
|
set(value) {
|
|
3773
|
-
this.__setAttr(key, value)
|
|
3774
|
-
|
|
3775
|
-
|
|
3813
|
+
if (this.__setAttr(key, value)) {
|
|
3814
|
+
if (Debug.showHitView) {
|
|
3815
|
+
this.__layout.surfaceChanged || this.__layout.surfaceChange();
|
|
3816
|
+
}
|
|
3817
|
+
if (this.leafer)
|
|
3818
|
+
this.leafer.updateCursor();
|
|
3776
3819
|
}
|
|
3777
|
-
if (this.leafer)
|
|
3778
|
-
this.leafer.updateCursor();
|
|
3779
3820
|
}
|
|
3780
3821
|
}));
|
|
3781
3822
|
}
|
|
@@ -3816,9 +3857,7 @@ var LeaferUI = (function (exports) {
|
|
|
3816
3857
|
},
|
|
3817
3858
|
set(value) {
|
|
3818
3859
|
this[computedKey] = value;
|
|
3819
|
-
}
|
|
3820
|
-
configurable: true,
|
|
3821
|
-
enumerable: true
|
|
3860
|
+
}
|
|
3822
3861
|
};
|
|
3823
3862
|
if (defaultValue === undefined) {
|
|
3824
3863
|
property.get = function () { return this[computedKey]; };
|
|
@@ -3826,13 +3865,25 @@ var LeaferUI = (function (exports) {
|
|
|
3826
3865
|
else if (key === 'width') {
|
|
3827
3866
|
property.get = function () {
|
|
3828
3867
|
const v = this[computedKey];
|
|
3829
|
-
|
|
3868
|
+
if (v === undefined) {
|
|
3869
|
+
const t = this;
|
|
3870
|
+
return t._height && t.__naturalWidth && t.__useNaturalRatio ? t._height * t.__naturalWidth / t.__naturalHeight : t.__naturalWidth || defaultValue;
|
|
3871
|
+
}
|
|
3872
|
+
else {
|
|
3873
|
+
return v;
|
|
3874
|
+
}
|
|
3830
3875
|
};
|
|
3831
3876
|
}
|
|
3832
3877
|
else if (key === 'height') {
|
|
3833
3878
|
property.get = function () {
|
|
3834
3879
|
const v = this[computedKey];
|
|
3835
|
-
|
|
3880
|
+
if (v === undefined) {
|
|
3881
|
+
const t = this;
|
|
3882
|
+
return t._width && t.__naturalHeight && t.__useNaturalRatio ? t._width * t.__naturalHeight / t.__naturalWidth : t.__naturalHeight || defaultValue;
|
|
3883
|
+
}
|
|
3884
|
+
else {
|
|
3885
|
+
return v;
|
|
3886
|
+
}
|
|
3836
3887
|
};
|
|
3837
3888
|
}
|
|
3838
3889
|
let descriptor, find = data;
|
|
@@ -3846,7 +3897,7 @@ var LeaferUI = (function (exports) {
|
|
|
3846
3897
|
property.set = data[setMethodName];
|
|
3847
3898
|
delete data[setMethodName];
|
|
3848
3899
|
}
|
|
3849
|
-
|
|
3900
|
+
defineKey(data, key, property);
|
|
3850
3901
|
}
|
|
3851
3902
|
|
|
3852
3903
|
const debug$9 = new Debug('rewrite');
|
|
@@ -4047,13 +4098,6 @@ var LeaferUI = (function (exports) {
|
|
|
4047
4098
|
return true;
|
|
4048
4099
|
p = p.parent;
|
|
4049
4100
|
}
|
|
4050
|
-
},
|
|
4051
|
-
hasParentAutoLayout(p) {
|
|
4052
|
-
while (p.parent) {
|
|
4053
|
-
p = p.parent;
|
|
4054
|
-
if (p.__hasAutoLayout)
|
|
4055
|
-
return true;
|
|
4056
|
-
}
|
|
4057
4101
|
}
|
|
4058
4102
|
};
|
|
4059
4103
|
const L = LeafHelper;
|
|
@@ -4073,13 +4117,13 @@ var LeaferUI = (function (exports) {
|
|
|
4073
4117
|
return target.__world;
|
|
4074
4118
|
},
|
|
4075
4119
|
localBoxBounds(target) {
|
|
4076
|
-
return target.__.eraser ? null : (target.__local || target.__layout);
|
|
4120
|
+
return target.__.eraser || target.__.visible === 0 ? null : (target.__local || target.__layout);
|
|
4077
4121
|
},
|
|
4078
4122
|
localStrokeBounds(target) {
|
|
4079
|
-
return target.__.eraser ? null : target.__layout.localStrokeBounds;
|
|
4123
|
+
return target.__.eraser || target.__.visible === 0 ? null : target.__layout.localStrokeBounds;
|
|
4080
4124
|
},
|
|
4081
4125
|
localRenderBounds(target) {
|
|
4082
|
-
return target.__.eraser ? null : target.__layout.localRenderBounds;
|
|
4126
|
+
return target.__.eraser || target.__.visible === 0 ? null : target.__layout.localRenderBounds;
|
|
4083
4127
|
},
|
|
4084
4128
|
maskLocalBoxBounds(target) {
|
|
4085
4129
|
return target.__.mask ? target.__localBoxBounds : null;
|
|
@@ -4185,11 +4229,19 @@ var LeaferUI = (function (exports) {
|
|
|
4185
4229
|
|
|
4186
4230
|
const { getRelativeWorld: getRelativeWorld$1 } = LeafHelper;
|
|
4187
4231
|
const { toOuterOf: toOuterOf$2, getPoints, copy: copy$6 } = BoundsHelper;
|
|
4232
|
+
const localContent = '_localContentBounds';
|
|
4233
|
+
const worldContent = '_worldContentBounds', worldBox = '_worldBoxBounds', worldStroke = '_worldStrokeBounds';
|
|
4188
4234
|
class LeafLayout {
|
|
4235
|
+
get contentBounds() { return this._contentBounds || this.boxBounds; }
|
|
4236
|
+
set contentBounds(bounds) { this._contentBounds = bounds; }
|
|
4189
4237
|
get strokeBounds() { return this._strokeBounds || this.boxBounds; }
|
|
4190
4238
|
get renderBounds() { return this._renderBounds || this.boxBounds; }
|
|
4239
|
+
get localContentBounds() { toOuterOf$2(this.contentBounds, this.leaf.__localMatrix, this[localContent] || (this[localContent] = {})); return this[localContent]; }
|
|
4191
4240
|
get localStrokeBounds() { return this._localStrokeBounds || this; }
|
|
4192
4241
|
get localRenderBounds() { return this._localRenderBounds || this; }
|
|
4242
|
+
get worldContentBounds() { toOuterOf$2(this.contentBounds, this.leaf.__world, this[worldContent] || (this[worldContent] = {})); return this[worldContent]; }
|
|
4243
|
+
get worldBoxBounds() { toOuterOf$2(this.boxBounds, this.leaf.__world, this[worldBox] || (this[worldBox] = {})); return this[worldBox]; }
|
|
4244
|
+
get worldStrokeBounds() { toOuterOf$2(this.strokeBounds, this.leaf.__world, this[worldStroke] || (this[worldStroke] = {})); return this[worldStroke]; }
|
|
4193
4245
|
get a() { return 1; }
|
|
4194
4246
|
get b() { return 0; }
|
|
4195
4247
|
get c() { return 0; }
|
|
@@ -4272,7 +4324,6 @@ var LeaferUI = (function (exports) {
|
|
|
4272
4324
|
case 'content':
|
|
4273
4325
|
if (this.contentBounds)
|
|
4274
4326
|
return this.contentBounds;
|
|
4275
|
-
case 'margin':
|
|
4276
4327
|
case 'box':
|
|
4277
4328
|
return this.boxBounds;
|
|
4278
4329
|
case 'stroke':
|
|
@@ -4285,8 +4336,9 @@ var LeaferUI = (function (exports) {
|
|
|
4285
4336
|
return this.localRenderBounds;
|
|
4286
4337
|
case 'stroke':
|
|
4287
4338
|
return this.localStrokeBounds;
|
|
4288
|
-
case 'margin':
|
|
4289
4339
|
case 'content':
|
|
4340
|
+
if (this.contentBounds)
|
|
4341
|
+
return this.localContentBounds;
|
|
4290
4342
|
case 'box':
|
|
4291
4343
|
return this.leaf.__localBoxBounds;
|
|
4292
4344
|
}
|
|
@@ -4295,15 +4347,13 @@ var LeaferUI = (function (exports) {
|
|
|
4295
4347
|
switch (type) {
|
|
4296
4348
|
case 'render':
|
|
4297
4349
|
return this.leaf.__world;
|
|
4350
|
+
case 'stroke':
|
|
4351
|
+
return this.worldStrokeBounds;
|
|
4298
4352
|
case 'content':
|
|
4299
4353
|
if (this.contentBounds)
|
|
4300
|
-
return this.
|
|
4301
|
-
case 'margin':
|
|
4354
|
+
return this.worldContentBounds;
|
|
4302
4355
|
case 'box':
|
|
4303
|
-
return this.
|
|
4304
|
-
case 'margin':
|
|
4305
|
-
case 'stroke':
|
|
4306
|
-
return this.getWorldStrokeBounds();
|
|
4356
|
+
return this.worldBoxBounds;
|
|
4307
4357
|
}
|
|
4308
4358
|
}
|
|
4309
4359
|
getLayoutBounds(type, relative = 'world', unscale) {
|
|
@@ -4366,20 +4416,24 @@ var LeaferUI = (function (exports) {
|
|
|
4366
4416
|
points.forEach(point => leaf.innerToWorld(point, null, false, relativeLeaf));
|
|
4367
4417
|
return points;
|
|
4368
4418
|
}
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
return this._worldContentBounds;
|
|
4419
|
+
shrinkContent() {
|
|
4420
|
+
const { x, y, width, height } = this.boxBounds;
|
|
4421
|
+
this._contentBounds = { x, y, width, height };
|
|
4373
4422
|
}
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4423
|
+
spreadStroke() {
|
|
4424
|
+
const { x, y, width, height } = this.strokeBounds;
|
|
4425
|
+
this._strokeBounds = { x, y, width, height };
|
|
4426
|
+
this._localStrokeBounds = { x, y, width, height };
|
|
4427
|
+
if (!this.renderSpread)
|
|
4428
|
+
this.spreadRenderCancel();
|
|
4378
4429
|
}
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4430
|
+
spreadRender() {
|
|
4431
|
+
const { x, y, width, height } = this.renderBounds;
|
|
4432
|
+
this._renderBounds = { x, y, width, height };
|
|
4433
|
+
this._localRenderBounds = { x, y, width, height };
|
|
4434
|
+
}
|
|
4435
|
+
shrinkContentCancel() {
|
|
4436
|
+
this._contentBounds = undefined;
|
|
4383
4437
|
}
|
|
4384
4438
|
spreadStrokeCancel() {
|
|
4385
4439
|
const same = this.renderBounds === this.strokeBounds;
|
|
@@ -4392,18 +4446,6 @@ var LeaferUI = (function (exports) {
|
|
|
4392
4446
|
this._renderBounds = this._strokeBounds;
|
|
4393
4447
|
this._localRenderBounds = this._localStrokeBounds;
|
|
4394
4448
|
}
|
|
4395
|
-
spreadStroke() {
|
|
4396
|
-
const { x, y, width, height } = this.strokeBounds;
|
|
4397
|
-
this._strokeBounds = { x, y, width, height };
|
|
4398
|
-
this._localStrokeBounds = { x, y, width, height };
|
|
4399
|
-
if (!this.renderSpread)
|
|
4400
|
-
this.spreadRenderCancel();
|
|
4401
|
-
}
|
|
4402
|
-
spreadRender() {
|
|
4403
|
-
const { x, y, width, height } = this.renderBounds;
|
|
4404
|
-
this._renderBounds = { x, y, width, height };
|
|
4405
|
-
this._localRenderBounds = { x, y, width, height };
|
|
4406
|
-
}
|
|
4407
4449
|
boxChange() {
|
|
4408
4450
|
this.boxChanged = true;
|
|
4409
4451
|
this.localBoxChanged || this.localBoxChange();
|
|
@@ -4490,24 +4532,40 @@ var LeaferUI = (function (exports) {
|
|
|
4490
4532
|
});
|
|
4491
4533
|
},
|
|
4492
4534
|
off(type, listener, options) {
|
|
4493
|
-
|
|
4494
|
-
|
|
4495
|
-
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4535
|
+
if (type) {
|
|
4536
|
+
const typeList = typeof type === 'string' ? type.split(' ') : type;
|
|
4537
|
+
if (listener) {
|
|
4538
|
+
let capture;
|
|
4539
|
+
if (options)
|
|
4540
|
+
capture = typeof options === 'boolean' ? options : options.capture;
|
|
4541
|
+
let events, index;
|
|
4542
|
+
const map = __getListenerMap(this, capture);
|
|
4543
|
+
typeList.forEach(type => {
|
|
4544
|
+
if (type) {
|
|
4545
|
+
events = map[type];
|
|
4546
|
+
if (events) {
|
|
4547
|
+
index = events.findIndex(item => item.listener === listener);
|
|
4548
|
+
if (index > -1)
|
|
4549
|
+
events.splice(index, 1);
|
|
4550
|
+
if (!events.length)
|
|
4551
|
+
delete map[type];
|
|
4552
|
+
}
|
|
4553
|
+
}
|
|
4554
|
+
});
|
|
4509
4555
|
}
|
|
4510
|
-
|
|
4556
|
+
else {
|
|
4557
|
+
const { __bubbleMap: b, __captureMap: c } = this;
|
|
4558
|
+
typeList.forEach(type => {
|
|
4559
|
+
if (b)
|
|
4560
|
+
delete b[type];
|
|
4561
|
+
if (c)
|
|
4562
|
+
delete c[type];
|
|
4563
|
+
});
|
|
4564
|
+
}
|
|
4565
|
+
}
|
|
4566
|
+
else {
|
|
4567
|
+
this.__bubbleMap = this.__captureMap = undefined;
|
|
4568
|
+
}
|
|
4511
4569
|
},
|
|
4512
4570
|
on_(type, listener, bind, options) {
|
|
4513
4571
|
if (bind)
|
|
@@ -4771,10 +4829,10 @@ var LeaferUI = (function (exports) {
|
|
|
4771
4829
|
};
|
|
4772
4830
|
|
|
4773
4831
|
const { setLayout, multiplyParent: multiplyParent$1, translateInner, defaultWorld } = MatrixHelper;
|
|
4774
|
-
const { toPoint, tempPoint: tempPoint$1 } = AroundHelper;
|
|
4832
|
+
const { toPoint: toPoint$3, tempPoint: tempPoint$1 } = AroundHelper;
|
|
4775
4833
|
const LeafMatrix = {
|
|
4776
4834
|
__updateWorldMatrix() {
|
|
4777
|
-
multiplyParent$1(this.__local || this.__layout, this.parent ? this.parent.__world : defaultWorld, this.__world, !!this.__layout.affectScaleOrRotation, this.__);
|
|
4835
|
+
multiplyParent$1(this.__local || this.__layout, this.parent ? this.parent.__world : defaultWorld, this.__world, !!this.__layout.affectScaleOrRotation, this.__, this.parent && this.parent.__);
|
|
4778
4836
|
},
|
|
4779
4837
|
__updateLocalMatrix() {
|
|
4780
4838
|
if (this.__local) {
|
|
@@ -4785,18 +4843,18 @@ var LeaferUI = (function (exports) {
|
|
|
4785
4843
|
layout.scaleChanged = layout.rotationChanged = false;
|
|
4786
4844
|
}
|
|
4787
4845
|
}
|
|
4788
|
-
local.e = data.x;
|
|
4789
|
-
local.f = data.y;
|
|
4790
|
-
if (data.around) {
|
|
4791
|
-
toPoint(data.around, layout.boxBounds, tempPoint$1);
|
|
4792
|
-
translateInner(local, -tempPoint$1.x, -tempPoint$1.y);
|
|
4846
|
+
local.e = data.x + data.offsetX;
|
|
4847
|
+
local.f = data.y + data.offsetY;
|
|
4848
|
+
if (data.around || data.origin) {
|
|
4849
|
+
toPoint$3(data.around || data.origin, layout.boxBounds, tempPoint$1);
|
|
4850
|
+
translateInner(local, -tempPoint$1.x, -tempPoint$1.y, data.origin);
|
|
4793
4851
|
}
|
|
4794
4852
|
}
|
|
4795
4853
|
this.__layout.matrixChanged = false;
|
|
4796
4854
|
}
|
|
4797
4855
|
};
|
|
4798
4856
|
|
|
4799
|
-
const { updateMatrix: updateMatrix$1, updateAllMatrix: updateAllMatrix$2
|
|
4857
|
+
const { updateMatrix: updateMatrix$1, updateAllMatrix: updateAllMatrix$2 } = LeafHelper;
|
|
4800
4858
|
const { updateBounds: updateBounds$1 } = BranchHelper;
|
|
4801
4859
|
const { toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$5 } = BoundsHelper;
|
|
4802
4860
|
const { toBounds: toBounds$2 } = PathBounds;
|
|
@@ -4815,7 +4873,6 @@ var LeaferUI = (function (exports) {
|
|
|
4815
4873
|
this.__updatePath();
|
|
4816
4874
|
this.__updateRenderPath();
|
|
4817
4875
|
this.__updateBoxBounds();
|
|
4818
|
-
layout.boxChanged = false;
|
|
4819
4876
|
layout.resized = true;
|
|
4820
4877
|
}
|
|
4821
4878
|
if (layout.localBoxChanged) {
|
|
@@ -4829,12 +4886,12 @@ var LeaferUI = (function (exports) {
|
|
|
4829
4886
|
if (this.parent)
|
|
4830
4887
|
this.parent.__layout.boxChange();
|
|
4831
4888
|
}
|
|
4889
|
+
layout.boxChanged = false;
|
|
4832
4890
|
if (layout.strokeChanged) {
|
|
4833
4891
|
layout.strokeSpread = this.__updateStrokeSpread();
|
|
4834
4892
|
if (layout.strokeSpread) {
|
|
4835
|
-
if (layout.strokeBounds === layout.boxBounds)
|
|
4893
|
+
if (layout.strokeBounds === layout.boxBounds)
|
|
4836
4894
|
layout.spreadStroke();
|
|
4837
|
-
}
|
|
4838
4895
|
this.__updateStrokeBounds();
|
|
4839
4896
|
this.__updateLocalStrokeBounds();
|
|
4840
4897
|
}
|
|
@@ -4842,7 +4899,7 @@ var LeaferUI = (function (exports) {
|
|
|
4842
4899
|
layout.spreadStrokeCancel();
|
|
4843
4900
|
}
|
|
4844
4901
|
layout.strokeChanged = false;
|
|
4845
|
-
if (layout.renderSpread)
|
|
4902
|
+
if (layout.renderSpread || layout.strokeSpread !== layout.strokeBoxSpread)
|
|
4846
4903
|
layout.renderChanged = true;
|
|
4847
4904
|
if (this.parent)
|
|
4848
4905
|
this.parent.__layout.strokeChange();
|
|
@@ -4851,9 +4908,8 @@ var LeaferUI = (function (exports) {
|
|
|
4851
4908
|
if (layout.renderChanged) {
|
|
4852
4909
|
layout.renderSpread = this.__updateRenderSpread();
|
|
4853
4910
|
if (layout.renderSpread) {
|
|
4854
|
-
if (layout.renderBounds === layout.boxBounds || layout.renderBounds === layout.strokeBounds)
|
|
4911
|
+
if (layout.renderBounds === layout.boxBounds || layout.renderBounds === layout.strokeBounds)
|
|
4855
4912
|
layout.spreadRender();
|
|
4856
|
-
}
|
|
4857
4913
|
this.__updateRenderBounds();
|
|
4858
4914
|
this.__updateLocalRenderBounds();
|
|
4859
4915
|
}
|
|
@@ -4893,10 +4949,15 @@ var LeaferUI = (function (exports) {
|
|
|
4893
4949
|
__updateAutoLayout() {
|
|
4894
4950
|
this.__layout.matrixChanged = true;
|
|
4895
4951
|
if (this.isBranch) {
|
|
4896
|
-
if (this.leafer)
|
|
4952
|
+
if (this.leafer && this.leafer.ready)
|
|
4897
4953
|
this.leafer.layouter.addExtra(this);
|
|
4898
|
-
if (
|
|
4899
|
-
|
|
4954
|
+
if (this.__.flow) {
|
|
4955
|
+
if (this.__layout.boxChanged)
|
|
4956
|
+
this.__updateFlowLayout();
|
|
4957
|
+
updateAllMatrix$2(this);
|
|
4958
|
+
updateBounds$1(this, this);
|
|
4959
|
+
if (this.__.__autoSide)
|
|
4960
|
+
this.__updateBoxBounds();
|
|
4900
4961
|
}
|
|
4901
4962
|
else {
|
|
4902
4963
|
updateAllMatrix$2(this);
|
|
@@ -4913,12 +4974,13 @@ var LeaferUI = (function (exports) {
|
|
|
4913
4974
|
data.__naturalHeight = layout.boxBounds.height;
|
|
4914
4975
|
},
|
|
4915
4976
|
__updateStrokeBounds() {
|
|
4916
|
-
|
|
4977
|
+
const layout = this.__layout;
|
|
4978
|
+
copyAndSpread$1(layout.strokeBounds, layout.boxBounds, layout.strokeBoxSpread);
|
|
4917
4979
|
},
|
|
4918
4980
|
__updateRenderBounds() {
|
|
4919
|
-
const
|
|
4920
|
-
renderSpread > 0 ? copyAndSpread$1(renderBounds,
|
|
4921
|
-
}
|
|
4981
|
+
const layout = this.__layout;
|
|
4982
|
+
layout.renderSpread > 0 ? copyAndSpread$1(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$5(layout.renderBounds, layout.strokeBounds);
|
|
4983
|
+
}
|
|
4922
4984
|
};
|
|
4923
4985
|
|
|
4924
4986
|
const LeafRender = {
|
|
@@ -4927,6 +4989,8 @@ var LeaferUI = (function (exports) {
|
|
|
4927
4989
|
canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
|
|
4928
4990
|
canvas.opacity = this.__.opacity;
|
|
4929
4991
|
if (this.__.__single) {
|
|
4992
|
+
if (this.__.eraser === 'path')
|
|
4993
|
+
return this.__renderEraser(canvas, options);
|
|
4930
4994
|
const tempCanvas = canvas.getSameCanvas(true, true);
|
|
4931
4995
|
this.__draw(tempCanvas, options);
|
|
4932
4996
|
if (this.__worldFlipped) {
|
|
@@ -4969,6 +5033,8 @@ var LeaferUI = (function (exports) {
|
|
|
4969
5033
|
__render(canvas, options) {
|
|
4970
5034
|
if (this.__worldOpacity) {
|
|
4971
5035
|
if (this.__.__single) {
|
|
5036
|
+
if (this.__.eraser === 'path')
|
|
5037
|
+
return this.__renderEraser(canvas, options);
|
|
4972
5038
|
const tempCanvas = canvas.getSameCanvas(false, true);
|
|
4973
5039
|
this.__renderBranch(tempCanvas, options);
|
|
4974
5040
|
const nowWorld = this.__getNowWorld(options);
|
|
@@ -5034,7 +5100,7 @@ var LeaferUI = (function (exports) {
|
|
|
5034
5100
|
get __worldFlipped() { return this.__world.scaleX < 0 || this.__world.scaleY < 0; }
|
|
5035
5101
|
get __onlyHitMask() { return this.__hasMask && !this.__.hitChildren; }
|
|
5036
5102
|
get __ignoreHitWorld() { return (this.__hasMask || this.__hasEraser) && this.__.hitChildren; }
|
|
5037
|
-
get pathInputed() { return
|
|
5103
|
+
get pathInputed() { return this.__.__pathInputed; }
|
|
5038
5104
|
constructor(data) {
|
|
5039
5105
|
this.innerId = create(LEAF);
|
|
5040
5106
|
this.reset(data);
|
|
@@ -5108,7 +5174,9 @@ var LeaferUI = (function (exports) {
|
|
|
5108
5174
|
setProxyAttr(_attrName, _newValue) { }
|
|
5109
5175
|
getProxyAttr(_attrName) { return undefined; }
|
|
5110
5176
|
find(_condition, _options) { return undefined; }
|
|
5177
|
+
findTag(_tag) { return undefined; }
|
|
5111
5178
|
findOne(_condition, _options) { return undefined; }
|
|
5179
|
+
findId(_id) { return undefined; }
|
|
5112
5180
|
focus(_value) { }
|
|
5113
5181
|
forceUpdate(attrName) {
|
|
5114
5182
|
if (attrName === undefined)
|
|
@@ -5130,9 +5198,11 @@ var LeaferUI = (function (exports) {
|
|
|
5130
5198
|
__updateLocalStrokeBounds() { }
|
|
5131
5199
|
__updateLocalRenderBounds() { }
|
|
5132
5200
|
__updateBoxBounds() { }
|
|
5201
|
+
__updateContentBounds() { }
|
|
5133
5202
|
__updateStrokeBounds() { }
|
|
5134
5203
|
__updateRenderBounds() { }
|
|
5135
5204
|
__updateAutoLayout() { }
|
|
5205
|
+
__updateFlowLayout() { }
|
|
5136
5206
|
__updateNaturalSize() { }
|
|
5137
5207
|
__updateStrokeSpread() { return 0; }
|
|
5138
5208
|
__updateRenderSpread() { return 0; }
|
|
@@ -5140,6 +5210,13 @@ var LeaferUI = (function (exports) {
|
|
|
5140
5210
|
__updateEraser(value) {
|
|
5141
5211
|
this.__hasEraser = value ? true : this.children.some(item => item.__.eraser);
|
|
5142
5212
|
}
|
|
5213
|
+
__renderEraser(canvas, options) {
|
|
5214
|
+
canvas.save();
|
|
5215
|
+
this.__clip(canvas, options);
|
|
5216
|
+
const { renderBounds: r } = this.__layout;
|
|
5217
|
+
canvas.clearRect(r.x, r.y, r.width, r.height);
|
|
5218
|
+
canvas.restore();
|
|
5219
|
+
}
|
|
5143
5220
|
__updateMask(value) {
|
|
5144
5221
|
this.__hasMask = value ? true : this.children.some(item => item.__.mask);
|
|
5145
5222
|
}
|
|
@@ -5320,8 +5397,8 @@ var LeaferUI = (function (exports) {
|
|
|
5320
5397
|
emit(_type, _event, _capture) { }
|
|
5321
5398
|
emitEvent(_event, _capture) { }
|
|
5322
5399
|
hasEvent(_type, _capture) { return false; }
|
|
5323
|
-
static changeAttr(attrName, defaultValue) {
|
|
5324
|
-
defineDataProcessor(this.prototype, attrName, defaultValue);
|
|
5400
|
+
static changeAttr(attrName, defaultValue, fn) {
|
|
5401
|
+
fn ? this.addAttr(attrName, defaultValue, fn) : defineDataProcessor(this.prototype, attrName, defaultValue);
|
|
5325
5402
|
}
|
|
5326
5403
|
static addAttr(attrName, defaultValue, fn) {
|
|
5327
5404
|
if (!fn)
|
|
@@ -5635,6 +5712,9 @@ var LeaferUI = (function (exports) {
|
|
|
5635
5712
|
}
|
|
5636
5713
|
}
|
|
5637
5714
|
|
|
5715
|
+
const version = "1.0.0-rc.24";
|
|
5716
|
+
const inviteCode = {};
|
|
5717
|
+
|
|
5638
5718
|
const debug$7 = Debug.get('LeaferCanvas');
|
|
5639
5719
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
5640
5720
|
init() {
|
|
@@ -5818,7 +5898,7 @@ var LeaferUI = (function (exports) {
|
|
|
5818
5898
|
}
|
|
5819
5899
|
img.onload = () => { resolve(img); };
|
|
5820
5900
|
img.onerror = (e) => { reject(e); };
|
|
5821
|
-
if (!src.startsWith('data:') && !src.startsWith('blob:')
|
|
5901
|
+
if (suffix && !src.startsWith('data:') && !src.startsWith('blob:'))
|
|
5822
5902
|
src += (src.includes("?") ? "&" : "?") + suffix;
|
|
5823
5903
|
img.src = src;
|
|
5824
5904
|
});
|
|
@@ -6308,7 +6388,7 @@ var LeaferUI = (function (exports) {
|
|
|
6308
6388
|
canvas.clear();
|
|
6309
6389
|
}
|
|
6310
6390
|
else {
|
|
6311
|
-
bounds.spread(
|
|
6391
|
+
bounds.spread(10 + 1 / this.canvas.pixelRatio).ceil();
|
|
6312
6392
|
canvas.clearWorld(bounds, true);
|
|
6313
6393
|
canvas.clipWorld(bounds, true);
|
|
6314
6394
|
}
|
|
@@ -6380,8 +6460,11 @@ var LeaferUI = (function (exports) {
|
|
|
6380
6460
|
if (!bounds.includes(this.target.__world) || this.needFill || !e.samePixelRatio) {
|
|
6381
6461
|
this.addBlock(this.canvas.bounds);
|
|
6382
6462
|
this.target.forceUpdate('surface');
|
|
6463
|
+
return;
|
|
6383
6464
|
}
|
|
6384
6465
|
}
|
|
6466
|
+
this.addBlock(new Bounds(0, 0, 1, 1));
|
|
6467
|
+
this.changed = true;
|
|
6385
6468
|
}
|
|
6386
6469
|
__onLayoutEnd(event) {
|
|
6387
6470
|
if (event.data)
|
|
@@ -6554,6 +6637,7 @@ var LeaferUI = (function (exports) {
|
|
|
6554
6637
|
}
|
|
6555
6638
|
|
|
6556
6639
|
const { Yes, NoAndSkip, YesAndSkip } = exports.Answer;
|
|
6640
|
+
const idCondition = {}, classNameCondition = {}, tagCondition = {};
|
|
6557
6641
|
class Selector {
|
|
6558
6642
|
constructor(target, userConfig) {
|
|
6559
6643
|
this.config = {};
|
|
@@ -6563,7 +6647,8 @@ var LeaferUI = (function (exports) {
|
|
|
6563
6647
|
id: (leaf, name) => leaf.id === name ? (this.idMap[name] = leaf, 1) : 0,
|
|
6564
6648
|
innerId: (leaf, innerId) => leaf.innerId === innerId ? (this.innerIdMap[innerId] = leaf, 1) : 0,
|
|
6565
6649
|
className: (leaf, name) => leaf.className === name ? 1 : 0,
|
|
6566
|
-
tag: (leaf, name) => leaf.__tag === name ? 1 : 0
|
|
6650
|
+
tag: (leaf, name) => leaf.__tag === name ? 1 : 0,
|
|
6651
|
+
tags: (leaf, nameMap) => nameMap[leaf.__tag] ? 1 : 0
|
|
6567
6652
|
};
|
|
6568
6653
|
this.target = target;
|
|
6569
6654
|
if (userConfig)
|
|
@@ -6579,12 +6664,25 @@ var LeaferUI = (function (exports) {
|
|
|
6579
6664
|
case 'string':
|
|
6580
6665
|
switch (condition[0]) {
|
|
6581
6666
|
case '#':
|
|
6582
|
-
|
|
6583
|
-
|
|
6667
|
+
idCondition.id = condition.substring(1), condition = idCondition;
|
|
6668
|
+
break;
|
|
6584
6669
|
case '.':
|
|
6585
|
-
|
|
6670
|
+
classNameCondition.className = condition.substring(1), condition = classNameCondition;
|
|
6671
|
+
break;
|
|
6586
6672
|
default:
|
|
6587
|
-
|
|
6673
|
+
tagCondition.tag = condition, condition = tagCondition;
|
|
6674
|
+
}
|
|
6675
|
+
case 'object':
|
|
6676
|
+
if (condition.id !== undefined) {
|
|
6677
|
+
const leaf = this.getById(condition.id, branch);
|
|
6678
|
+
return one ? leaf : (leaf ? [leaf] : []);
|
|
6679
|
+
}
|
|
6680
|
+
else if (condition.tag) {
|
|
6681
|
+
const { tag } = condition, isArray = tag instanceof Array;
|
|
6682
|
+
return this.getByMethod(isArray ? this.methods.tags : this.methods.tag, branch, one, isArray ? DataHelper.toMap(tag) : tag);
|
|
6683
|
+
}
|
|
6684
|
+
else {
|
|
6685
|
+
return this.getByMethod(this.methods.className, branch, one, condition.className);
|
|
6588
6686
|
}
|
|
6589
6687
|
case 'function':
|
|
6590
6688
|
return this.getByMethod(condition, branch, one, options);
|
|
@@ -6707,10 +6805,11 @@ var LeaferUI = (function (exports) {
|
|
|
6707
6805
|
function arrowType(defaultValue) {
|
|
6708
6806
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
6709
6807
|
set(value) {
|
|
6710
|
-
this.__setAttr(key, value)
|
|
6711
|
-
|
|
6712
|
-
|
|
6713
|
-
|
|
6808
|
+
if (this.__setAttr(key, value)) {
|
|
6809
|
+
const data = this.__;
|
|
6810
|
+
data.__useArrow = data.startArrow !== 'none' || data.endArrow !== 'none';
|
|
6811
|
+
doStrokeType(this);
|
|
6812
|
+
}
|
|
6714
6813
|
}
|
|
6715
6814
|
}));
|
|
6716
6815
|
}
|
|
@@ -6883,7 +6982,7 @@ var LeaferUI = (function (exports) {
|
|
|
6883
6982
|
const UnitConvert = {
|
|
6884
6983
|
number(value, percentRefer) {
|
|
6885
6984
|
if (typeof value === 'object')
|
|
6886
|
-
return value.type === 'percent' ? value.value
|
|
6985
|
+
return value.type === 'percent' ? value.value * percentRefer : value.value;
|
|
6887
6986
|
return value;
|
|
6888
6987
|
}
|
|
6889
6988
|
};
|
|
@@ -6892,7 +6991,7 @@ var LeaferUI = (function (exports) {
|
|
|
6892
6991
|
}
|
|
6893
6992
|
|
|
6894
6993
|
class BoxData extends GroupData {
|
|
6895
|
-
get __boxStroke() { return
|
|
6994
|
+
get __boxStroke() { return !this.__pathInputed; }
|
|
6896
6995
|
}
|
|
6897
6996
|
|
|
6898
6997
|
class LeaferData extends GroupData {
|
|
@@ -6905,11 +7004,11 @@ var LeaferUI = (function (exports) {
|
|
|
6905
7004
|
}
|
|
6906
7005
|
|
|
6907
7006
|
class RectData extends UIData {
|
|
6908
|
-
get __boxStroke() { return
|
|
7007
|
+
get __boxStroke() { return !this.__pathInputed; }
|
|
6909
7008
|
}
|
|
6910
7009
|
|
|
6911
7010
|
class EllipseData extends UIData {
|
|
6912
|
-
get __boxStroke() { return
|
|
7011
|
+
get __boxStroke() { return !this.__pathInputed; }
|
|
6913
7012
|
}
|
|
6914
7013
|
|
|
6915
7014
|
class PolygonData extends UIData {
|
|
@@ -6936,6 +7035,7 @@ var LeaferUI = (function (exports) {
|
|
|
6936
7035
|
'black': 900
|
|
6937
7036
|
};
|
|
6938
7037
|
class TextData extends UIData {
|
|
7038
|
+
get __useNaturalRatio() { return false; }
|
|
6939
7039
|
setFontWeight(value) {
|
|
6940
7040
|
if (typeof value === 'string') {
|
|
6941
7041
|
this.__setInput('fontWeight', value);
|
|
@@ -6977,19 +7077,18 @@ var LeaferUI = (function (exports) {
|
|
|
6977
7077
|
const UIBounds = {
|
|
6978
7078
|
__updateStrokeSpread() {
|
|
6979
7079
|
let width = 0, boxWidth = 0;
|
|
6980
|
-
const
|
|
6981
|
-
if ((stroke || hitStroke === 'all') && strokeWidth && strokeAlign !== 'inside') {
|
|
7080
|
+
const data = this.__, { strokeAlign, strokeWidth } = data;
|
|
7081
|
+
if ((data.stroke || data.hitStroke === 'all') && strokeWidth && strokeAlign !== 'inside') {
|
|
6982
7082
|
boxWidth = width = strokeAlign === 'center' ? strokeWidth / 2 : strokeWidth;
|
|
6983
|
-
if (!
|
|
6984
|
-
const
|
|
6985
|
-
const
|
|
6986
|
-
const storkeCapAddWidth = strokeCap === 'none' ? 0 : strokeWidth;
|
|
7083
|
+
if (!data.__boxStroke) {
|
|
7084
|
+
const miterLimitAddWidth = data.__isLinePath ? 0 : 10 * width;
|
|
7085
|
+
const storkeCapAddWidth = data.strokeCap === 'none' ? 0 : strokeWidth;
|
|
6987
7086
|
width += Math.max(miterLimitAddWidth, storkeCapAddWidth);
|
|
6988
7087
|
}
|
|
6989
7088
|
}
|
|
6990
|
-
|
|
6991
|
-
if (this.__.__useArrow)
|
|
7089
|
+
if (data.__useArrow)
|
|
6992
7090
|
width += strokeWidth * 5;
|
|
7091
|
+
this.__layout.strokeBoxSpread = boxWidth;
|
|
6993
7092
|
return width;
|
|
6994
7093
|
},
|
|
6995
7094
|
__updateRenderSpread() {
|
|
@@ -7009,7 +7108,7 @@ var LeaferUI = (function (exports) {
|
|
|
7009
7108
|
if (backgroundBlur)
|
|
7010
7109
|
shapeWidth = Math.max(shapeWidth, backgroundBlur);
|
|
7011
7110
|
this.__layout.renderShapeSpread = shapeWidth;
|
|
7012
|
-
return width;
|
|
7111
|
+
return width + (this.__layout.strokeSpread || 0);
|
|
7013
7112
|
}
|
|
7014
7113
|
};
|
|
7015
7114
|
|
|
@@ -7100,7 +7199,7 @@ var LeaferUI = (function (exports) {
|
|
|
7100
7199
|
|
|
7101
7200
|
const RectRender = {
|
|
7102
7201
|
__drawFast(canvas, options) {
|
|
7103
|
-
|
|
7202
|
+
let { width, height, fill, stroke, __drawAfterFill } = this.__;
|
|
7104
7203
|
if (fill) {
|
|
7105
7204
|
canvas.fillStyle = fill;
|
|
7106
7205
|
canvas.fillRect(0, 0, width, height);
|
|
@@ -7118,7 +7217,16 @@ var LeaferUI = (function (exports) {
|
|
|
7118
7217
|
canvas.strokeRect(0, 0, width, height);
|
|
7119
7218
|
break;
|
|
7120
7219
|
case 'inside':
|
|
7121
|
-
|
|
7220
|
+
width -= __strokeWidth, height -= __strokeWidth;
|
|
7221
|
+
if (width < 0 || height < 0) {
|
|
7222
|
+
canvas.save();
|
|
7223
|
+
this.__clip(canvas, options);
|
|
7224
|
+
canvas.strokeRect(half, half, width, height);
|
|
7225
|
+
canvas.restore();
|
|
7226
|
+
}
|
|
7227
|
+
else {
|
|
7228
|
+
canvas.strokeRect(half, half, width, height);
|
|
7229
|
+
}
|
|
7122
7230
|
break;
|
|
7123
7231
|
case 'outside':
|
|
7124
7232
|
canvas.strokeRect(-half, -half, width + __strokeWidth, height + __strokeWidth);
|
|
@@ -7146,11 +7254,14 @@ var LeaferUI = (function (exports) {
|
|
|
7146
7254
|
return scaleX !== scaleY ? { x: scaleX, y: scaleY } : scaleX;
|
|
7147
7255
|
}
|
|
7148
7256
|
get pen() {
|
|
7149
|
-
|
|
7257
|
+
const { path } = this.__;
|
|
7258
|
+
pen.set(this.path = path || []);
|
|
7259
|
+
if (!path)
|
|
7260
|
+
this.__drawPathByBox(pen);
|
|
7150
7261
|
return pen;
|
|
7151
7262
|
}
|
|
7152
7263
|
get editConfig() { return undefined; }
|
|
7153
|
-
get editOuter() { return 'EditTool'; }
|
|
7264
|
+
get editOuter() { return this.__.__isLinePath ? 'LineEditTool' : 'EditTool'; }
|
|
7154
7265
|
get editInner() { return 'PathEditor'; }
|
|
7155
7266
|
constructor(data) {
|
|
7156
7267
|
super(data);
|
|
@@ -7164,22 +7275,22 @@ var LeaferUI = (function (exports) {
|
|
|
7164
7275
|
}
|
|
7165
7276
|
createProxyData() { return undefined; }
|
|
7166
7277
|
find(_condition, _options) { return undefined; }
|
|
7278
|
+
findTag(tag) { return this.find({ tag }); }
|
|
7167
7279
|
findOne(_condition, _options) { return undefined; }
|
|
7280
|
+
findId(id) { return this.findOne({ id }); }
|
|
7168
7281
|
getPath(curve, pathForRender) {
|
|
7169
7282
|
this.__layout.update();
|
|
7170
7283
|
let path = pathForRender ? this.__.__pathForRender : this.__.path;
|
|
7171
|
-
if (!path)
|
|
7172
|
-
|
|
7173
|
-
if (width || height) {
|
|
7174
|
-
pen.set(path = []);
|
|
7175
|
-
this.__drawPathByBox(pen);
|
|
7176
|
-
}
|
|
7177
|
-
}
|
|
7284
|
+
if (!path)
|
|
7285
|
+
pen.set(path = []), this.__drawPathByBox(pen);
|
|
7178
7286
|
return curve ? PathConvert.toCanvasData(path, true) : path;
|
|
7179
7287
|
}
|
|
7180
7288
|
getPathString(curve, pathForRender) {
|
|
7181
7289
|
return PathConvert.stringify(this.getPath(curve, pathForRender));
|
|
7182
7290
|
}
|
|
7291
|
+
load() {
|
|
7292
|
+
this.__.__computePaint();
|
|
7293
|
+
}
|
|
7183
7294
|
__onUpdateSize() {
|
|
7184
7295
|
if (this.__.__input) {
|
|
7185
7296
|
const data = this.__;
|
|
@@ -7265,7 +7376,7 @@ var LeaferUI = (function (exports) {
|
|
|
7265
7376
|
opacityType(1)
|
|
7266
7377
|
], exports.UI.prototype, "opacity", void 0);
|
|
7267
7378
|
__decorate([
|
|
7268
|
-
|
|
7379
|
+
visibleType(true)
|
|
7269
7380
|
], exports.UI.prototype, "visible", void 0);
|
|
7270
7381
|
__decorate([
|
|
7271
7382
|
stateType(false)
|
|
@@ -7282,9 +7393,6 @@ var LeaferUI = (function (exports) {
|
|
|
7282
7393
|
__decorate([
|
|
7283
7394
|
maskType(false)
|
|
7284
7395
|
], exports.UI.prototype, "mask", void 0);
|
|
7285
|
-
__decorate([
|
|
7286
|
-
surfaceType('pixel')
|
|
7287
|
-
], exports.UI.prototype, "maskType", void 0);
|
|
7288
7396
|
__decorate([
|
|
7289
7397
|
eraserType(false)
|
|
7290
7398
|
], exports.UI.prototype, "eraser", void 0);
|
|
@@ -7315,9 +7423,75 @@ var LeaferUI = (function (exports) {
|
|
|
7315
7423
|
__decorate([
|
|
7316
7424
|
rotationType(0, true)
|
|
7317
7425
|
], exports.UI.prototype, "skewY", void 0);
|
|
7426
|
+
__decorate([
|
|
7427
|
+
positionType(0, true)
|
|
7428
|
+
], exports.UI.prototype, "offsetX", void 0);
|
|
7429
|
+
__decorate([
|
|
7430
|
+
positionType(0, true)
|
|
7431
|
+
], exports.UI.prototype, "offsetY", void 0);
|
|
7432
|
+
__decorate([
|
|
7433
|
+
positionType(0, true)
|
|
7434
|
+
], exports.UI.prototype, "scrollX", void 0);
|
|
7435
|
+
__decorate([
|
|
7436
|
+
positionType(0, true)
|
|
7437
|
+
], exports.UI.prototype, "scrollY", void 0);
|
|
7438
|
+
__decorate([
|
|
7439
|
+
autoLayoutType()
|
|
7440
|
+
], exports.UI.prototype, "origin", void 0);
|
|
7318
7441
|
__decorate([
|
|
7319
7442
|
autoLayoutType()
|
|
7320
7443
|
], exports.UI.prototype, "around", void 0);
|
|
7444
|
+
__decorate([
|
|
7445
|
+
dataType(false)
|
|
7446
|
+
], exports.UI.prototype, "lazy", void 0);
|
|
7447
|
+
__decorate([
|
|
7448
|
+
naturalBoundsType(1)
|
|
7449
|
+
], exports.UI.prototype, "pixelRatio", void 0);
|
|
7450
|
+
__decorate([
|
|
7451
|
+
pathInputType()
|
|
7452
|
+
], exports.UI.prototype, "path", void 0);
|
|
7453
|
+
__decorate([
|
|
7454
|
+
pathType()
|
|
7455
|
+
], exports.UI.prototype, "windingRule", void 0);
|
|
7456
|
+
__decorate([
|
|
7457
|
+
pathType(true)
|
|
7458
|
+
], exports.UI.prototype, "closed", void 0);
|
|
7459
|
+
__decorate([
|
|
7460
|
+
autoLayoutType(false)
|
|
7461
|
+
], exports.UI.prototype, "flow", void 0);
|
|
7462
|
+
__decorate([
|
|
7463
|
+
boundsType(0)
|
|
7464
|
+
], exports.UI.prototype, "padding", void 0);
|
|
7465
|
+
__decorate([
|
|
7466
|
+
boundsType(0)
|
|
7467
|
+
], exports.UI.prototype, "gap", void 0);
|
|
7468
|
+
__decorate([
|
|
7469
|
+
boundsType('top-left')
|
|
7470
|
+
], exports.UI.prototype, "align", void 0);
|
|
7471
|
+
__decorate([
|
|
7472
|
+
boundsType(false)
|
|
7473
|
+
], exports.UI.prototype, "wrap", void 0);
|
|
7474
|
+
__decorate([
|
|
7475
|
+
boundsType('box')
|
|
7476
|
+
], exports.UI.prototype, "itemBox", void 0);
|
|
7477
|
+
__decorate([
|
|
7478
|
+
boundsType(true)
|
|
7479
|
+
], exports.UI.prototype, "inFlow", void 0);
|
|
7480
|
+
__decorate([
|
|
7481
|
+
boundsType()
|
|
7482
|
+
], exports.UI.prototype, "autoWidth", void 0);
|
|
7483
|
+
__decorate([
|
|
7484
|
+
boundsType()
|
|
7485
|
+
], exports.UI.prototype, "autoHeight", void 0);
|
|
7486
|
+
__decorate([
|
|
7487
|
+
boundsType()
|
|
7488
|
+
], exports.UI.prototype, "autoBox", void 0);
|
|
7489
|
+
__decorate([
|
|
7490
|
+
boundsType()
|
|
7491
|
+
], exports.UI.prototype, "widthRange", void 0);
|
|
7492
|
+
__decorate([
|
|
7493
|
+
boundsType()
|
|
7494
|
+
], exports.UI.prototype, "heightRange", void 0);
|
|
7321
7495
|
__decorate([
|
|
7322
7496
|
dataType(false)
|
|
7323
7497
|
], exports.UI.prototype, "draggable", void 0);
|
|
@@ -7327,9 +7501,6 @@ var LeaferUI = (function (exports) {
|
|
|
7327
7501
|
__decorate([
|
|
7328
7502
|
dataType(false)
|
|
7329
7503
|
], exports.UI.prototype, "editable", void 0);
|
|
7330
|
-
__decorate([
|
|
7331
|
-
dataType('size')
|
|
7332
|
-
], exports.UI.prototype, "editSize", void 0);
|
|
7333
7504
|
__decorate([
|
|
7334
7505
|
hitType(true)
|
|
7335
7506
|
], exports.UI.prototype, "hittable", void 0);
|
|
@@ -7384,21 +7555,6 @@ var LeaferUI = (function (exports) {
|
|
|
7384
7555
|
__decorate([
|
|
7385
7556
|
strokeType(10)
|
|
7386
7557
|
], exports.UI.prototype, "miterLimit", void 0);
|
|
7387
|
-
__decorate([
|
|
7388
|
-
dataType(false)
|
|
7389
|
-
], exports.UI.prototype, "lazy", void 0);
|
|
7390
|
-
__decorate([
|
|
7391
|
-
naturalBoundsType(1)
|
|
7392
|
-
], exports.UI.prototype, "pixelRatio", void 0);
|
|
7393
|
-
__decorate([
|
|
7394
|
-
pathInputType()
|
|
7395
|
-
], exports.UI.prototype, "path", void 0);
|
|
7396
|
-
__decorate([
|
|
7397
|
-
pathType()
|
|
7398
|
-
], exports.UI.prototype, "windingRule", void 0);
|
|
7399
|
-
__decorate([
|
|
7400
|
-
pathType(true)
|
|
7401
|
-
], exports.UI.prototype, "closed", void 0);
|
|
7402
7558
|
__decorate([
|
|
7403
7559
|
arrowType('none')
|
|
7404
7560
|
], exports.UI.prototype, "startArrow", void 0);
|
|
@@ -7529,6 +7685,7 @@ var LeaferUI = (function (exports) {
|
|
|
7529
7685
|
get layoutLocked() { return !this.layouter.running; }
|
|
7530
7686
|
get FPS() { return this.renderer ? this.renderer.FPS : 60; }
|
|
7531
7687
|
get cursorPoint() { return (this.interaction && this.interaction.hoverData) || { x: this.width / 2, y: this.height / 2 }; }
|
|
7688
|
+
get clientBounds() { return this.canvas && this.canvas.getClientBounds(); }
|
|
7532
7689
|
constructor(userConfig, data) {
|
|
7533
7690
|
super(data);
|
|
7534
7691
|
this.config = {
|
|
@@ -7632,9 +7789,6 @@ var LeaferUI = (function (exports) {
|
|
|
7632
7789
|
const data = DataHelper.copyAttrs({}, size, canvasSizeAttrs);
|
|
7633
7790
|
Object.keys(data).forEach(key => this[key] = data[key]);
|
|
7634
7791
|
}
|
|
7635
|
-
forceFullRender() {
|
|
7636
|
-
this.forceRender();
|
|
7637
|
-
}
|
|
7638
7792
|
forceRender(bounds) {
|
|
7639
7793
|
this.renderer.addBlock(bounds ? new Bounds(bounds) : this.canvas.bounds);
|
|
7640
7794
|
if (this.viewReady)
|
|
@@ -7689,7 +7843,8 @@ var LeaferUI = (function (exports) {
|
|
|
7689
7843
|
this.__changeFill(newValue);
|
|
7690
7844
|
}
|
|
7691
7845
|
else if (attrName === 'hittable') {
|
|
7692
|
-
this.
|
|
7846
|
+
if (!this.parent)
|
|
7847
|
+
this.canvas.hittable = newValue;
|
|
7693
7848
|
}
|
|
7694
7849
|
}
|
|
7695
7850
|
return super.__setAttr(attrName, newValue);
|
|
@@ -7712,7 +7867,7 @@ var LeaferUI = (function (exports) {
|
|
|
7712
7867
|
this.canvas.backgroundColor = newValue;
|
|
7713
7868
|
}
|
|
7714
7869
|
else {
|
|
7715
|
-
this.
|
|
7870
|
+
this.forceRender();
|
|
7716
7871
|
}
|
|
7717
7872
|
}
|
|
7718
7873
|
__onCreated() {
|
|
@@ -7807,6 +7962,9 @@ var LeaferUI = (function (exports) {
|
|
|
7807
7962
|
zoom(_zoomType, _padding, _fixedScale) { return undefined; }
|
|
7808
7963
|
getValidMove(moveX, moveY) { return { x: moveX, y: moveY }; }
|
|
7809
7964
|
getValidScale(changeScale) { return changeScale; }
|
|
7965
|
+
getWorldPointByClient(clientPoint, updateClient) {
|
|
7966
|
+
return this.interaction && this.interaction.getLocal(clientPoint, updateClient);
|
|
7967
|
+
}
|
|
7810
7968
|
__checkUpdateLayout() {
|
|
7811
7969
|
this.__layout.update();
|
|
7812
7970
|
}
|
|
@@ -7889,8 +8047,8 @@ var LeaferUI = (function (exports) {
|
|
|
7889
8047
|
|
|
7890
8048
|
const rect$1 = exports.Rect.prototype;
|
|
7891
8049
|
const group$1 = exports.Group.prototype;
|
|
7892
|
-
const
|
|
7893
|
-
const { copy: copy$3, add } = BoundsHelper;
|
|
8050
|
+
const childrenRenderBounds = {};
|
|
8051
|
+
const { copy: copy$3, add, includes: includes$1 } = BoundsHelper;
|
|
7894
8052
|
exports.Box = class Box extends exports.Group {
|
|
7895
8053
|
get __tag() { return 'Box'; }
|
|
7896
8054
|
get isBranchLeaf() { return true; }
|
|
@@ -7901,24 +8059,29 @@ var LeaferUI = (function (exports) {
|
|
|
7901
8059
|
__updateStrokeSpread() { return 0; }
|
|
7902
8060
|
__updateRectRenderSpread() { return 0; }
|
|
7903
8061
|
__updateRenderSpread() {
|
|
7904
|
-
|
|
7905
|
-
const hide = this.__.__drawAfterFill = this.__.overflow === 'hide';
|
|
7906
|
-
return (width || hide) ? width : -1;
|
|
8062
|
+
return this.__updateRectRenderSpread() || -1;
|
|
7907
8063
|
}
|
|
7908
8064
|
__updateRectBoxBounds() { }
|
|
7909
8065
|
__updateBoxBounds() {
|
|
7910
8066
|
const data = this.__;
|
|
7911
|
-
if (
|
|
7912
|
-
if (
|
|
7913
|
-
this.leafer.
|
|
7914
|
-
|
|
7915
|
-
|
|
7916
|
-
|
|
7917
|
-
|
|
7918
|
-
|
|
7919
|
-
|
|
7920
|
-
|
|
8067
|
+
if (this.children.length) {
|
|
8068
|
+
if (data.__autoSide) {
|
|
8069
|
+
if (this.leafer && this.leafer.ready)
|
|
8070
|
+
this.leafer.layouter.addExtra(this);
|
|
8071
|
+
super.__updateBoxBounds();
|
|
8072
|
+
if (!data.__autoSize) {
|
|
8073
|
+
const b = this.__layout.boxBounds;
|
|
8074
|
+
if (!data.__autoWidth)
|
|
8075
|
+
b.x = 0, b.width = data.width;
|
|
8076
|
+
if (!data.__autoHeight)
|
|
8077
|
+
b.y = 0, b.height = data.height;
|
|
8078
|
+
}
|
|
8079
|
+
}
|
|
8080
|
+
else {
|
|
8081
|
+
this.__updateRectBoxBounds();
|
|
7921
8082
|
}
|
|
8083
|
+
if (data.flow)
|
|
8084
|
+
this.__updateContentBounds();
|
|
7922
8085
|
}
|
|
7923
8086
|
else {
|
|
7924
8087
|
this.__updateRectBoxBounds();
|
|
@@ -7926,13 +8089,20 @@ var LeaferUI = (function (exports) {
|
|
|
7926
8089
|
}
|
|
7927
8090
|
__updateStrokeBounds() { }
|
|
7928
8091
|
__updateRenderBounds() {
|
|
7929
|
-
|
|
7930
|
-
|
|
7931
|
-
|
|
7932
|
-
copy$3(bounds$1, renderBounds);
|
|
8092
|
+
let isOverflow;
|
|
8093
|
+
const { renderBounds } = this.__layout;
|
|
8094
|
+
if (this.children.length) {
|
|
7933
8095
|
super.__updateRenderBounds();
|
|
7934
|
-
|
|
8096
|
+
copy$3(childrenRenderBounds, renderBounds);
|
|
8097
|
+
this.__updateRectRenderBounds();
|
|
8098
|
+
isOverflow = !includes$1(renderBounds, childrenRenderBounds) || undefined;
|
|
8099
|
+
}
|
|
8100
|
+
else {
|
|
8101
|
+
this.__updateRectRenderBounds();
|
|
7935
8102
|
}
|
|
8103
|
+
this.isOverflow !== isOverflow && (this.isOverflow = isOverflow);
|
|
8104
|
+
if (isOverflow && !(this.__.__drawAfterFill = this.__.overflow === 'hide'))
|
|
8105
|
+
add(renderBounds, childrenRenderBounds);
|
|
7936
8106
|
}
|
|
7937
8107
|
__updateRectRenderBounds() { }
|
|
7938
8108
|
__updateRectChange() { }
|
|
@@ -7948,16 +8118,27 @@ var LeaferUI = (function (exports) {
|
|
|
7948
8118
|
}
|
|
7949
8119
|
else {
|
|
7950
8120
|
this.__renderRect(canvas, options);
|
|
7951
|
-
this.
|
|
8121
|
+
if (this.children.length)
|
|
8122
|
+
this.__renderGroup(canvas, options);
|
|
7952
8123
|
}
|
|
7953
8124
|
}
|
|
7954
8125
|
__drawAfterFill(canvas, options) {
|
|
7955
|
-
|
|
7956
|
-
|
|
7957
|
-
|
|
7958
|
-
|
|
7959
|
-
|
|
8126
|
+
const { length } = this.children;
|
|
8127
|
+
if (this.isOverflow) {
|
|
8128
|
+
canvas.save();
|
|
8129
|
+
canvas.clip();
|
|
8130
|
+
if (length)
|
|
8131
|
+
this.__renderGroup(canvas, options);
|
|
8132
|
+
canvas.restore();
|
|
8133
|
+
}
|
|
8134
|
+
else {
|
|
8135
|
+
if (length)
|
|
8136
|
+
this.__renderGroup(canvas, options);
|
|
8137
|
+
}
|
|
8138
|
+
if (this.__.stroke && length) {
|
|
8139
|
+
canvas.setWorld(this.__nowWorld);
|
|
7960
8140
|
this.__drawRenderPath(canvas);
|
|
8141
|
+
}
|
|
7961
8142
|
}
|
|
7962
8143
|
};
|
|
7963
8144
|
__decorate([
|
|
@@ -8095,9 +8276,10 @@ var LeaferUI = (function (exports) {
|
|
|
8095
8276
|
super(data);
|
|
8096
8277
|
}
|
|
8097
8278
|
__updatePath() {
|
|
8098
|
-
const
|
|
8099
|
-
|
|
8100
|
-
|
|
8279
|
+
const data = this.__;
|
|
8280
|
+
const path = data.path = [];
|
|
8281
|
+
if (data.points) {
|
|
8282
|
+
drawPoints$1(path, data.points, false, data.closed);
|
|
8101
8283
|
}
|
|
8102
8284
|
else {
|
|
8103
8285
|
moveTo$2(path, 0, 0);
|
|
@@ -8332,7 +8514,7 @@ var LeaferUI = (function (exports) {
|
|
|
8332
8514
|
registerUI()
|
|
8333
8515
|
], exports.Canvas);
|
|
8334
8516
|
|
|
8335
|
-
const { copyAndSpread, includes, spread, setList } = BoundsHelper;
|
|
8517
|
+
const { copyAndSpread, includes, isSame: isSame$1, spread, setList } = BoundsHelper;
|
|
8336
8518
|
exports.Text = class Text extends exports.UI {
|
|
8337
8519
|
get __tag() { return 'Text'; }
|
|
8338
8520
|
get editInner() { return 'TextEditor'; }
|
|
@@ -8405,7 +8587,7 @@ var LeaferUI = (function (exports) {
|
|
|
8405
8587
|
if (italic)
|
|
8406
8588
|
b.width += fontSize * 0.16;
|
|
8407
8589
|
const contentBounds = includes(b, bounds) ? b : bounds;
|
|
8408
|
-
if (contentBounds
|
|
8590
|
+
if (!isSame$1(contentBounds, layout.contentBounds)) {
|
|
8409
8591
|
layout.contentBounds = contentBounds;
|
|
8410
8592
|
layout.renderChanged = true;
|
|
8411
8593
|
setList(data.__textBoxBounds = {}, [b, bounds]);
|
|
@@ -8433,9 +8615,6 @@ var LeaferUI = (function (exports) {
|
|
|
8433
8615
|
__decorate([
|
|
8434
8616
|
boundsType(0)
|
|
8435
8617
|
], exports.Text.prototype, "height", void 0);
|
|
8436
|
-
__decorate([
|
|
8437
|
-
boundsType(0)
|
|
8438
|
-
], exports.Text.prototype, "padding", void 0);
|
|
8439
8618
|
__decorate([
|
|
8440
8619
|
surfaceType('#000000')
|
|
8441
8620
|
], exports.Text.prototype, "fill", void 0);
|
|
@@ -8470,7 +8649,7 @@ var LeaferUI = (function (exports) {
|
|
|
8470
8649
|
boundsType(0)
|
|
8471
8650
|
], exports.Text.prototype, "letterSpacing", void 0);
|
|
8472
8651
|
__decorate([
|
|
8473
|
-
boundsType({ type: 'percent', value:
|
|
8652
|
+
boundsType({ type: 'percent', value: 1.5 })
|
|
8474
8653
|
], exports.Text.prototype, "lineHeight", void 0);
|
|
8475
8654
|
__decorate([
|
|
8476
8655
|
boundsType(0)
|
|
@@ -8564,8 +8743,6 @@ var LeaferUI = (function (exports) {
|
|
|
8564
8743
|
};
|
|
8565
8744
|
}
|
|
8566
8745
|
|
|
8567
|
-
const version = "1.0.0-rc.21";
|
|
8568
|
-
|
|
8569
8746
|
exports.App = class App extends exports.Leafer {
|
|
8570
8747
|
get __tag() { return 'App'; }
|
|
8571
8748
|
get isApp() { return true; }
|
|
@@ -8658,8 +8835,10 @@ var LeaferUI = (function (exports) {
|
|
|
8658
8835
|
this.renderer.update();
|
|
8659
8836
|
}
|
|
8660
8837
|
__render(canvas, options) {
|
|
8661
|
-
if (options.matrix)
|
|
8662
|
-
|
|
8838
|
+
if (options.matrix) {
|
|
8839
|
+
const { a, b, c, d, e, f } = options.matrix;
|
|
8840
|
+
canvas.setTransform(a, b, c, d, e, f);
|
|
8841
|
+
}
|
|
8663
8842
|
this.children.forEach(leafer => canvas.copyWorld(leafer.canvas));
|
|
8664
8843
|
}
|
|
8665
8844
|
__onResize(event) {
|
|
@@ -9663,8 +9842,8 @@ var LeaferUI = (function (exports) {
|
|
|
9663
9842
|
}
|
|
9664
9843
|
tap(data) {
|
|
9665
9844
|
const { pointer } = this.config;
|
|
9666
|
-
const
|
|
9667
|
-
if (!pointer.tapMore &&
|
|
9845
|
+
const hasLong = this.longTap(data);
|
|
9846
|
+
if (!pointer.tapMore && hasLong)
|
|
9668
9847
|
return;
|
|
9669
9848
|
if (!this.waitTap)
|
|
9670
9849
|
return;
|
|
@@ -9786,6 +9965,10 @@ var LeaferUI = (function (exports) {
|
|
|
9786
9965
|
setCursor(cursor) {
|
|
9787
9966
|
this.cursor = cursor;
|
|
9788
9967
|
}
|
|
9968
|
+
getLocal(clientPoint, updateClient) {
|
|
9969
|
+
const clientBounds = this.canvas.getClientBounds(updateClient);
|
|
9970
|
+
return { x: clientPoint.clientX - clientBounds.x, y: clientPoint.clientY - clientBounds.y };
|
|
9971
|
+
}
|
|
9789
9972
|
emitTap(data) {
|
|
9790
9973
|
this.emit(exports.PointerEvent.TAP, data);
|
|
9791
9974
|
this.emit(exports.PointerEvent.CLICK, data);
|
|
@@ -9815,14 +9998,14 @@ var LeaferUI = (function (exports) {
|
|
|
9815
9998
|
}, this.config.pointer.longPressTime);
|
|
9816
9999
|
}
|
|
9817
10000
|
longTap(data) {
|
|
9818
|
-
let
|
|
10001
|
+
let hasLong;
|
|
9819
10002
|
if (this.longPressed) {
|
|
9820
10003
|
this.emit(exports.PointerEvent.LONG_TAP, data);
|
|
9821
|
-
if (pathHasEventType(data.path, exports.PointerEvent.LONG_TAP))
|
|
9822
|
-
|
|
10004
|
+
if (pathHasEventType(data.path, exports.PointerEvent.LONG_TAP) || pathHasEventType(data.path, exports.PointerEvent.LONG_PRESS))
|
|
10005
|
+
hasLong = true;
|
|
9823
10006
|
}
|
|
9824
10007
|
this.longPressWaitCancel();
|
|
9825
|
-
return
|
|
10008
|
+
return hasLong;
|
|
9826
10009
|
}
|
|
9827
10010
|
longPressWaitCancel() {
|
|
9828
10011
|
clearTimeout(this.longPressTimer);
|
|
@@ -10180,12 +10363,6 @@ var LeaferUI = (function (exports) {
|
|
|
10180
10363
|
this.windowEvents = {};
|
|
10181
10364
|
}
|
|
10182
10365
|
}
|
|
10183
|
-
getLocal(p, updateClient) {
|
|
10184
|
-
if (updateClient)
|
|
10185
|
-
this.canvas.updateClientBounds();
|
|
10186
|
-
const { clientBounds } = this.canvas;
|
|
10187
|
-
return { x: p.clientX - clientBounds.x, y: p.clientY - clientBounds.y };
|
|
10188
|
-
}
|
|
10189
10366
|
getTouches(touches) {
|
|
10190
10367
|
const list = [];
|
|
10191
10368
|
for (let i = 0, len = touches.length; i < len; i++) {
|
|
@@ -10622,7 +10799,7 @@ var LeaferUI = (function (exports) {
|
|
|
10622
10799
|
}
|
|
10623
10800
|
else {
|
|
10624
10801
|
const { renderShapeSpread: spread } = ui.__layout;
|
|
10625
|
-
const worldClipBounds = getIntersectData(spread ? getSpread(current.bounds, spread * scaleX, spread *
|
|
10802
|
+
const worldClipBounds = getIntersectData(spread ? getSpread(current.bounds, scaleX === scaleY ? spread * scaleX : [spread * scaleY, spread * scaleX]) : current.bounds, nowWorld);
|
|
10626
10803
|
fitMatrix = current.bounds.getFitMatrix(worldClipBounds);
|
|
10627
10804
|
let { a: fitScaleX, d: fitScaleY } = fitMatrix;
|
|
10628
10805
|
if (fitMatrix.a < 1) {
|
|
@@ -10722,10 +10899,10 @@ var LeaferUI = (function (exports) {
|
|
|
10722
10899
|
rotate(transform, rotation);
|
|
10723
10900
|
data.transform = transform;
|
|
10724
10901
|
}
|
|
10725
|
-
function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation,
|
|
10902
|
+
function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align) {
|
|
10726
10903
|
const transform = get$4();
|
|
10727
10904
|
if (rotation) {
|
|
10728
|
-
if (
|
|
10905
|
+
if (align === 'center') {
|
|
10729
10906
|
rotateOfOuter$2(transform, { x: width / 2, y: height / 2 }, rotation);
|
|
10730
10907
|
}
|
|
10731
10908
|
else {
|
|
@@ -10758,12 +10935,12 @@ var LeaferUI = (function (exports) {
|
|
|
10758
10935
|
let { width, height } = image;
|
|
10759
10936
|
if (paint.padding)
|
|
10760
10937
|
box = tempBox.set(box).shrink(paint.padding);
|
|
10761
|
-
const { opacity, mode,
|
|
10938
|
+
const { opacity, mode, align, offset, scale, size, rotation, blendMode, repeat } = paint;
|
|
10762
10939
|
const sameBox = box.width === width && box.height === height;
|
|
10763
10940
|
if (blendMode)
|
|
10764
10941
|
leafPaint.blendMode = blendMode;
|
|
10765
10942
|
const data = leafPaint.data = { mode };
|
|
10766
|
-
const swapSize =
|
|
10943
|
+
const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
|
|
10767
10944
|
const swapWidth = swapSize ? height : width, swapHeight = swapSize ? width : height;
|
|
10768
10945
|
let x = 0, y = 0, scaleX, scaleY;
|
|
10769
10946
|
if (!mode || mode === 'cover' || mode === 'fit') {
|
|
@@ -10781,11 +10958,11 @@ var LeaferUI = (function (exports) {
|
|
|
10781
10958
|
scaleX = typeof scale === 'number' ? scale : scale.x;
|
|
10782
10959
|
scaleY = typeof scale === 'number' ? scale : scale.y;
|
|
10783
10960
|
}
|
|
10784
|
-
if (
|
|
10961
|
+
if (align) {
|
|
10785
10962
|
const imageBounds = { x, y, width: swapWidth, height: swapHeight };
|
|
10786
10963
|
if (scaleX)
|
|
10787
10964
|
imageBounds.width *= scaleX, imageBounds.height *= scaleY;
|
|
10788
|
-
|
|
10965
|
+
AlignHelper.toPoint(align, imageBounds, box, tempPoint, true);
|
|
10789
10966
|
x += tempPoint.x, y += tempPoint.y;
|
|
10790
10967
|
}
|
|
10791
10968
|
if (offset)
|
|
@@ -10802,7 +10979,7 @@ var LeaferUI = (function (exports) {
|
|
|
10802
10979
|
break;
|
|
10803
10980
|
case 'repeat':
|
|
10804
10981
|
if (!sameBox || scaleX || rotation)
|
|
10805
|
-
repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation,
|
|
10982
|
+
repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align);
|
|
10806
10983
|
if (!repeat)
|
|
10807
10984
|
data.repeat = 'repeat';
|
|
10808
10985
|
break;
|
|
@@ -11073,13 +11250,14 @@ var LeaferUI = (function (exports) {
|
|
|
11073
11250
|
recycleImage
|
|
11074
11251
|
};
|
|
11075
11252
|
|
|
11076
|
-
const
|
|
11077
|
-
const
|
|
11253
|
+
const { toPoint: toPoint$2 } = AroundHelper;
|
|
11254
|
+
const realFrom$2 = {};
|
|
11255
|
+
const realTo$2 = {};
|
|
11078
11256
|
function linearGradient(paint, box) {
|
|
11079
11257
|
let { from, to, type, blendMode, opacity } = paint;
|
|
11080
|
-
from ||
|
|
11081
|
-
to ||
|
|
11082
|
-
const style = Platform.canvas.createLinearGradient(
|
|
11258
|
+
toPoint$2(from || 'top', box, realFrom$2);
|
|
11259
|
+
toPoint$2(to || 'bottom', box, realTo$2);
|
|
11260
|
+
const style = Platform.canvas.createLinearGradient(realFrom$2.x, realFrom$2.y, realTo$2.x, realTo$2.y);
|
|
11083
11261
|
applyStops(style, paint.stops, opacity);
|
|
11084
11262
|
const data = { type, style };
|
|
11085
11263
|
if (blendMode)
|
|
@@ -11090,23 +11268,25 @@ var LeaferUI = (function (exports) {
|
|
|
11090
11268
|
let stop;
|
|
11091
11269
|
for (let i = 0, len = stops.length; i < len; i++) {
|
|
11092
11270
|
stop = stops[i];
|
|
11093
|
-
|
|
11271
|
+
if (typeof stop === 'string') {
|
|
11272
|
+
gradient.addColorStop(i / (len - 1), ColorConvert.string(stop, opacity));
|
|
11273
|
+
}
|
|
11274
|
+
else {
|
|
11275
|
+
gradient.addColorStop(stop.offset, ColorConvert.string(stop.color, opacity));
|
|
11276
|
+
}
|
|
11094
11277
|
}
|
|
11095
11278
|
}
|
|
11096
11279
|
|
|
11097
|
-
const {
|
|
11280
|
+
const { getAngle: getAngle$1, getDistance: getDistance$1 } = PointHelper;
|
|
11098
11281
|
const { get: get$1, rotateOfOuter: rotateOfOuter$1, scaleOfOuter: scaleOfOuter$1 } = MatrixHelper;
|
|
11099
|
-
const
|
|
11100
|
-
const defaultTo$1 = { x: 0.5, y: 1 };
|
|
11282
|
+
const { toPoint: toPoint$1 } = AroundHelper;
|
|
11101
11283
|
const realFrom$1 = {};
|
|
11102
11284
|
const realTo$1 = {};
|
|
11103
11285
|
function radialGradient(paint, box) {
|
|
11104
11286
|
let { from, to, type, opacity, blendMode, stretch } = paint;
|
|
11105
|
-
from ||
|
|
11106
|
-
to ||
|
|
11107
|
-
const {
|
|
11108
|
-
set$1(realFrom$1, x + from.x * width, y + from.y * height);
|
|
11109
|
-
set$1(realTo$1, x + to.x * width, y + to.y * height);
|
|
11287
|
+
toPoint$1(from || 'center', box, realFrom$1);
|
|
11288
|
+
toPoint$1(to || 'bottom', box, realTo$1);
|
|
11289
|
+
const { width, height } = box;
|
|
11110
11290
|
let transform;
|
|
11111
11291
|
if (width !== height || stretch) {
|
|
11112
11292
|
transform = get$1();
|
|
@@ -11121,19 +11301,16 @@ var LeaferUI = (function (exports) {
|
|
|
11121
11301
|
return data;
|
|
11122
11302
|
}
|
|
11123
11303
|
|
|
11124
|
-
const {
|
|
11304
|
+
const { getAngle, getDistance } = PointHelper;
|
|
11125
11305
|
const { get, rotateOfOuter, scaleOfOuter } = MatrixHelper;
|
|
11126
|
-
const
|
|
11127
|
-
const defaultTo = { x: 0.5, y: 1 };
|
|
11306
|
+
const { toPoint } = AroundHelper;
|
|
11128
11307
|
const realFrom = {};
|
|
11129
11308
|
const realTo = {};
|
|
11130
11309
|
function conicGradient(paint, box) {
|
|
11131
11310
|
let { from, to, type, opacity, blendMode, stretch } = paint;
|
|
11132
|
-
from ||
|
|
11133
|
-
to ||
|
|
11134
|
-
const {
|
|
11135
|
-
set(realFrom, x + from.x * width, y + from.y * height);
|
|
11136
|
-
set(realTo, x + to.x * width, y + to.y * height);
|
|
11311
|
+
toPoint(from || 'center', box, realFrom);
|
|
11312
|
+
toPoint(to || 'bottom', box, realTo);
|
|
11313
|
+
const { width, height } = box;
|
|
11137
11314
|
const transform = get();
|
|
11138
11315
|
const angle = getAngle(realFrom, realTo);
|
|
11139
11316
|
if (Platform.conicGradientRotate90) {
|
|
@@ -11287,7 +11464,7 @@ var LeaferUI = (function (exports) {
|
|
|
11287
11464
|
maskEnd(this, currentMask, canvas, contentCanvas, maskCanvas, maskOpacity);
|
|
11288
11465
|
maskCanvas = contentCanvas = null;
|
|
11289
11466
|
}
|
|
11290
|
-
if (child.__.
|
|
11467
|
+
if (child.__.mask === 'path') {
|
|
11291
11468
|
if (child.opacity < 1) {
|
|
11292
11469
|
currentMask = 'opacity-path';
|
|
11293
11470
|
maskOpacity = child.opacity;
|
|
@@ -11308,7 +11485,7 @@ var LeaferUI = (function (exports) {
|
|
|
11308
11485
|
contentCanvas = getCanvas(canvas);
|
|
11309
11486
|
child.__render(maskCanvas, options);
|
|
11310
11487
|
}
|
|
11311
|
-
if (child.__.
|
|
11488
|
+
if (child.__.mask !== 'clipping')
|
|
11312
11489
|
continue;
|
|
11313
11490
|
}
|
|
11314
11491
|
if (excludeRenderBounds(child, options))
|
|
@@ -11609,11 +11786,11 @@ var LeaferUI = (function (exports) {
|
|
|
11609
11786
|
if (mode === WordMode) {
|
|
11610
11787
|
wordChar = { char: '', x: charX };
|
|
11611
11788
|
charX = toWordChar(word.data, charX, wordChar);
|
|
11612
|
-
if (wordChar.char !== ' ')
|
|
11789
|
+
if (row.isOverflow || wordChar.char !== ' ')
|
|
11613
11790
|
row.data.push(wordChar);
|
|
11614
11791
|
}
|
|
11615
11792
|
else {
|
|
11616
|
-
charX = toChar(word.data, charX, row.data);
|
|
11793
|
+
charX = toChar(word.data, charX, row.data, row.isOverflow);
|
|
11617
11794
|
}
|
|
11618
11795
|
if (!row.paraEnd && addWordWidth) {
|
|
11619
11796
|
charX += addWordWidth;
|
|
@@ -11640,9 +11817,9 @@ var LeaferUI = (function (exports) {
|
|
|
11640
11817
|
});
|
|
11641
11818
|
return charX;
|
|
11642
11819
|
}
|
|
11643
|
-
function toChar(data, charX, rowData) {
|
|
11820
|
+
function toChar(data, charX, rowData, isOverflow) {
|
|
11644
11821
|
data.forEach(char => {
|
|
11645
|
-
if (char.char !== ' ') {
|
|
11822
|
+
if (isOverflow || char.char !== ' ') {
|
|
11646
11823
|
char.x = charX;
|
|
11647
11824
|
rowData.push(char);
|
|
11648
11825
|
}
|
|
@@ -11674,12 +11851,14 @@ var LeaferUI = (function (exports) {
|
|
|
11674
11851
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
11675
11852
|
row = rows[i];
|
|
11676
11853
|
row.x = x;
|
|
11677
|
-
|
|
11678
|
-
|
|
11679
|
-
|
|
11680
|
-
|
|
11681
|
-
|
|
11682
|
-
|
|
11854
|
+
if (row.width < width || (row.width > width && !__clipText)) {
|
|
11855
|
+
switch (textAlign) {
|
|
11856
|
+
case 'center':
|
|
11857
|
+
row.x += (width - row.width) / 2;
|
|
11858
|
+
break;
|
|
11859
|
+
case 'right':
|
|
11860
|
+
row.x += width - row.width;
|
|
11861
|
+
}
|
|
11683
11862
|
}
|
|
11684
11863
|
if (row.paraStart && paraSpacing && i > 0)
|
|
11685
11864
|
starY += paraSpacing;
|
|
@@ -11719,11 +11898,13 @@ var LeaferUI = (function (exports) {
|
|
|
11719
11898
|
const { rows, overflow } = drawData;
|
|
11720
11899
|
let { textOverflow } = style;
|
|
11721
11900
|
rows.splice(overflow);
|
|
11722
|
-
if (textOverflow !== '
|
|
11723
|
-
if (textOverflow === '
|
|
11901
|
+
if (textOverflow && textOverflow !== 'show') {
|
|
11902
|
+
if (textOverflow === 'hide')
|
|
11903
|
+
textOverflow = '';
|
|
11904
|
+
else if (textOverflow === 'ellipsis')
|
|
11724
11905
|
textOverflow = '...';
|
|
11725
11906
|
let char, charRight;
|
|
11726
|
-
const ellipsisWidth = Platform.canvas.measureText(textOverflow).width;
|
|
11907
|
+
const ellipsisWidth = textOverflow ? Platform.canvas.measureText(textOverflow).width : 0;
|
|
11727
11908
|
const right = style.x + style.width - ellipsisWidth;
|
|
11728
11909
|
const list = style.textWrap === 'none' ? rows : [rows[overflow - 1]];
|
|
11729
11910
|
list.forEach(row => {
|
|
@@ -11891,8 +12072,12 @@ var LeaferUI = (function (exports) {
|
|
|
11891
12072
|
let renderBounds, trimBounds, scaleX = 1, scaleY = 1;
|
|
11892
12073
|
const { worldTransform, isLeafer, isFrame } = leaf;
|
|
11893
12074
|
const { slice, trim, onCanvas } = options;
|
|
11894
|
-
|
|
11895
|
-
|
|
12075
|
+
let scale = options.scale || 1;
|
|
12076
|
+
let pixelRatio = options.pixelRatio || 1;
|
|
12077
|
+
if (leaf.isApp) {
|
|
12078
|
+
scale *= pixelRatio;
|
|
12079
|
+
pixelRatio = leaf.app.pixelRatio;
|
|
12080
|
+
}
|
|
11896
12081
|
const screenshot = options.screenshot || leaf.isApp;
|
|
11897
12082
|
const fill = (isLeafer && screenshot) ? (options.fill === undefined ? leaf.fill : options.fill) : options.fill;
|
|
11898
12083
|
const needFill = FileHelper.isOpaqueImage(filename) || fill, matrix = new Matrix();
|
|
@@ -12033,6 +12218,7 @@ var LeaferUI = (function (exports) {
|
|
|
12033
12218
|
ImageManager.destroy();
|
|
12034
12219
|
});
|
|
12035
12220
|
|
|
12221
|
+
exports.AlignHelper = AlignHelper;
|
|
12036
12222
|
exports.AnimateEvent = AnimateEvent;
|
|
12037
12223
|
exports.AroundHelper = AroundHelper;
|
|
12038
12224
|
exports.AutoBounds = AutoBounds;
|
|
@@ -12168,6 +12354,7 @@ var LeaferUI = (function (exports) {
|
|
|
12168
12354
|
exports.getMatrixData = getMatrixData;
|
|
12169
12355
|
exports.getPointData = getPointData;
|
|
12170
12356
|
exports.hitType = hitType;
|
|
12357
|
+
exports.inviteCode = inviteCode;
|
|
12171
12358
|
exports.layoutProcessor = layoutProcessor;
|
|
12172
12359
|
exports.maskType = maskType;
|
|
12173
12360
|
exports.naturalBoundsType = naturalBoundsType;
|
|
@@ -12193,6 +12380,7 @@ var LeaferUI = (function (exports) {
|
|
|
12193
12380
|
exports.useCanvas = useCanvas;
|
|
12194
12381
|
exports.useModule = useModule;
|
|
12195
12382
|
exports.version = version;
|
|
12383
|
+
exports.visibleType = visibleType;
|
|
12196
12384
|
exports.zoomLayerType = zoomLayerType;
|
|
12197
12385
|
|
|
12198
12386
|
return exports;
|