@leafer/worker 1.12.1 → 1.12.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/worker.js +347 -202
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +357 -202
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +23 -23
package/dist/worker.js
CHANGED
|
@@ -199,7 +199,7 @@ var LeaferUI = function(exports) {
|
|
|
199
199
|
this.__input = this.__middle = null;
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
|
-
const {floor: floor$3, max: max$
|
|
202
|
+
const {floor: floor$3, max: max$7} = Math;
|
|
203
203
|
const Platform = {
|
|
204
204
|
toURL(text, fileType) {
|
|
205
205
|
let url = encodeURIComponent(text);
|
|
@@ -224,7 +224,7 @@ var LeaferUI = function(exports) {
|
|
|
224
224
|
return url;
|
|
225
225
|
},
|
|
226
226
|
resize(image, width, height, xGap, yGap, clip, smooth, opacity, _filters) {
|
|
227
|
-
const canvas = Platform.origin.createCanvas(max$
|
|
227
|
+
const canvas = Platform.origin.createCanvas(max$7(floor$3(width + (xGap || 0)), 1), max$7(floor$3(height + (yGap || 0)), 1));
|
|
228
228
|
const ctx = canvas.getContext("2d");
|
|
229
229
|
if (opacity) ctx.globalAlpha = opacity;
|
|
230
230
|
ctx.imageSmoothingEnabled = smooth === false ? false : true;
|
|
@@ -266,7 +266,7 @@ var LeaferUI = function(exports) {
|
|
|
266
266
|
};
|
|
267
267
|
const I$2 = IncrementId;
|
|
268
268
|
let tempA, tempB, tempTo;
|
|
269
|
-
const {max: max$
|
|
269
|
+
const {max: max$6} = Math, tempFour = [ 0, 0, 0, 0 ];
|
|
270
270
|
const FourNumberHelper = {
|
|
271
271
|
zero: [ ...tempFour ],
|
|
272
272
|
tempFour: tempFour,
|
|
@@ -317,9 +317,9 @@ var LeaferUI = function(exports) {
|
|
|
317
317
|
return data;
|
|
318
318
|
},
|
|
319
319
|
max(t, other, change) {
|
|
320
|
-
if (isNumber(t) && isNumber(other)) return max$
|
|
320
|
+
if (isNumber(t) && isNumber(other)) return max$6(t, other);
|
|
321
321
|
toTempAB(t, other, change);
|
|
322
|
-
return set$2(tempTo, max$
|
|
322
|
+
return set$2(tempTo, max$6(tempA[0], tempB[0]), max$6(tempA[1], tempB[1]), max$6(tempA[2], tempB[2]), max$6(tempA[3], tempB[3]));
|
|
323
323
|
},
|
|
324
324
|
add(t, other, change) {
|
|
325
325
|
if (isNumber(t) && isNumber(other)) return t + other;
|
|
@@ -334,7 +334,7 @@ var LeaferUI = function(exports) {
|
|
|
334
334
|
}
|
|
335
335
|
};
|
|
336
336
|
const {set: set$2, get: get$5, setTemp: setTemp, toTempAB: toTempAB} = FourNumberHelper;
|
|
337
|
-
const {round: round$6, pow: pow$2, max: max$
|
|
337
|
+
const {round: round$6, pow: pow$2, max: max$5, floor: floor$2, PI: PI$4} = Math;
|
|
338
338
|
const MathHelper = {
|
|
339
339
|
within(value, min, max) {
|
|
340
340
|
if (isObject(min)) max = min.max, min = min.min;
|
|
@@ -387,7 +387,7 @@ var LeaferUI = function(exports) {
|
|
|
387
387
|
}
|
|
388
388
|
},
|
|
389
389
|
getFloorScale(num, min = 1) {
|
|
390
|
-
return max$
|
|
390
|
+
return max$5(floor$2(num), min) / num;
|
|
391
391
|
},
|
|
392
392
|
randInt: randInt,
|
|
393
393
|
randColor(opacity) {
|
|
@@ -425,8 +425,8 @@ var LeaferUI = function(exports) {
|
|
|
425
425
|
};
|
|
426
426
|
}
|
|
427
427
|
const {sin: sin$6, cos: cos$6, acos: acos, sqrt: sqrt$5} = Math;
|
|
428
|
-
const {float: float$
|
|
429
|
-
const tempPoint$
|
|
428
|
+
const {float: float$5} = MathHelper;
|
|
429
|
+
const tempPoint$5 = {};
|
|
430
430
|
function getWorld() {
|
|
431
431
|
return Object.assign(Object.assign(Object.assign({}, getMatrixData()), getBoundsData()), {
|
|
432
432
|
scaleX: 1,
|
|
@@ -483,8 +483,8 @@ var LeaferUI = function(exports) {
|
|
|
483
483
|
to.f = t.f * pixelRatio;
|
|
484
484
|
},
|
|
485
485
|
scaleOfOuter(t, origin, scaleX, scaleY) {
|
|
486
|
-
M$b.toInnerPoint(t, origin, tempPoint$
|
|
487
|
-
M$b.scaleOfInner(t, tempPoint$
|
|
486
|
+
M$b.toInnerPoint(t, origin, tempPoint$5);
|
|
487
|
+
M$b.scaleOfInner(t, tempPoint$5, scaleX, scaleY);
|
|
488
488
|
},
|
|
489
489
|
scaleOfInner(t, origin, scaleX, scaleY = scaleX) {
|
|
490
490
|
M$b.translateInner(t, origin.x, origin.y);
|
|
@@ -502,8 +502,8 @@ var LeaferUI = function(exports) {
|
|
|
502
502
|
t.d = c * sinR + d * cosR;
|
|
503
503
|
},
|
|
504
504
|
rotateOfOuter(t, origin, rotation) {
|
|
505
|
-
M$b.toInnerPoint(t, origin, tempPoint$
|
|
506
|
-
M$b.rotateOfInner(t, tempPoint$
|
|
505
|
+
M$b.toInnerPoint(t, origin, tempPoint$5);
|
|
506
|
+
M$b.rotateOfInner(t, tempPoint$5, rotation);
|
|
507
507
|
},
|
|
508
508
|
rotateOfInner(t, origin, rotation) {
|
|
509
509
|
M$b.translateInner(t, origin.x, origin.y);
|
|
@@ -524,8 +524,8 @@ var LeaferUI = function(exports) {
|
|
|
524
524
|
}
|
|
525
525
|
},
|
|
526
526
|
skewOfOuter(t, origin, skewX, skewY) {
|
|
527
|
-
M$b.toInnerPoint(t, origin, tempPoint$
|
|
528
|
-
M$b.skewOfInner(t, tempPoint$
|
|
527
|
+
M$b.toInnerPoint(t, origin, tempPoint$5);
|
|
528
|
+
M$b.skewOfInner(t, tempPoint$5, skewX, skewY);
|
|
529
529
|
},
|
|
530
530
|
skewOfInner(t, origin, skewX, skewY = 0) {
|
|
531
531
|
M$b.translateInner(t, origin.x, origin.y);
|
|
@@ -673,12 +673,12 @@ var LeaferUI = function(exports) {
|
|
|
673
673
|
const cosR = c / scaleY;
|
|
674
674
|
rotation = PI_2 - (d > 0 ? acos(-cosR) : -acos(cosR));
|
|
675
675
|
}
|
|
676
|
-
const cosR = float$
|
|
676
|
+
const cosR = float$5(cos$6(rotation));
|
|
677
677
|
const sinR = sin$6(rotation);
|
|
678
|
-
scaleX = float$
|
|
679
|
-
skewX = cosR ? float$
|
|
680
|
-
skewY = cosR ? float$
|
|
681
|
-
rotation = float$
|
|
678
|
+
scaleX = float$5(scaleX), scaleY = float$5(scaleY);
|
|
679
|
+
skewX = cosR ? float$5((c / scaleY + sinR) / cosR / OneRadian, 9) : 0;
|
|
680
|
+
skewY = cosR ? float$5((b / scaleX - sinR) / cosR / OneRadian, 9) : 0;
|
|
681
|
+
rotation = float$5(rotation / OneRadian);
|
|
682
682
|
} else {
|
|
683
683
|
scaleX = a;
|
|
684
684
|
scaleY = d;
|
|
@@ -720,8 +720,9 @@ var LeaferUI = function(exports) {
|
|
|
720
720
|
}
|
|
721
721
|
};
|
|
722
722
|
const M$b = MatrixHelper;
|
|
723
|
+
const {float: float$4} = MathHelper;
|
|
723
724
|
const {toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$3} = MatrixHelper;
|
|
724
|
-
const {sin: sin$5, cos: cos$5, abs: abs$a, sqrt: sqrt$4, atan2: atan2$2, min: min$
|
|
725
|
+
const {sin: sin$5, cos: cos$5, abs: abs$a, sqrt: sqrt$4, atan2: atan2$2, min: min$3, round: round$5} = Math;
|
|
725
726
|
const PointHelper = {
|
|
726
727
|
defaultPoint: getPointData(),
|
|
727
728
|
tempPoint: {},
|
|
@@ -769,22 +770,27 @@ var LeaferUI = function(exports) {
|
|
|
769
770
|
},
|
|
770
771
|
tempToInnerOf(t, matrix) {
|
|
771
772
|
const {tempPoint: temp} = P$7;
|
|
772
|
-
copy$
|
|
773
|
+
copy$c(temp, t);
|
|
773
774
|
toInnerPoint$2(matrix, temp, temp);
|
|
774
775
|
return temp;
|
|
775
776
|
},
|
|
776
777
|
tempToOuterOf(t, matrix) {
|
|
777
778
|
const {tempPoint: temp} = P$7;
|
|
778
|
-
copy$
|
|
779
|
+
copy$c(temp, t);
|
|
779
780
|
toOuterPoint$3(matrix, temp, temp);
|
|
780
781
|
return temp;
|
|
781
782
|
},
|
|
782
783
|
tempToInnerRadiusPointOf(t, matrix) {
|
|
783
784
|
const {tempRadiusPoint: temp} = P$7;
|
|
784
|
-
copy$
|
|
785
|
+
copy$c(temp, t);
|
|
785
786
|
P$7.toInnerRadiusPointOf(t, matrix, temp);
|
|
786
787
|
return temp;
|
|
787
788
|
},
|
|
789
|
+
copyRadiusPoint(t, point, x, y) {
|
|
790
|
+
copy$c(t, point);
|
|
791
|
+
setRadius(t, x, y);
|
|
792
|
+
return t;
|
|
793
|
+
},
|
|
788
794
|
toInnerRadiusPointOf(t, matrix, to) {
|
|
789
795
|
to || (to = t);
|
|
790
796
|
toInnerPoint$2(matrix, t, to);
|
|
@@ -818,7 +824,7 @@ var LeaferUI = function(exports) {
|
|
|
818
824
|
return sqrt$4(x * x + y * y);
|
|
819
825
|
},
|
|
820
826
|
getMinDistanceFrom(x1, y1, x2, y2, x3, y3) {
|
|
821
|
-
return min$
|
|
827
|
+
return min$3(getDistanceFrom(x1, y1, x2, y2), getDistanceFrom(x2, y2, x3, y3));
|
|
822
828
|
},
|
|
823
829
|
getAngle(t, to) {
|
|
824
830
|
return getAtan2(t, to) / OneRadian;
|
|
@@ -852,14 +858,14 @@ var LeaferUI = function(exports) {
|
|
|
852
858
|
return points;
|
|
853
859
|
},
|
|
854
860
|
isSame(t, point) {
|
|
855
|
-
return t.x === point.x && t.y === point.y;
|
|
861
|
+
return float$4(t.x) === float$4(point.x) && float$4(t.y) === float$4(point.y);
|
|
856
862
|
},
|
|
857
863
|
reset(t) {
|
|
858
864
|
P$7.reset(t);
|
|
859
865
|
}
|
|
860
866
|
};
|
|
861
867
|
const P$7 = PointHelper;
|
|
862
|
-
const {getDistanceFrom: getDistanceFrom, copy: copy$
|
|
868
|
+
const {getDistanceFrom: getDistanceFrom, copy: copy$c, setRadius: setRadius, getAtan2: getAtan2} = P$7;
|
|
863
869
|
class Point {
|
|
864
870
|
constructor(x, y) {
|
|
865
871
|
this.set(x, y);
|
|
@@ -932,7 +938,7 @@ var LeaferUI = function(exports) {
|
|
|
932
938
|
return this;
|
|
933
939
|
}
|
|
934
940
|
}
|
|
935
|
-
const tempPoint$
|
|
941
|
+
const tempPoint$4 = new Point;
|
|
936
942
|
class Matrix {
|
|
937
943
|
constructor(a, b, c, d, e, f) {
|
|
938
944
|
this.set(a, b, c, d, e, f);
|
|
@@ -1186,7 +1192,7 @@ var LeaferUI = function(exports) {
|
|
|
1186
1192
|
};
|
|
1187
1193
|
const {tempPointBounds: tempPointBounds$1, setPoint: setPoint$5, addPoint: addPoint$3, toBounds: toBounds$3} = TwoPointBoundsHelper;
|
|
1188
1194
|
const {toOuterPoint: toOuterPoint$2} = MatrixHelper;
|
|
1189
|
-
const {float: float$
|
|
1195
|
+
const {float: float$3, fourNumber: fourNumber$1} = MathHelper;
|
|
1190
1196
|
const {floor: floor$1, ceil: ceil$2} = Math;
|
|
1191
1197
|
let right$4, bottom$3, boundsRight, boundsBottom;
|
|
1192
1198
|
const point$2 = {};
|
|
@@ -1245,7 +1251,7 @@ var LeaferUI = function(exports) {
|
|
|
1245
1251
|
return t;
|
|
1246
1252
|
},
|
|
1247
1253
|
toOffsetOutBounds(t, to, offsetBounds) {
|
|
1248
|
-
if (!to) to = t; else copy$
|
|
1254
|
+
if (!to) to = t; else copy$b(to, t);
|
|
1249
1255
|
if (!offsetBounds) offsetBounds = t;
|
|
1250
1256
|
to.offsetX = B.maxX(offsetBounds);
|
|
1251
1257
|
to.offsetY = B.maxY(offsetBounds);
|
|
@@ -1355,10 +1361,10 @@ var LeaferUI = function(exports) {
|
|
|
1355
1361
|
}
|
|
1356
1362
|
},
|
|
1357
1363
|
float(t, maxLength) {
|
|
1358
|
-
t.x = float$
|
|
1359
|
-
t.y = float$
|
|
1360
|
-
t.width = float$
|
|
1361
|
-
t.height = float$
|
|
1364
|
+
t.x = float$3(t.x, maxLength);
|
|
1365
|
+
t.y = float$3(t.y, maxLength);
|
|
1366
|
+
t.width = float$3(t.width, maxLength);
|
|
1367
|
+
t.height = float$3(t.height, maxLength);
|
|
1362
1368
|
},
|
|
1363
1369
|
add(t, bounds, isPoint) {
|
|
1364
1370
|
right$4 = t.x + t.width;
|
|
@@ -1392,7 +1398,7 @@ var LeaferUI = function(exports) {
|
|
|
1392
1398
|
if (bounds && (bounds.width || bounds.height)) {
|
|
1393
1399
|
if (first) {
|
|
1394
1400
|
first = false;
|
|
1395
|
-
if (!addMode) copy$
|
|
1401
|
+
if (!addMode) copy$b(t, bounds);
|
|
1396
1402
|
} else {
|
|
1397
1403
|
add$2(t, bounds);
|
|
1398
1404
|
}
|
|
@@ -1477,7 +1483,7 @@ var LeaferUI = function(exports) {
|
|
|
1477
1483
|
}
|
|
1478
1484
|
};
|
|
1479
1485
|
const B = BoundsHelper;
|
|
1480
|
-
const {add: add$2, copy: copy$
|
|
1486
|
+
const {add: add$2, copy: copy$b} = B;
|
|
1481
1487
|
class Bounds {
|
|
1482
1488
|
get minX() {
|
|
1483
1489
|
return BoundsHelper.minX(this);
|
|
@@ -2084,7 +2090,7 @@ var LeaferUI = function(exports) {
|
|
|
2084
2090
|
__decorate([ contextMethod() ], Canvas.prototype, "fillText", null);
|
|
2085
2091
|
__decorate([ contextMethod() ], Canvas.prototype, "measureText", null);
|
|
2086
2092
|
__decorate([ contextMethod() ], Canvas.prototype, "strokeText", null);
|
|
2087
|
-
const {copy: copy$
|
|
2093
|
+
const {copy: copy$a, multiplyParent: multiplyParent$4, pixelScale: pixelScale} = MatrixHelper, {round: round$4} = Math, tempPixelBounds = new Bounds, tempPixelBounds2 = new Bounds;
|
|
2088
2094
|
const minSize = {
|
|
2089
2095
|
width: 1,
|
|
2090
2096
|
height: 1,
|
|
@@ -2241,7 +2247,7 @@ var LeaferUI = function(exports) {
|
|
|
2241
2247
|
const {pixelRatio: pixelRatio} = this;
|
|
2242
2248
|
this.filter = `blur(${blur * pixelRatio}px)`;
|
|
2243
2249
|
}
|
|
2244
|
-
copyWorld(canvas, from, to, blendMode, ceilPixel
|
|
2250
|
+
copyWorld(canvas, from, to, blendMode, ceilPixel) {
|
|
2245
2251
|
if (blendMode) this.blendMode = blendMode;
|
|
2246
2252
|
if (from) {
|
|
2247
2253
|
this.setTempPixelBounds(from, ceilPixel);
|
|
@@ -2252,7 +2258,7 @@ var LeaferUI = function(exports) {
|
|
|
2252
2258
|
}
|
|
2253
2259
|
if (blendMode) this.blendMode = "source-over";
|
|
2254
2260
|
}
|
|
2255
|
-
copyWorldToInner(canvas, fromWorld, toInnerBounds, blendMode, ceilPixel
|
|
2261
|
+
copyWorldToInner(canvas, fromWorld, toInnerBounds, blendMode, ceilPixel) {
|
|
2256
2262
|
if (fromWorld.b || fromWorld.c) {
|
|
2257
2263
|
this.save();
|
|
2258
2264
|
this.resetTransform();
|
|
@@ -2265,7 +2271,7 @@ var LeaferUI = function(exports) {
|
|
|
2265
2271
|
if (blendMode) this.blendMode = "source-over";
|
|
2266
2272
|
}
|
|
2267
2273
|
}
|
|
2268
|
-
copyWorldByReset(canvas, from, to, blendMode, onlyResetTransform, ceilPixel
|
|
2274
|
+
copyWorldByReset(canvas, from, to, blendMode, onlyResetTransform, ceilPixel) {
|
|
2269
2275
|
this.resetTransform();
|
|
2270
2276
|
this.copyWorld(canvas, from, to, blendMode, ceilPixel);
|
|
2271
2277
|
if (!onlyResetTransform) this.useWorldTransform();
|
|
@@ -2335,7 +2341,7 @@ var LeaferUI = function(exports) {
|
|
|
2335
2341
|
getSameCanvas(useSameWorldTransform, useSameSmooth) {
|
|
2336
2342
|
const {size: size, pixelSnap: pixelSnap} = this, canvas = this.manager ? this.manager.get(size) : Creator.canvas(Object.assign({}, size));
|
|
2337
2343
|
canvas.save();
|
|
2338
|
-
if (useSameWorldTransform) copy$
|
|
2344
|
+
if (useSameWorldTransform) copy$a(canvas.worldTransform, this.worldTransform), canvas.useWorldTransform();
|
|
2339
2345
|
if (useSameSmooth) canvas.smooth = this.smooth;
|
|
2340
2346
|
canvas.pixelSnap !== pixelSnap && (canvas.pixelSnap = pixelSnap);
|
|
2341
2347
|
return canvas;
|
|
@@ -2463,18 +2469,18 @@ var LeaferUI = function(exports) {
|
|
|
2463
2469
|
data[0] ? drawer.arcTo(x, y, right, y, data[0]) : drawer.lineTo(x, y);
|
|
2464
2470
|
}
|
|
2465
2471
|
};
|
|
2466
|
-
const {sin: sin$4, cos: cos$4, hypot: hypot, atan2: atan2$1, ceil: ceil$1, abs: abs$9, PI: PI$3, sqrt: sqrt$3, pow: pow$1} = Math;
|
|
2472
|
+
const {sin: sin$4, cos: cos$4, hypot: hypot$1, atan2: atan2$1, ceil: ceil$1, abs: abs$9, PI: PI$3, sqrt: sqrt$3, pow: pow$1} = Math;
|
|
2467
2473
|
const {setPoint: setPoint$4, addPoint: addPoint$2} = TwoPointBoundsHelper;
|
|
2468
2474
|
const {set: set$1, toNumberPoints: toNumberPoints$1} = PointHelper;
|
|
2469
2475
|
const {M: M$a, L: L$a, C: C$8, Q: Q$7, Z: Z$8} = PathCommandMap;
|
|
2470
|
-
const tempPoint$
|
|
2476
|
+
const tempPoint$3 = {};
|
|
2471
2477
|
const BezierHelper = {
|
|
2472
2478
|
points(data, originPoints, curve, close) {
|
|
2473
2479
|
let points = toNumberPoints$1(originPoints);
|
|
2474
2480
|
data.push(M$a, points[0], points[1]);
|
|
2475
2481
|
if (curve && points.length > 5) {
|
|
2476
2482
|
let aX, aY, bX, bY, cX, cY, c1X, c1Y, c2X, c2Y;
|
|
2477
|
-
let ba, cb, d, len = points.length;
|
|
2483
|
+
let baX, baY, ba, cb, d, len = points.length;
|
|
2478
2484
|
const t = curve === true ? .5 : curve;
|
|
2479
2485
|
if (close) {
|
|
2480
2486
|
points = [ points[len - 2], points[len - 1], ...points, points[0], points[1], points[2], points[3] ];
|
|
@@ -2487,7 +2493,9 @@ var LeaferUI = function(exports) {
|
|
|
2487
2493
|
bY = points[i + 1];
|
|
2488
2494
|
cX = points[i + 2];
|
|
2489
2495
|
cY = points[i + 3];
|
|
2490
|
-
|
|
2496
|
+
baX = bX - aX;
|
|
2497
|
+
baY = bY - aY;
|
|
2498
|
+
ba = sqrt$3(pow$1(baX, 2) + pow$1(baY, 2));
|
|
2491
2499
|
cb = sqrt$3(pow$1(cX - bX, 2) + pow$1(cY - bY, 2));
|
|
2492
2500
|
if (!ba && !cb) continue;
|
|
2493
2501
|
d = ba + cb;
|
|
@@ -2500,7 +2508,7 @@ var LeaferUI = function(exports) {
|
|
|
2500
2508
|
if (i === 2) {
|
|
2501
2509
|
if (!close) data.push(Q$7, c1X, c1Y, bX, bY);
|
|
2502
2510
|
} else {
|
|
2503
|
-
data.push(C$8, c2X, c2Y, c1X, c1Y, bX, bY);
|
|
2511
|
+
if (baX || baY) data.push(C$8, c2X, c2Y, c1X, c1Y, bX, bY);
|
|
2504
2512
|
}
|
|
2505
2513
|
c2X = bX + cb * cX;
|
|
2506
2514
|
c2Y = bY + cb * cY;
|
|
@@ -2529,8 +2537,8 @@ var LeaferUI = function(exports) {
|
|
|
2529
2537
|
const CBy = toY - y1;
|
|
2530
2538
|
let startRadian = atan2$1(BAy, BAx);
|
|
2531
2539
|
let endRadian = atan2$1(CBy, CBx);
|
|
2532
|
-
const lenBA = hypot(BAx, BAy);
|
|
2533
|
-
const lenCB = hypot(CBx, CBy);
|
|
2540
|
+
const lenBA = hypot$1(BAx, BAy);
|
|
2541
|
+
const lenCB = hypot$1(CBx, CBy);
|
|
2534
2542
|
let totalRadian = endRadian - startRadian;
|
|
2535
2543
|
if (totalRadian < 0) totalRadian += PI2;
|
|
2536
2544
|
if (lenBA < 1e-12 || lenCB < 1e-12 || totalRadian < 1e-12 || abs$9(totalRadian - PI$3) < 1e-12) {
|
|
@@ -2635,8 +2643,8 @@ var LeaferUI = function(exports) {
|
|
|
2635
2643
|
addMode ? addPoint$2(pointBounds, fromX, fromY) : setPoint$4(pointBounds, fromX, fromY);
|
|
2636
2644
|
addPoint$2(pointBounds, toX, toY);
|
|
2637
2645
|
for (let i = 0, len = tList.length; i < len; i++) {
|
|
2638
|
-
getPointAndSet(tList[i], fromX, fromY, x1, y1, x2, y2, toX, toY, tempPoint$
|
|
2639
|
-
addPoint$2(pointBounds, tempPoint$
|
|
2646
|
+
getPointAndSet(tList[i], fromX, fromY, x1, y1, x2, y2, toX, toY, tempPoint$3);
|
|
2647
|
+
addPoint$2(pointBounds, tempPoint$3.x, tempPoint$3.y);
|
|
2640
2648
|
}
|
|
2641
2649
|
},
|
|
2642
2650
|
getPointAndSet(t, fromX, fromY, x1, y1, x2, y2, toX, toY, setPoint) {
|
|
@@ -3031,7 +3039,7 @@ var LeaferUI = function(exports) {
|
|
|
3031
3039
|
const {current: current, pushData: pushData, copyData: copyData} = PathConvert;
|
|
3032
3040
|
const {M: M$8, L: L$8, C: C$6, Q: Q$5, Z: Z$6, N: N$4, D: D$5, X: X$4, G: G$4, F: F$5, O: O$5, P: P$4, U: U$4} = PathCommandMap;
|
|
3033
3041
|
const {getMinDistanceFrom: getMinDistanceFrom, getRadianFrom: getRadianFrom} = PointHelper;
|
|
3034
|
-
const {tan: tan, min: min$
|
|
3042
|
+
const {tan: tan, min: min$2, abs: abs$8} = Math;
|
|
3035
3043
|
const startPoint = {};
|
|
3036
3044
|
const PathCommandDataHelper = {
|
|
3037
3045
|
beginPath(data) {
|
|
@@ -3068,6 +3076,7 @@ var LeaferUI = function(exports) {
|
|
|
3068
3076
|
}
|
|
3069
3077
|
},
|
|
3070
3078
|
ellipse(data, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise) {
|
|
3079
|
+
if (radiusX === radiusY) return arc$2(data, x, y, radiusX, startAngle, endAngle, anticlockwise);
|
|
3071
3080
|
if (isNull(rotation)) {
|
|
3072
3081
|
data.push(F$5, x, y, radiusX, radiusY);
|
|
3073
3082
|
} else {
|
|
@@ -3080,6 +3089,7 @@ var LeaferUI = function(exports) {
|
|
|
3080
3089
|
if (isNull(startAngle)) {
|
|
3081
3090
|
data.push(P$4, x, y, radius);
|
|
3082
3091
|
} else {
|
|
3092
|
+
if (isNull(startAngle)) startAngle = 0;
|
|
3083
3093
|
if (isNull(endAngle)) endAngle = 360;
|
|
3084
3094
|
data.push(O$5, x, y, radius, startAngle, endAngle, anticlockwise ? 1 : 0);
|
|
3085
3095
|
}
|
|
@@ -3087,7 +3097,7 @@ var LeaferUI = function(exports) {
|
|
|
3087
3097
|
arcTo(data, x1, y1, x2, y2, radius, lastX, lastY) {
|
|
3088
3098
|
if (!isUndefined(lastX)) {
|
|
3089
3099
|
const d = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2);
|
|
3090
|
-
radius = min$
|
|
3100
|
+
radius = min$2(radius, min$2(d / 2, d / 2 * abs$8(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
|
|
3091
3101
|
}
|
|
3092
3102
|
data.push(U$4, x1, y1, x2, y2, radius);
|
|
3093
3103
|
},
|
|
@@ -3280,7 +3290,7 @@ var LeaferUI = function(exports) {
|
|
|
3280
3290
|
};
|
|
3281
3291
|
const {M: M$6, L: L$6, C: C$4, Q: Q$3, Z: Z$4, N: N$2, D: D$3, X: X$2, G: G$2, F: F$3, O: O$3, P: P$2, U: U$2} = PathCommandMap;
|
|
3282
3292
|
const {toTwoPointBounds: toTwoPointBounds, toTwoPointBoundsByQuadraticCurve: toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc: arc, ellipse: ellipse$1} = BezierHelper;
|
|
3283
|
-
const {addPointBounds: addPointBounds, copy: copy$
|
|
3293
|
+
const {addPointBounds: addPointBounds, copy: copy$9, addPoint: addPoint$1, setPoint: setPoint$3, addBounds: addBounds, toBounds: toBounds$2} = TwoPointBoundsHelper;
|
|
3284
3294
|
const debug$d = Debug.get("PathBounds");
|
|
3285
3295
|
let radius, radiusX, radiusY;
|
|
3286
3296
|
const tempPointBounds = {};
|
|
@@ -3356,7 +3366,7 @@ var LeaferUI = function(exports) {
|
|
|
3356
3366
|
|
|
3357
3367
|
case G$2:
|
|
3358
3368
|
ellipse$1(null, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], data[i + 6], data[i + 7], data[i + 8], tempPointBounds, setEndPoint);
|
|
3359
|
-
i === 0 ? copy$
|
|
3369
|
+
i === 0 ? copy$9(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
|
|
3360
3370
|
x = setEndPoint.x;
|
|
3361
3371
|
y = setEndPoint.y;
|
|
3362
3372
|
i += 9;
|
|
@@ -3374,7 +3384,7 @@ var LeaferUI = function(exports) {
|
|
|
3374
3384
|
|
|
3375
3385
|
case O$3:
|
|
3376
3386
|
arc(null, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], data[i + 6], tempPointBounds, setEndPoint);
|
|
3377
|
-
i === 0 ? copy$
|
|
3387
|
+
i === 0 ? copy$9(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
|
|
3378
3388
|
x = setEndPoint.x;
|
|
3379
3389
|
y = setEndPoint.y;
|
|
3380
3390
|
i += 7;
|
|
@@ -3391,7 +3401,7 @@ var LeaferUI = function(exports) {
|
|
|
3391
3401
|
|
|
3392
3402
|
case U$2:
|
|
3393
3403
|
arcTo$1(null, x, y, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], tempPointBounds, setEndPoint);
|
|
3394
|
-
i === 0 ? copy$
|
|
3404
|
+
i === 0 ? copy$9(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
|
|
3395
3405
|
x = setEndPoint.x;
|
|
3396
3406
|
y = setEndPoint.y;
|
|
3397
3407
|
i += 6;
|
|
@@ -3411,6 +3421,7 @@ var LeaferUI = function(exports) {
|
|
|
3411
3421
|
smooth(data, cornerRadius, _cornerSmoothing) {
|
|
3412
3422
|
let command, lastCommand, commandLen;
|
|
3413
3423
|
let i = 0, x = 0, y = 0, startX = 0, startY = 0, secondX = 0, secondY = 0, lastX = 0, lastY = 0;
|
|
3424
|
+
if (isArray(cornerRadius)) cornerRadius = cornerRadius[0] || 0;
|
|
3414
3425
|
const len = data.length;
|
|
3415
3426
|
const smooth = [];
|
|
3416
3427
|
while (i < len) {
|
|
@@ -3808,7 +3819,9 @@ var LeaferUI = function(exports) {
|
|
|
3808
3819
|
const ImageManager = {
|
|
3809
3820
|
maxRecycled: 10,
|
|
3810
3821
|
recycledList: [],
|
|
3811
|
-
patternTasker: new TaskProcessor
|
|
3822
|
+
patternTasker: new TaskProcessor({
|
|
3823
|
+
parallel: 1
|
|
3824
|
+
}),
|
|
3812
3825
|
get(config) {
|
|
3813
3826
|
let image = Resource.get(config.url);
|
|
3814
3827
|
if (!image) Resource.set(config.url, image = Creator.image(config));
|
|
@@ -3862,6 +3875,10 @@ var LeaferUI = function(exports) {
|
|
|
3862
3875
|
get url() {
|
|
3863
3876
|
return this.config.url;
|
|
3864
3877
|
}
|
|
3878
|
+
get crossOrigin() {
|
|
3879
|
+
const {crossOrigin: crossOrigin} = this.config;
|
|
3880
|
+
return isUndefined(crossOrigin) ? Platform.image.crossOrigin : crossOrigin;
|
|
3881
|
+
}
|
|
3865
3882
|
get completed() {
|
|
3866
3883
|
return this.ready || !!this.error;
|
|
3867
3884
|
}
|
|
@@ -3879,12 +3896,14 @@ var LeaferUI = function(exports) {
|
|
|
3879
3896
|
ImageManager.isFormat("svg", config) && (this.isSVG = true);
|
|
3880
3897
|
ImageManager.hasAlphaPixel(config) && (this.hasAlphaPixel = true);
|
|
3881
3898
|
}
|
|
3882
|
-
load(onSuccess, onError) {
|
|
3899
|
+
load(onSuccess, onError, thumbSize) {
|
|
3883
3900
|
if (!this.loading) {
|
|
3884
3901
|
this.loading = true;
|
|
3885
|
-
const {crossOrigin: crossOrigin} = this.config;
|
|
3886
3902
|
Resource.tasker.add(() => __awaiter(this, void 0, void 0, function*() {
|
|
3887
|
-
return yield Platform.origin.loadImage(this.
|
|
3903
|
+
return yield Platform.origin.loadImage(this.getLoadUrl(thumbSize), this.crossOrigin, this).then(img => {
|
|
3904
|
+
if (thumbSize) this.setThumbView(img);
|
|
3905
|
+
this.setView(img);
|
|
3906
|
+
}).catch(e => {
|
|
3888
3907
|
this.error = e;
|
|
3889
3908
|
this.onComplete(false);
|
|
3890
3909
|
});
|
|
@@ -3905,9 +3924,11 @@ var LeaferUI = function(exports) {
|
|
|
3905
3924
|
}
|
|
3906
3925
|
setView(img) {
|
|
3907
3926
|
this.ready = true;
|
|
3908
|
-
this.width
|
|
3909
|
-
|
|
3910
|
-
|
|
3927
|
+
if (!this.width) {
|
|
3928
|
+
this.width = img.width;
|
|
3929
|
+
this.height = img.height;
|
|
3930
|
+
this.view = img;
|
|
3931
|
+
}
|
|
3911
3932
|
this.onComplete(true);
|
|
3912
3933
|
}
|
|
3913
3934
|
onComplete(isSuccess) {
|
|
@@ -3953,6 +3974,19 @@ var LeaferUI = function(exports) {
|
|
|
3953
3974
|
Platform.image.setPatternTransform(pattern, transform, paint);
|
|
3954
3975
|
return pattern;
|
|
3955
3976
|
}
|
|
3977
|
+
getLoadUrl(_thumbSize) {
|
|
3978
|
+
return this.url;
|
|
3979
|
+
}
|
|
3980
|
+
setThumbView(_view) {}
|
|
3981
|
+
getThumbSize() {
|
|
3982
|
+
return undefined;
|
|
3983
|
+
}
|
|
3984
|
+
getMinLevel() {
|
|
3985
|
+
return undefined;
|
|
3986
|
+
}
|
|
3987
|
+
getLevelData(_level) {
|
|
3988
|
+
return undefined;
|
|
3989
|
+
}
|
|
3956
3990
|
clearLevels(_checkUse) {}
|
|
3957
3991
|
destroy() {
|
|
3958
3992
|
this.clearLevels();
|
|
@@ -4338,7 +4372,7 @@ var LeaferUI = function(exports) {
|
|
|
4338
4372
|
EventCreator.register(target);
|
|
4339
4373
|
};
|
|
4340
4374
|
}
|
|
4341
|
-
const {copy: copy$
|
|
4375
|
+
const {copy: copy$8, toInnerPoint: toInnerPoint$1, toOuterPoint: toOuterPoint$1, scaleOfOuter: scaleOfOuter$2, rotateOfOuter: rotateOfOuter$2, skewOfOuter: skewOfOuter, multiplyParent: multiplyParent$3, divideParent: divideParent, getLayout: getLayout} = MatrixHelper;
|
|
4342
4376
|
const matrix$3 = {}, {round: round$3} = Math;
|
|
4343
4377
|
const LeafHelper = {
|
|
4344
4378
|
updateAllMatrix(leaf, checkAutoLayout, waitAutoLayout) {
|
|
@@ -4434,7 +4468,7 @@ var LeaferUI = function(exports) {
|
|
|
4434
4468
|
if (scaleY) transition = scaleY;
|
|
4435
4469
|
scaleY = scaleX;
|
|
4436
4470
|
}
|
|
4437
|
-
copy$
|
|
4471
|
+
copy$8(matrix$3, o);
|
|
4438
4472
|
scaleOfOuter$2(matrix$3, origin, scaleX, scaleY);
|
|
4439
4473
|
if (L$4.hasHighPosition(t)) {
|
|
4440
4474
|
L$4.setTransform(t, matrix$3, resize, transition);
|
|
@@ -4453,7 +4487,7 @@ var LeaferUI = function(exports) {
|
|
|
4453
4487
|
},
|
|
4454
4488
|
rotateOfLocal(t, origin, angle, transition) {
|
|
4455
4489
|
const o = t.__localMatrix;
|
|
4456
|
-
copy$
|
|
4490
|
+
copy$8(matrix$3, o);
|
|
4457
4491
|
rotateOfOuter$2(matrix$3, origin, angle);
|
|
4458
4492
|
if (L$4.hasHighPosition(t)) L$4.setTransform(t, matrix$3, false, transition); else t.set({
|
|
4459
4493
|
x: t.x + matrix$3.e - o.e,
|
|
@@ -4465,18 +4499,18 @@ var LeaferUI = function(exports) {
|
|
|
4465
4499
|
L$4.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize, transition);
|
|
4466
4500
|
},
|
|
4467
4501
|
skewOfLocal(t, origin, skewX, skewY = 0, resize, transition) {
|
|
4468
|
-
copy$
|
|
4502
|
+
copy$8(matrix$3, t.__localMatrix);
|
|
4469
4503
|
skewOfOuter(matrix$3, origin, skewX, skewY);
|
|
4470
4504
|
L$4.setTransform(t, matrix$3, resize, transition);
|
|
4471
4505
|
},
|
|
4472
4506
|
transformWorld(t, transform, resize, transition) {
|
|
4473
|
-
copy$
|
|
4507
|
+
copy$8(matrix$3, t.worldTransform);
|
|
4474
4508
|
multiplyParent$3(matrix$3, transform);
|
|
4475
4509
|
if (t.parent) divideParent(matrix$3, t.parent.scrollWorldTransform);
|
|
4476
4510
|
L$4.setTransform(t, matrix$3, resize, transition);
|
|
4477
4511
|
},
|
|
4478
4512
|
transform(t, transform, resize, transition) {
|
|
4479
|
-
copy$
|
|
4513
|
+
copy$8(matrix$3, t.localTransform);
|
|
4480
4514
|
multiplyParent$3(matrix$3, transform);
|
|
4481
4515
|
L$4.setTransform(t, matrix$3, resize, transition);
|
|
4482
4516
|
},
|
|
@@ -4514,7 +4548,7 @@ var LeaferUI = function(exports) {
|
|
|
4514
4548
|
return innerOrigin;
|
|
4515
4549
|
},
|
|
4516
4550
|
getRelativeWorld(t, relative, temp) {
|
|
4517
|
-
copy$
|
|
4551
|
+
copy$8(matrix$3, t.worldTransform);
|
|
4518
4552
|
divideParent(matrix$3, relative.scrollWorldTransform);
|
|
4519
4553
|
return temp ? matrix$3 : Object.assign({}, matrix$3);
|
|
4520
4554
|
},
|
|
@@ -4710,7 +4744,7 @@ var LeaferUI = function(exports) {
|
|
|
4710
4744
|
}
|
|
4711
4745
|
};
|
|
4712
4746
|
const {getRelativeWorld: getRelativeWorld$1, updateBounds: updateBounds$3} = LeafHelper;
|
|
4713
|
-
const {toOuterOf: toOuterOf$3, getPoints: getPoints, copy: copy$
|
|
4747
|
+
const {toOuterOf: toOuterOf$3, getPoints: getPoints, copy: copy$7} = BoundsHelper;
|
|
4714
4748
|
const localContent = "_localContentBounds";
|
|
4715
4749
|
const worldContent = "_worldContentBounds", worldBox = "_worldBoxBounds", worldStroke = "_worldStrokeBounds";
|
|
4716
4750
|
class LeafLayout {
|
|
@@ -4946,7 +4980,7 @@ var LeaferUI = function(exports) {
|
|
|
4946
4980
|
matrix = getRelativeWorld$1(leaf, relative, true);
|
|
4947
4981
|
}
|
|
4948
4982
|
if (!layoutBounds) layoutBounds = MatrixHelper.getLayout(matrix);
|
|
4949
|
-
copy$
|
|
4983
|
+
copy$7(layoutBounds, bounds);
|
|
4950
4984
|
PointHelper.copy(layoutBounds, point);
|
|
4951
4985
|
if (unscale) {
|
|
4952
4986
|
const {scaleX: scaleX, scaleY: scaleY} = layoutBounds;
|
|
@@ -5491,7 +5525,7 @@ var LeaferUI = function(exports) {
|
|
|
5491
5525
|
}
|
|
5492
5526
|
};
|
|
5493
5527
|
const {setLayout: setLayout, multiplyParent: multiplyParent$2, translateInner: translateInner, defaultWorld: defaultWorld} = MatrixHelper;
|
|
5494
|
-
const {toPoint: toPoint$4, tempPoint: tempPoint$
|
|
5528
|
+
const {toPoint: toPoint$4, tempPoint: tempPoint$2} = AroundHelper;
|
|
5495
5529
|
const LeafMatrix = {
|
|
5496
5530
|
__updateWorldMatrix() {
|
|
5497
5531
|
const {parent: parent, __layout: __layout, __world: __world, __scrollWorld: __scrollWorld, __: __} = this;
|
|
@@ -5510,8 +5544,8 @@ var LeaferUI = function(exports) {
|
|
|
5510
5544
|
local.e = data.x + data.offsetX;
|
|
5511
5545
|
local.f = data.y + data.offsetY;
|
|
5512
5546
|
if (data.around || data.origin) {
|
|
5513
|
-
toPoint$4(data.around || data.origin, layout.boxBounds, tempPoint$
|
|
5514
|
-
translateInner(local, -tempPoint$
|
|
5547
|
+
toPoint$4(data.around || data.origin, layout.boxBounds, tempPoint$2);
|
|
5548
|
+
translateInner(local, -tempPoint$2.x, -tempPoint$2.y, !data.around);
|
|
5515
5549
|
}
|
|
5516
5550
|
}
|
|
5517
5551
|
this.__layout.matrixChanged = undefined;
|
|
@@ -5519,7 +5553,7 @@ var LeaferUI = function(exports) {
|
|
|
5519
5553
|
};
|
|
5520
5554
|
const {updateMatrix: updateMatrix$3, updateAllMatrix: updateAllMatrix$3} = LeafHelper;
|
|
5521
5555
|
const {updateBounds: updateBounds$2} = BranchHelper;
|
|
5522
|
-
const {toOuterOf: toOuterOf$2, copyAndSpread: copyAndSpread$3, copy: copy$
|
|
5556
|
+
const {toOuterOf: toOuterOf$2, copyAndSpread: copyAndSpread$3, copy: copy$6} = BoundsHelper;
|
|
5523
5557
|
const {toBounds: toBounds$1} = PathBounds;
|
|
5524
5558
|
const LeafBounds = {
|
|
5525
5559
|
__updateWorldBounds() {
|
|
@@ -5628,7 +5662,7 @@ var LeaferUI = function(exports) {
|
|
|
5628
5662
|
},
|
|
5629
5663
|
__updateRenderBounds(_bounds) {
|
|
5630
5664
|
const layout = this.__layout, {renderSpread: renderSpread} = layout;
|
|
5631
|
-
isNumber(renderSpread) && renderSpread <= 0 ? copy$
|
|
5665
|
+
isNumber(renderSpread) && renderSpread <= 0 ? copy$6(layout.renderBounds, layout.strokeBounds) : copyAndSpread$3(layout.renderBounds, layout.boxBounds, renderSpread);
|
|
5632
5666
|
}
|
|
5633
5667
|
};
|
|
5634
5668
|
const LeafRender = {
|
|
@@ -5724,7 +5758,7 @@ var LeaferUI = function(exports) {
|
|
|
5724
5758
|
const {stintSet: stintSet$4} = DataHelper;
|
|
5725
5759
|
const {toInnerPoint: toInnerPoint, toOuterPoint: toOuterPoint, multiplyParent: multiplyParent$1} = MatrixHelper;
|
|
5726
5760
|
const {toOuterOf: toOuterOf$1} = BoundsHelper;
|
|
5727
|
-
const {copy: copy$
|
|
5761
|
+
const {copy: copy$5, move: move$8} = PointHelper;
|
|
5728
5762
|
const {moveLocal: moveLocal, zoomOfLocal: zoomOfLocal, rotateOfLocal: rotateOfLocal, skewOfLocal: skewOfLocal, moveWorld: moveWorld, zoomOfWorld: zoomOfWorld, rotateOfWorld: rotateOfWorld, skewOfWorld: skewOfWorld, transform: transform, transformWorld: transformWorld, setTransform: setTransform, getFlipTransform: getFlipTransform, getLocalOrigin: getLocalOrigin, getRelativeWorld: getRelativeWorld, drop: drop} = LeafHelper;
|
|
5729
5763
|
exports.Leaf = class Leaf {
|
|
5730
5764
|
get tag() {
|
|
@@ -6041,14 +6075,14 @@ var LeaferUI = function(exports) {
|
|
|
6041
6075
|
if (this.parent) {
|
|
6042
6076
|
this.parent.worldToInner(world, to, distance, relative);
|
|
6043
6077
|
} else {
|
|
6044
|
-
if (to) copy$
|
|
6078
|
+
if (to) copy$5(to, world);
|
|
6045
6079
|
}
|
|
6046
6080
|
}
|
|
6047
6081
|
localToWorld(local, to, distance, relative) {
|
|
6048
6082
|
if (this.parent) {
|
|
6049
6083
|
this.parent.innerToWorld(local, to, distance, relative);
|
|
6050
6084
|
} else {
|
|
6051
|
-
if (to) copy$
|
|
6085
|
+
if (to) copy$5(to, local);
|
|
6052
6086
|
}
|
|
6053
6087
|
}
|
|
6054
6088
|
worldToInner(world, to, distance, relative) {
|
|
@@ -6513,7 +6547,7 @@ var LeaferUI = function(exports) {
|
|
|
6513
6547
|
this.levelMap = null;
|
|
6514
6548
|
}
|
|
6515
6549
|
}
|
|
6516
|
-
const version = "1.12.
|
|
6550
|
+
const version = "1.12.3";
|
|
6517
6551
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6518
6552
|
get allowBackgroundColor() {
|
|
6519
6553
|
return true;
|
|
@@ -7133,6 +7167,8 @@ var LeaferUI = function(exports) {
|
|
|
7133
7167
|
}
|
|
7134
7168
|
}
|
|
7135
7169
|
Renderer.clipSpread = 10;
|
|
7170
|
+
const tempPoint$1 = {};
|
|
7171
|
+
const {copyRadiusPoint: copyRadiusPoint$1} = PointHelper;
|
|
7136
7172
|
const {hitRadiusPoint: hitRadiusPoint$1} = BoundsHelper;
|
|
7137
7173
|
class Picker {
|
|
7138
7174
|
constructor(target, selector) {
|
|
@@ -7258,15 +7294,15 @@ var LeaferUI = function(exports) {
|
|
|
7258
7294
|
this.eachFind(branch.children, branch.__onlyHitMask);
|
|
7259
7295
|
}
|
|
7260
7296
|
eachFind(children, hitMask) {
|
|
7261
|
-
let child, hit;
|
|
7297
|
+
let child, hit, data;
|
|
7262
7298
|
const {point: point} = this, len = children.length;
|
|
7263
7299
|
for (let i = len - 1; i > -1; i--) {
|
|
7264
|
-
child = children[i];
|
|
7265
|
-
if (!
|
|
7266
|
-
hit = child.
|
|
7300
|
+
child = children[i], data = child.__;
|
|
7301
|
+
if (!data.visible || hitMask && !data.mask) continue;
|
|
7302
|
+
hit = hitRadiusPoint$1(child.__world, data.hitRadius ? copyRadiusPoint$1(tempPoint$1, point, data.hitRadius) : point);
|
|
7267
7303
|
if (child.isBranch) {
|
|
7268
7304
|
if (hit || child.__ignoreHitWorld) {
|
|
7269
|
-
if (child.isBranchLeaf &&
|
|
7305
|
+
if (child.isBranchLeaf && data.__clipAfterFill && !child.__hitWorld(point, true)) continue;
|
|
7270
7306
|
if (child.topChildren) this.eachFind(child.topChildren, false);
|
|
7271
7307
|
this.eachFind(child.children, child.__onlyHitMask);
|
|
7272
7308
|
if (child.isBranchLeaf) this.hitChild(child, point);
|
|
@@ -7710,7 +7746,7 @@ var LeaferUI = function(exports) {
|
|
|
7710
7746
|
return data;
|
|
7711
7747
|
}
|
|
7712
7748
|
}
|
|
7713
|
-
const {max: max$
|
|
7749
|
+
const {max: max$4, add: add$1} = FourNumberHelper;
|
|
7714
7750
|
const UIBounds = {
|
|
7715
7751
|
__updateStrokeSpread() {
|
|
7716
7752
|
let spread = 0, boxSpread = 0;
|
|
@@ -7725,7 +7761,7 @@ var LeaferUI = function(exports) {
|
|
|
7725
7761
|
}
|
|
7726
7762
|
if (data.__useArrow) spread += strokeWidth * 5;
|
|
7727
7763
|
if (box) {
|
|
7728
|
-
spread = max$
|
|
7764
|
+
spread = max$4(spread, box.__layout.strokeSpread = box.__updateStrokeSpread());
|
|
7729
7765
|
boxSpread = Math.max(boxSpread, box.__layout.strokeBoxSpread);
|
|
7730
7766
|
}
|
|
7731
7767
|
this.__layout.strokeBoxSpread = boxSpread;
|
|
@@ -7735,15 +7771,15 @@ var LeaferUI = function(exports) {
|
|
|
7735
7771
|
let spread = 0;
|
|
7736
7772
|
const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__, {strokeSpread: strokeSpread} = this.__layout, box = this.__box;
|
|
7737
7773
|
if (shadow) spread = Effect.getShadowRenderSpread(this, shadow);
|
|
7738
|
-
if (blur) spread = max$
|
|
7774
|
+
if (blur) spread = max$4(spread, blur);
|
|
7739
7775
|
if (filter) spread = add$1(spread, Filter.getSpread(filter));
|
|
7740
7776
|
if (renderSpread) spread = add$1(spread, renderSpread);
|
|
7741
7777
|
if (strokeSpread) spread = add$1(spread, strokeSpread);
|
|
7742
7778
|
let shapeSpread = spread;
|
|
7743
|
-
if (innerShadow) shapeSpread = max$
|
|
7744
|
-
if (backgroundBlur) shapeSpread = max$
|
|
7779
|
+
if (innerShadow) shapeSpread = max$4(shapeSpread, Effect.getInnerShadowSpread(this, innerShadow));
|
|
7780
|
+
if (backgroundBlur) shapeSpread = max$4(shapeSpread, backgroundBlur);
|
|
7745
7781
|
this.__layout.renderShapeSpread = shapeSpread;
|
|
7746
|
-
return box ? max$
|
|
7782
|
+
return box ? max$4(box.__updateRenderSpread(), spread) : spread;
|
|
7747
7783
|
}
|
|
7748
7784
|
};
|
|
7749
7785
|
const {stintSet: stintSet$2} = DataHelper;
|
|
@@ -7797,7 +7833,7 @@ var LeaferUI = function(exports) {
|
|
|
7797
7833
|
if (stroke && !__fillAfterStroke) data.__isStrokes ? Paint.strokes(stroke, this, canvas, options) : Paint.stroke(stroke, this, canvas, options);
|
|
7798
7834
|
}
|
|
7799
7835
|
} else {
|
|
7800
|
-
if (data.
|
|
7836
|
+
if (data.__pathForRender) drawFast(this, canvas, options); else this.__drawFast(canvas, options);
|
|
7801
7837
|
}
|
|
7802
7838
|
},
|
|
7803
7839
|
__drawShape(canvas, options) {
|
|
@@ -7917,7 +7953,7 @@ var LeaferUI = function(exports) {
|
|
|
7917
7953
|
getPath(curve, pathForRender) {
|
|
7918
7954
|
this.__layout.update();
|
|
7919
7955
|
let path = pathForRender ? this.__.__pathForRender : this.__.path;
|
|
7920
|
-
if (!path) pen.set(path = []), this.__drawPathByBox(pen);
|
|
7956
|
+
if (!path) pen.set(path = []), this.__drawPathByBox(pen, !pathForRender);
|
|
7921
7957
|
return curve ? PathConvert.toCanvasData(path, true) : path;
|
|
7922
7958
|
}
|
|
7923
7959
|
getPathString(curve, pathForRender, floatLength) {
|
|
@@ -7945,17 +7981,18 @@ var LeaferUI = function(exports) {
|
|
|
7945
7981
|
}
|
|
7946
7982
|
__drawPath(canvas) {
|
|
7947
7983
|
canvas.beginPath();
|
|
7948
|
-
this.__drawPathByData(canvas, this.__.path);
|
|
7984
|
+
this.__drawPathByData(canvas, this.__.path, true);
|
|
7949
7985
|
}
|
|
7950
|
-
__drawPathByData(drawer, data) {
|
|
7951
|
-
data ? PathDrawer.drawPathByData(drawer, data) : this.__drawPathByBox(drawer);
|
|
7986
|
+
__drawPathByData(drawer, data, ignoreCornerRadius) {
|
|
7987
|
+
data ? PathDrawer.drawPathByData(drawer, data) : this.__drawPathByBox(drawer, ignoreCornerRadius);
|
|
7952
7988
|
}
|
|
7953
|
-
__drawPathByBox(drawer) {
|
|
7989
|
+
__drawPathByBox(drawer, ignoreCornerRadius) {
|
|
7954
7990
|
const {x: x, y: y, width: width, height: height} = this.__layout.boxBounds;
|
|
7955
|
-
if (this.__.cornerRadius) {
|
|
7991
|
+
if (this.__.cornerRadius && !ignoreCornerRadius) {
|
|
7956
7992
|
const {cornerRadius: cornerRadius} = this.__;
|
|
7957
7993
|
drawer.roundRect(x, y, width, height, isNumber(cornerRadius) ? [ cornerRadius ] : cornerRadius);
|
|
7958
7994
|
} else drawer.rect(x, y, width, height);
|
|
7995
|
+
drawer.closePath();
|
|
7959
7996
|
}
|
|
7960
7997
|
drawImagePlaceholder(_paint, canvas, renderOptions) {
|
|
7961
7998
|
Paint.fill(this.__.placeholderColor, this, canvas, renderOptions);
|
|
@@ -8142,6 +8179,9 @@ var LeaferUI = function(exports) {
|
|
|
8142
8179
|
get layoutLocked() {
|
|
8143
8180
|
return !this.layouter.running;
|
|
8144
8181
|
}
|
|
8182
|
+
get view() {
|
|
8183
|
+
return this.canvas && this.canvas.view;
|
|
8184
|
+
}
|
|
8145
8185
|
get FPS() {
|
|
8146
8186
|
return this.renderer ? this.renderer.FPS : 60;
|
|
8147
8187
|
}
|
|
@@ -8193,7 +8233,6 @@ var LeaferUI = function(exports) {
|
|
|
8193
8233
|
this.__controllers.push(this.renderer = Creator.renderer(this, canvas, config), this.watcher = Creator.watcher(this, config), this.layouter = Creator.layouter(this, config));
|
|
8194
8234
|
if (this.isApp) this.__setApp();
|
|
8195
8235
|
this.__checkAutoLayout();
|
|
8196
|
-
this.view = canvas.view;
|
|
8197
8236
|
if (!parentApp) {
|
|
8198
8237
|
this.selector = Creator.selector(this);
|
|
8199
8238
|
this.interaction = Creator.interaction(this, canvas, this.selector, config);
|
|
@@ -8473,7 +8512,7 @@ var LeaferUI = function(exports) {
|
|
|
8473
8512
|
if (this.canvasManager) this.canvasManager.destroy();
|
|
8474
8513
|
}
|
|
8475
8514
|
if (this.canvas) this.canvas.destroy();
|
|
8476
|
-
this.config.view = this.
|
|
8515
|
+
this.config.view = this.parentApp = null;
|
|
8477
8516
|
if (this.userConfig) this.userConfig.view = null;
|
|
8478
8517
|
super.destroy();
|
|
8479
8518
|
setTimeout(() => {
|
|
@@ -8625,7 +8664,6 @@ var LeaferUI = function(exports) {
|
|
|
8625
8664
|
if (startAngle || endAngle) {
|
|
8626
8665
|
if (innerRadius < 1) ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius, 0, startAngle, endAngle, false);
|
|
8627
8666
|
ellipse(path, rx, ry, rx, ry, 0, endAngle, startAngle, true);
|
|
8628
|
-
if (innerRadius < 1) closePath$2(path);
|
|
8629
8667
|
} else {
|
|
8630
8668
|
if (innerRadius < 1) {
|
|
8631
8669
|
ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius);
|
|
@@ -8633,16 +8671,16 @@ var LeaferUI = function(exports) {
|
|
|
8633
8671
|
}
|
|
8634
8672
|
ellipse(path, rx, ry, rx, ry, 0, 360, 0, true);
|
|
8635
8673
|
}
|
|
8636
|
-
if (Platform.ellipseToCurve) this.__.path = this.getPath(true);
|
|
8637
8674
|
} else {
|
|
8638
8675
|
if (startAngle || endAngle) {
|
|
8639
8676
|
moveTo$3(path, rx, ry);
|
|
8640
8677
|
ellipse(path, rx, ry, rx, ry, 0, startAngle, endAngle, false);
|
|
8641
|
-
closePath$2(path);
|
|
8642
8678
|
} else {
|
|
8643
8679
|
ellipse(path, rx, ry, rx, ry);
|
|
8644
8680
|
}
|
|
8645
8681
|
}
|
|
8682
|
+
closePath$2(path);
|
|
8683
|
+
if (Platform.ellipseToCurve) this.__.path = this.getPath(true);
|
|
8646
8684
|
}
|
|
8647
8685
|
};
|
|
8648
8686
|
__decorate([ dataProcessor(EllipseData) ], exports.Ellipse.prototype, "__", void 0);
|
|
@@ -9203,7 +9241,7 @@ var LeaferUI = function(exports) {
|
|
|
9203
9241
|
EventCreator.changeName(oldName, newName);
|
|
9204
9242
|
}
|
|
9205
9243
|
}
|
|
9206
|
-
const {min: min, max: max$
|
|
9244
|
+
const {min: min$1, max: max$3, abs: abs$7} = Math, {float: float$2, sign: sign$2} = MathHelper, {minX: minX, maxX: maxX, minY: minY, maxY: maxY} = BoundsHelper;
|
|
9207
9245
|
const tempContent = new Bounds, tempDragBounds = new Bounds;
|
|
9208
9246
|
const DragBoundsHelper = {
|
|
9209
9247
|
limitMove(leaf, move) {
|
|
@@ -9241,8 +9279,8 @@ var LeaferUI = function(exports) {
|
|
|
9241
9279
|
} else {
|
|
9242
9280
|
if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
|
|
9243
9281
|
}
|
|
9244
|
-
move.x = float$
|
|
9245
|
-
move.y = float$
|
|
9282
|
+
move.x = float$2(move.x);
|
|
9283
|
+
move.y = float$2(move.y);
|
|
9246
9284
|
return move;
|
|
9247
9285
|
},
|
|
9248
9286
|
getValidScaleOf(content, dragBounds, dragBoundsType, origin, scale, lockRatio, change) {
|
|
@@ -9254,44 +9292,44 @@ var LeaferUI = function(exports) {
|
|
|
9254
9292
|
let correctScaleX = 1, correctScaleY = 1, aScale, bScale, aSize, bSize;
|
|
9255
9293
|
if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
9256
9294
|
if (scale.x < 0) tempContent.scaleOf(origin, correctScaleX = 1 / scale.x, 1);
|
|
9257
|
-
aSize = float$
|
|
9258
|
-
bSize = float$
|
|
9295
|
+
aSize = float$2(tempContent.minX - tempDragBounds.minX);
|
|
9296
|
+
bSize = float$2(tempDragBounds.maxX - tempContent.maxX);
|
|
9259
9297
|
aScale = originLeftScale && aSize > 0 ? 1 + aSize / (originLeftScale * tempContent.width) : 1;
|
|
9260
9298
|
bScale = originRightScale && bSize > 0 ? 1 + bSize / (originRightScale * tempContent.width) : 1;
|
|
9261
|
-
correctScaleX *= max$
|
|
9299
|
+
correctScaleX *= max$3(aScale, bScale);
|
|
9262
9300
|
} else {
|
|
9263
9301
|
if (scale.x < 0) {
|
|
9264
|
-
if (float$
|
|
9302
|
+
if (float$2(minX(content) - minX(dragBounds)) <= 0 || float$2(maxX(dragBounds) - maxX(content)) <= 0) tempContent.scaleOf(origin, correctScaleX = 1 / scale.x, 1);
|
|
9265
9303
|
tempContent.unsign();
|
|
9266
9304
|
}
|
|
9267
|
-
aSize = float$
|
|
9268
|
-
bSize = float$
|
|
9305
|
+
aSize = float$2(tempDragBounds.minX - tempContent.minX);
|
|
9306
|
+
bSize = float$2(tempContent.maxX - tempDragBounds.maxX);
|
|
9269
9307
|
aScale = originLeftScale && aSize > 0 ? 1 - aSize / (originLeftScale * tempContent.width) : 1;
|
|
9270
9308
|
bScale = originRightScale && bSize > 0 ? 1 - bSize / (originRightScale * tempContent.width) : 1;
|
|
9271
|
-
correctScaleX *= min(aScale, bScale);
|
|
9309
|
+
correctScaleX *= min$1(aScale, bScale);
|
|
9272
9310
|
}
|
|
9273
9311
|
if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
9274
9312
|
if (scale.y < 0) tempContent.scaleOf(origin, 1, correctScaleY = 1 / scale.y);
|
|
9275
|
-
aSize = float$
|
|
9276
|
-
bSize = float$
|
|
9313
|
+
aSize = float$2(tempContent.minY - tempDragBounds.minY);
|
|
9314
|
+
bSize = float$2(tempDragBounds.maxY - tempContent.maxY);
|
|
9277
9315
|
aScale = originTopScale && aSize > 0 ? 1 + aSize / (originTopScale * tempContent.height) : 1;
|
|
9278
9316
|
bScale = originBottomScale && bSize > 0 ? 1 + bSize / (originBottomScale * tempContent.height) : 1;
|
|
9279
|
-
correctScaleY *= max$
|
|
9317
|
+
correctScaleY *= max$3(aScale, bScale);
|
|
9280
9318
|
if (lockRatio) {
|
|
9281
|
-
aScale = max$
|
|
9319
|
+
aScale = max$3(abs$7(correctScaleX), abs$7(correctScaleY));
|
|
9282
9320
|
correctScaleX = sign$2(correctScaleX) * aScale;
|
|
9283
9321
|
correctScaleY = sign$2(correctScaleY) * aScale;
|
|
9284
9322
|
}
|
|
9285
9323
|
} else {
|
|
9286
9324
|
if (scale.y < 0) {
|
|
9287
|
-
if (float$
|
|
9325
|
+
if (float$2(minY(content) - minY(dragBounds)) <= 0 || float$2(maxY(dragBounds) - maxY(content)) <= 0) tempContent.scaleOf(origin, 1, correctScaleY = 1 / scale.y);
|
|
9288
9326
|
tempContent.unsign();
|
|
9289
9327
|
}
|
|
9290
|
-
aSize = float$
|
|
9291
|
-
bSize = float$
|
|
9328
|
+
aSize = float$2(tempDragBounds.minY - tempContent.minY);
|
|
9329
|
+
bSize = float$2(tempContent.maxY - tempDragBounds.maxY);
|
|
9292
9330
|
aScale = originTopScale && aSize > 0 ? 1 - aSize / (originTopScale * tempContent.height) : 1;
|
|
9293
9331
|
bScale = originBottomScale && bSize > 0 ? 1 - bSize / (originBottomScale * tempContent.height) : 1;
|
|
9294
|
-
correctScaleY *= min(aScale, bScale);
|
|
9332
|
+
correctScaleY *= min$1(aScale, bScale);
|
|
9295
9333
|
}
|
|
9296
9334
|
scale.x *= isFinite$1(correctScaleX) ? correctScaleX : 1;
|
|
9297
9335
|
scale.y *= isFinite$1(correctScaleY) ? correctScaleY : 1;
|
|
@@ -9397,7 +9435,10 @@ var LeaferUI = function(exports) {
|
|
|
9397
9435
|
exports.MoveEvent.BEFORE_MOVE = "move.before_move";
|
|
9398
9436
|
exports.MoveEvent.START = "move.start";
|
|
9399
9437
|
exports.MoveEvent.MOVE = "move";
|
|
9438
|
+
exports.MoveEvent.DRAG_ANIMATE = "move.drag_animate";
|
|
9400
9439
|
exports.MoveEvent.END = "move.end";
|
|
9440
|
+
exports.MoveEvent.PULL_DOWN = "move.pull_down";
|
|
9441
|
+
exports.MoveEvent.REACH_BOTTOM = "move.reach_bottom";
|
|
9401
9442
|
exports.MoveEvent = __decorate([ registerUIEvent() ], exports.MoveEvent);
|
|
9402
9443
|
exports.TouchEvent = class TouchEvent extends UIEvent {};
|
|
9403
9444
|
exports.TouchEvent = __decorate([ registerUIEvent() ], exports.TouchEvent);
|
|
@@ -9464,6 +9505,7 @@ var LeaferUI = function(exports) {
|
|
|
9464
9505
|
ctrlKey: e.ctrlKey,
|
|
9465
9506
|
shiftKey: e.shiftKey,
|
|
9466
9507
|
metaKey: e.metaKey,
|
|
9508
|
+
time: Date.now(),
|
|
9467
9509
|
buttons: isUndefined(e.buttons) ? 1 : e.buttons === 0 ? pointerUpButtons : e.buttons,
|
|
9468
9510
|
origin: e
|
|
9469
9511
|
};
|
|
@@ -9495,6 +9537,7 @@ var LeaferUI = function(exports) {
|
|
|
9495
9537
|
const {getDragEventData: getDragEventData, getDropEventData: getDropEventData, getSwipeEventData: getSwipeEventData} = InteractionHelper;
|
|
9496
9538
|
class Dragger {
|
|
9497
9539
|
constructor(interaction) {
|
|
9540
|
+
this.dragDataList = [];
|
|
9498
9541
|
this.interaction = interaction;
|
|
9499
9542
|
}
|
|
9500
9543
|
setDragData(data) {
|
|
@@ -9557,6 +9600,7 @@ var LeaferUI = function(exports) {
|
|
|
9557
9600
|
this.dragData = getDragEventData(downData, dragData, data);
|
|
9558
9601
|
if (throughPath) this.dragData.throughPath = throughPath;
|
|
9559
9602
|
this.dragData.path = path;
|
|
9603
|
+
this.dragDataList.push(this.dragData);
|
|
9560
9604
|
if (this.moving) {
|
|
9561
9605
|
data.moving = true;
|
|
9562
9606
|
this.dragData.moveType = "drag";
|
|
@@ -9607,9 +9651,9 @@ var LeaferUI = function(exports) {
|
|
|
9607
9651
|
interaction.emit(exports.DragEvent.ENTER, data, path, dragEnterPath);
|
|
9608
9652
|
this.dragEnterPath = path;
|
|
9609
9653
|
}
|
|
9610
|
-
dragEnd(data
|
|
9654
|
+
dragEnd(data) {
|
|
9611
9655
|
if (!this.dragging && !this.moving) return;
|
|
9612
|
-
if (this.checkDragEndAnimate(data
|
|
9656
|
+
if (this.checkDragEndAnimate(data)) return;
|
|
9613
9657
|
this.dragEndReal(data);
|
|
9614
9658
|
}
|
|
9615
9659
|
dragEndReal(data) {
|
|
@@ -9651,11 +9695,13 @@ var LeaferUI = function(exports) {
|
|
|
9651
9695
|
}
|
|
9652
9696
|
dragReset() {
|
|
9653
9697
|
exports.DragEvent.list = exports.DragEvent.data = this.draggableList = this.dragData = this.downData = this.dragOverPath = this.dragEnterPath = null;
|
|
9698
|
+
this.dragDataList = [];
|
|
9654
9699
|
}
|
|
9655
9700
|
checkDragEndAnimate(_data, _speed) {
|
|
9656
9701
|
return false;
|
|
9657
9702
|
}
|
|
9658
9703
|
animate(_func, _off) {}
|
|
9704
|
+
stopAnimate() {}
|
|
9659
9705
|
checkDragOut(_data) {}
|
|
9660
9706
|
autoMoveOnDragOut(_data) {}
|
|
9661
9707
|
autoMoveCancel() {}
|
|
@@ -10040,6 +10086,9 @@ var LeaferUI = function(exports) {
|
|
|
10040
10086
|
this.pointerHover(hoverData);
|
|
10041
10087
|
}
|
|
10042
10088
|
}
|
|
10089
|
+
stopDragAnimate() {
|
|
10090
|
+
this.dragger.stopAnimate();
|
|
10091
|
+
}
|
|
10043
10092
|
updateDownData(data, options, merge) {
|
|
10044
10093
|
const {downData: downData} = this;
|
|
10045
10094
|
if (!data && downData) data = downData;
|
|
@@ -10218,14 +10267,13 @@ var LeaferUI = function(exports) {
|
|
|
10218
10267
|
Platform.getSelector = function(leaf) {
|
|
10219
10268
|
return leaf.leafer ? leaf.leafer.selector : Platform.selector || (Platform.selector = Creator.selector());
|
|
10220
10269
|
};
|
|
10221
|
-
const {toInnerRadiusPointOf: toInnerRadiusPointOf,
|
|
10270
|
+
const {toInnerRadiusPointOf: toInnerRadiusPointOf, copyRadiusPoint: copyRadiusPoint} = PointHelper;
|
|
10222
10271
|
const {hitRadiusPoint: hitRadiusPoint, hitPoint: hitPoint} = BoundsHelper;
|
|
10223
10272
|
const inner = {}, worldRadiusPoint = {};
|
|
10224
10273
|
const leaf$1 = exports.Leaf.prototype;
|
|
10225
10274
|
leaf$1.hit = function(worldPoint, hitRadius = 0) {
|
|
10226
10275
|
this.updateLayout();
|
|
10227
|
-
|
|
10228
|
-
setRadius(worldRadiusPoint, hitRadius);
|
|
10276
|
+
copyRadiusPoint(worldRadiusPoint, worldPoint, hitRadius);
|
|
10229
10277
|
const world = this.__world;
|
|
10230
10278
|
if (hitRadius ? !hitRadiusPoint(world, worldRadiusPoint) : !hitPoint(world, worldRadiusPoint)) return false;
|
|
10231
10279
|
return this.isBranch ? Platform.getSelector(this).hitPoint(Object.assign({}, worldRadiusPoint), hitRadius, {
|
|
@@ -10238,8 +10286,8 @@ var LeaferUI = function(exports) {
|
|
|
10238
10286
|
const world = this.__world, layout = this.__layout;
|
|
10239
10287
|
const isSmall = world.width < 10 && world.height < 10;
|
|
10240
10288
|
if (data.hitRadius) {
|
|
10241
|
-
|
|
10242
|
-
|
|
10289
|
+
copyRadiusPoint(inner, point, data.hitRadius);
|
|
10290
|
+
point = inner;
|
|
10243
10291
|
}
|
|
10244
10292
|
toInnerRadiusPointOf(point, world, inner);
|
|
10245
10293
|
if (data.hitBox || isSmall) {
|
|
@@ -10765,7 +10813,7 @@ var LeaferUI = function(exports) {
|
|
|
10765
10813
|
ignoreRender(ui, false);
|
|
10766
10814
|
onLoadError(ui, event, error);
|
|
10767
10815
|
leafPaint.loadId = undefined;
|
|
10768
|
-
});
|
|
10816
|
+
}, paint.lod && image.getThumbSize());
|
|
10769
10817
|
if (ui.placeholderColor) {
|
|
10770
10818
|
if (!ui.placeholderDelay) image.isPlacehold = true; else setTimeout(() => {
|
|
10771
10819
|
if (!image.ready) {
|
|
@@ -10981,10 +11029,12 @@ var LeaferUI = function(exports) {
|
|
|
10981
11029
|
function createPatternTask(paint, ui, canvas, renderOptions) {
|
|
10982
11030
|
if (!paint.patternTask) {
|
|
10983
11031
|
paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, void 0, void 0, function*() {
|
|
10984
|
-
paint
|
|
10985
|
-
if (canvas.bounds.hit(ui.__nowWorld)) PaintImage.createPattern(paint, ui, canvas, renderOptions);
|
|
11032
|
+
PaintImage.createPattern(paint, ui, canvas, renderOptions);
|
|
10986
11033
|
ui.forceUpdate("surface");
|
|
10987
|
-
}),
|
|
11034
|
+
}), 0, () => {
|
|
11035
|
+
paint.patternTask = null;
|
|
11036
|
+
return canvas.bounds.hit(ui.__nowWorld);
|
|
11037
|
+
});
|
|
10988
11038
|
}
|
|
10989
11039
|
}
|
|
10990
11040
|
function createPattern(paint, ui, canvas, renderOptions) {
|
|
@@ -11208,7 +11258,7 @@ var LeaferUI = function(exports) {
|
|
|
11208
11258
|
conicGradient: conicGradient,
|
|
11209
11259
|
getTransform: getTransform
|
|
11210
11260
|
};
|
|
11211
|
-
const {copy: copy$3, move: move$6, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max$
|
|
11261
|
+
const {copy: copy$3, move: move$6, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max$2, abs: abs$5} = Math;
|
|
11212
11262
|
const tempBounds = {}, tempMatrix = new Matrix;
|
|
11213
11263
|
const offsetOutBounds$1 = {};
|
|
11214
11264
|
function shadow$1(ui, current, shape) {
|
|
@@ -11249,10 +11299,10 @@ var LeaferUI = function(exports) {
|
|
|
11249
11299
|
let top = 0, right = 0, bottom = 0, left = 0, x, y, spread, blur;
|
|
11250
11300
|
shadow.forEach(item => {
|
|
11251
11301
|
x = item.x || 0, y = item.y || 0, blur = (item.blur || 0) * 1.5, spread = abs$5(item.spread || 0);
|
|
11252
|
-
top = max$
|
|
11253
|
-
right = max$
|
|
11254
|
-
bottom = max$
|
|
11255
|
-
left = max$
|
|
11302
|
+
top = max$2(top, spread + blur - y);
|
|
11303
|
+
right = max$2(right, spread + blur + x);
|
|
11304
|
+
bottom = max$2(bottom, spread + blur + y);
|
|
11305
|
+
left = max$2(left, spread + blur - x);
|
|
11256
11306
|
});
|
|
11257
11307
|
return top === right && right === bottom && bottom === left ? top : [ top, right, bottom, left ];
|
|
11258
11308
|
}
|
|
@@ -12039,7 +12089,11 @@ var LeaferUI = function(exports) {
|
|
|
12039
12089
|
matrix$1.half = strokeWidth % 2;
|
|
12040
12090
|
canvas.setWorld(matrix$1, options.matrix);
|
|
12041
12091
|
canvas.beginPath();
|
|
12042
|
-
if (
|
|
12092
|
+
if (this.strokePathType === "path") {
|
|
12093
|
+
leaf.__drawPath(canvas);
|
|
12094
|
+
} else {
|
|
12095
|
+
if (leaf.__.__useArrow) leaf.__drawPath(canvas); else leaf.__.__pathForRender ? leaf.__drawRenderPath(canvas) : leaf.__drawPathByBox(canvas);
|
|
12096
|
+
}
|
|
12043
12097
|
data.strokeWidth = strokeWidth / Math.max(aScaleX, aScaleY);
|
|
12044
12098
|
if (stroke) isString(stroke) ? Paint.stroke(stroke, this, canvas, options) : Paint.strokes(stroke, this, canvas, options);
|
|
12045
12099
|
if (fill) isString(fill) ? Paint.fill(fill, this, canvas, options) : Paint.fills(fill, this, canvas, options);
|
|
@@ -12054,6 +12108,7 @@ var LeaferUI = function(exports) {
|
|
|
12054
12108
|
}
|
|
12055
12109
|
}
|
|
12056
12110
|
__decorate([ targetAttr(onTarget$1) ], Stroker.prototype, "target", void 0);
|
|
12111
|
+
__decorate([ surfaceType("render-path") ], Stroker.prototype, "strokePathType", void 0);
|
|
12057
12112
|
function onTarget$1(stroker) {
|
|
12058
12113
|
const value = stroker.target;
|
|
12059
12114
|
stroker.list = value ? isArray(value) ? value : [ value ] : [];
|
|
@@ -12163,10 +12218,11 @@ var LeaferUI = function(exports) {
|
|
|
12163
12218
|
}
|
|
12164
12219
|
update() {
|
|
12165
12220
|
this.hoverStroker.update();
|
|
12166
|
-
const {stroke: stroke, strokeWidth: strokeWidth, selectedStyle: selectedStyle} = this.editor.mergedConfig;
|
|
12221
|
+
const {stroke: stroke, strokeWidth: strokeWidth, selectedPathType: selectedPathType, selectedStyle: selectedStyle} = this.editor.mergedConfig;
|
|
12167
12222
|
this.targetStroker.update(Object.assign({
|
|
12168
12223
|
stroke: stroke,
|
|
12169
|
-
strokeWidth: strokeWidth && Math.max(1, strokeWidth / 2)
|
|
12224
|
+
strokeWidth: strokeWidth && Math.max(1, strokeWidth / 2),
|
|
12225
|
+
strokePathType: selectedPathType
|
|
12170
12226
|
}, selectedStyle || {}));
|
|
12171
12227
|
}
|
|
12172
12228
|
onPointerMove(e) {
|
|
@@ -13492,7 +13548,7 @@ var LeaferUI = function(exports) {
|
|
|
13492
13548
|
const {target: target, mergeConfig: mergeConfig, single: single, dragStartData: dragStartData} = this.editBox;
|
|
13493
13549
|
let {around: around, lockRatio: lockRatio, flipable: flipable, editSize: editSize} = mergeConfig, totalMove;
|
|
13494
13550
|
if (e instanceof exports.ZoomEvent) {
|
|
13495
|
-
around = target.getBoxPoint(e);
|
|
13551
|
+
if (!around) around = target.getBoxPoint(e);
|
|
13496
13552
|
totalMove = e.totalScale;
|
|
13497
13553
|
} else {
|
|
13498
13554
|
totalMove = e.getInnerTotal(target);
|
|
@@ -14745,11 +14801,27 @@ var LeaferUI = function(exports) {
|
|
|
14745
14801
|
};
|
|
14746
14802
|
exports.TextEditor = __decorate([ registerInnerEditor() ], exports.TextEditor);
|
|
14747
14803
|
Plugin.add("text-editor", "editor");
|
|
14804
|
+
function getScrollType(leafer) {
|
|
14805
|
+
const {scroll: scroll, disabled: disabled} = leafer.app.config.move;
|
|
14806
|
+
return !scroll || disabled ? "" : scroll === true ? "free" : scroll;
|
|
14807
|
+
}
|
|
14748
14808
|
function addViewport(leafer, mergeConfig, custom) {
|
|
14749
14809
|
addViewportConfig(leafer.parentApp ? leafer.parentApp : leafer, mergeConfig);
|
|
14750
14810
|
if (leafer.isApp || custom) return;
|
|
14751
14811
|
leafer.__eventIds.push(leafer.on_(exports.MoveEvent.BEFORE_MOVE, e => {
|
|
14752
|
-
|
|
14812
|
+
const move = leafer.getValidMove(e.moveX, e.moveY, false);
|
|
14813
|
+
if (getScrollType(leafer).includes("limit")) {
|
|
14814
|
+
const testMove = leafer.getValidMove(0, 0);
|
|
14815
|
+
if (testMove.x || testMove.y) {
|
|
14816
|
+
const maxX = 100, maxY = 200, resistance = e.moveType === "drag" ? .3 : .05;
|
|
14817
|
+
if (Math.abs(testMove.x) > maxX) move.x = 0; else move.x *= resistance;
|
|
14818
|
+
if (Math.abs(testMove.y) > maxY) move.y = 0; else move.y *= resistance;
|
|
14819
|
+
}
|
|
14820
|
+
}
|
|
14821
|
+
leafer.zoomLayer.move(move);
|
|
14822
|
+
}), leafer.on_(exports.MoveEvent.DRAG_ANIMATE, () => {
|
|
14823
|
+
const testMove = leafer.getValidMove(0, 0);
|
|
14824
|
+
if (testMove.x || testMove.y) leafer.interaction.stopDragAnimate();
|
|
14753
14825
|
}), leafer.on_(exports.MoveEvent.END, e => {
|
|
14754
14826
|
LeafHelper.animateMove(leafer.zoomLayer, leafer.getValidMove(e.moveX, e.moveY));
|
|
14755
14827
|
}), leafer.on_(exports.ZoomEvent.BEFORE_ZOOM, e => {
|
|
@@ -14886,7 +14958,7 @@ var LeaferUI = function(exports) {
|
|
|
14886
14958
|
}
|
|
14887
14959
|
};
|
|
14888
14960
|
const M$3 = MultiTouchHelper;
|
|
14889
|
-
const {abs: abs$2, max: max} = Math, {sign: sign, within: within$2} = MathHelper;
|
|
14961
|
+
const {abs: abs$2, max: max$1} = Math, {sign: sign, within: within$2} = MathHelper;
|
|
14890
14962
|
const WheelEventHelper = {
|
|
14891
14963
|
getMove(event, config) {
|
|
14892
14964
|
let {moveSpeed: moveSpeed} = config;
|
|
@@ -14896,8 +14968,8 @@ var LeaferUI = function(exports) {
|
|
|
14896
14968
|
deltaY = 0;
|
|
14897
14969
|
}
|
|
14898
14970
|
const absX = abs$2(deltaX), absY = abs$2(deltaY);
|
|
14899
|
-
if (absX > 50) deltaX = max(50, absX / 3) * sign(deltaX);
|
|
14900
|
-
if (absY > 50) deltaY = max(50, absY / 3) * sign(deltaY);
|
|
14971
|
+
if (absX > 50) deltaX = max$1(50, absX / 3) * sign(deltaX);
|
|
14972
|
+
if (absY > 50) deltaY = max$1(50, absY / 3) * sign(deltaY);
|
|
14901
14973
|
return {
|
|
14902
14974
|
x: -deltaX * moveSpeed * 2,
|
|
14903
14975
|
y: -deltaY * moveSpeed * 2
|
|
@@ -15034,15 +15106,15 @@ var LeaferUI = function(exports) {
|
|
|
15034
15106
|
LeaferTypeCreator.run(type, this);
|
|
15035
15107
|
};
|
|
15036
15108
|
leafer.getValidMove = function(moveX, moveY, checkLimit = true) {
|
|
15037
|
-
const {
|
|
15109
|
+
const {disabled: disabled} = this.app.config.move;
|
|
15038
15110
|
move$4.set(moveX, moveY);
|
|
15039
|
-
|
|
15040
|
-
|
|
15041
|
-
if (
|
|
15042
|
-
if (checkLimit &&
|
|
15111
|
+
const scrollType = getScrollType(this);
|
|
15112
|
+
if (scrollType) {
|
|
15113
|
+
if (scrollType.includes("x")) move$4.y = 0; else if (scrollType.includes("y")) move$4.x = 0; else Math.abs(move$4.x) > Math.abs(move$4.y) ? move$4.y = 0 : move$4.x = 0;
|
|
15114
|
+
if (checkLimit && scrollType.includes("limit")) {
|
|
15043
15115
|
bounds.set(this.__world).addPoint(this.zoomLayer);
|
|
15044
|
-
DragBoundsHelper.getValidMove(bounds, this.canvas.bounds, "
|
|
15045
|
-
if (
|
|
15116
|
+
DragBoundsHelper.getValidMove(bounds, this.canvas.bounds, "auto", move$4, true);
|
|
15117
|
+
if (scrollType.includes("x")) move$4.y = 0; else if (scrollType.includes("y")) move$4.x = 0;
|
|
15046
15118
|
}
|
|
15047
15119
|
}
|
|
15048
15120
|
return {
|
|
@@ -15135,21 +15207,51 @@ var LeaferUI = function(exports) {
|
|
|
15135
15207
|
if (moving) this.move(getMoveEventData(gestureData.move, data));
|
|
15136
15208
|
};
|
|
15137
15209
|
const dragger = Dragger.prototype;
|
|
15138
|
-
const {abs: abs$1} = Math;
|
|
15139
|
-
dragger.checkDragEndAnimate = function(data
|
|
15140
|
-
const {
|
|
15141
|
-
const
|
|
15142
|
-
const dragAnimate = this.canAnimate && this.moving && (absMoveX > minMove || absMoveY > minMove) && this.interaction.m.dragAnimate;
|
|
15210
|
+
const {abs: abs$1, min: min, max: max, hypot: hypot} = Math;
|
|
15211
|
+
dragger.checkDragEndAnimate = function(data) {
|
|
15212
|
+
const {interaction: interaction} = this;
|
|
15213
|
+
const dragAnimate = this.canAnimate && this.moving && interaction.m.dragAnimate;
|
|
15143
15214
|
if (dragAnimate) {
|
|
15144
|
-
const inertia =
|
|
15145
|
-
|
|
15146
|
-
|
|
15147
|
-
|
|
15148
|
-
|
|
15149
|
-
this.
|
|
15150
|
-
|
|
15151
|
-
|
|
15152
|
-
|
|
15215
|
+
const inertia = isNumber(dragAnimate) ? dragAnimate : .95;
|
|
15216
|
+
const stopMove = .15;
|
|
15217
|
+
const maxMove = 150;
|
|
15218
|
+
let moveX = 0, moveY = 0, flickSpeed = 0;
|
|
15219
|
+
let totalWeight = 0, weight, w = 3, s, frame;
|
|
15220
|
+
const {dragDataList: dragDataList} = this, len = dragDataList.length;
|
|
15221
|
+
for (let i = len - 1; i >= max(len - 3, 0); i--) {
|
|
15222
|
+
frame = dragDataList[i];
|
|
15223
|
+
if (frame.time && Date.now() - frame.time > 100) break;
|
|
15224
|
+
weight = w--;
|
|
15225
|
+
moveX += frame.moveX * weight;
|
|
15226
|
+
moveY += frame.moveY * weight;
|
|
15227
|
+
totalWeight += weight;
|
|
15228
|
+
s = hypot(frame.moveX, frame.moveY);
|
|
15229
|
+
if (s > flickSpeed) flickSpeed = s;
|
|
15230
|
+
}
|
|
15231
|
+
if (totalWeight) moveX /= totalWeight, moveY /= totalWeight;
|
|
15232
|
+
if (flickSpeed > 8) {
|
|
15233
|
+
const t = min((flickSpeed - 8) / 17, 1);
|
|
15234
|
+
const boost = 1.15 + t * (1.6 - 1.15);
|
|
15235
|
+
moveX *= boost;
|
|
15236
|
+
moveY *= boost;
|
|
15237
|
+
}
|
|
15238
|
+
const maxAbs = max(abs$1(moveX), abs$1(moveY));
|
|
15239
|
+
if (maxAbs > maxMove) {
|
|
15240
|
+
s = maxMove / maxAbs;
|
|
15241
|
+
moveX *= s;
|
|
15242
|
+
moveY *= s;
|
|
15243
|
+
}
|
|
15244
|
+
const step = () => {
|
|
15245
|
+
moveX *= inertia;
|
|
15246
|
+
moveY *= inertia;
|
|
15247
|
+
data = Object.assign({}, data);
|
|
15248
|
+
if (abs$1(moveX) < stopMove && abs$1(moveY) < stopMove) return this.dragEndReal(data);
|
|
15249
|
+
PointHelper.move(data, moveX, moveY);
|
|
15250
|
+
this.drag(data);
|
|
15251
|
+
this.animate(step);
|
|
15252
|
+
interaction.emit(exports.MoveEvent.DRAG_ANIMATE, data);
|
|
15253
|
+
};
|
|
15254
|
+
this.animate(step);
|
|
15153
15255
|
}
|
|
15154
15256
|
return dragAnimate;
|
|
15155
15257
|
};
|
|
@@ -15158,6 +15260,12 @@ var LeaferUI = function(exports) {
|
|
|
15158
15260
|
if (animateWait) this.interaction.target.nextRender(animateWait, null, off);
|
|
15159
15261
|
this.animateWait = func;
|
|
15160
15262
|
};
|
|
15263
|
+
dragger.stopAnimate = function() {
|
|
15264
|
+
this.animate(null, "off");
|
|
15265
|
+
this.interaction.target.nextRender(() => {
|
|
15266
|
+
if (this.dragData) this.dragEndReal(this.dragData);
|
|
15267
|
+
});
|
|
15268
|
+
};
|
|
15161
15269
|
dragger.checkDragOut = function(data) {
|
|
15162
15270
|
const {interaction: interaction} = this;
|
|
15163
15271
|
this.autoMoveCancel();
|
|
@@ -15222,7 +15330,6 @@ var LeaferUI = function(exports) {
|
|
|
15222
15330
|
}
|
|
15223
15331
|
Plugin.add("view");
|
|
15224
15332
|
exports.Leafer.prototype.zoom = function(zoomType, optionsOrPadding, scroll, transition) {
|
|
15225
|
-
this.killAnimate();
|
|
15226
15333
|
let padding;
|
|
15227
15334
|
if (isData(optionsOrPadding)) {
|
|
15228
15335
|
padding = optionsOrPadding.padding;
|
|
@@ -15235,8 +15342,9 @@ var LeaferUI = function(exports) {
|
|
|
15235
15342
|
x: limitBounds.x + limitBounds.width / 2,
|
|
15236
15343
|
y: limitBounds.y + limitBounds.height / 2
|
|
15237
15344
|
};
|
|
15345
|
+
zoomLayer.killAnimate();
|
|
15238
15346
|
let changeScale;
|
|
15239
|
-
const {x: x, y: y, scaleX: scaleX, scaleY: scaleY} = zoomLayer.__;
|
|
15347
|
+
const {x: x, y: y, scaleX: scaleX, scaleY: scaleY} = zoomLayer.__, {boxBounds: boxBounds} = zoomLayer;
|
|
15240
15348
|
if (isString(zoomType)) {
|
|
15241
15349
|
switch (zoomType) {
|
|
15242
15350
|
case "in":
|
|
@@ -15248,16 +15356,16 @@ var LeaferUI = function(exports) {
|
|
|
15248
15356
|
break;
|
|
15249
15357
|
|
|
15250
15358
|
case "fit":
|
|
15251
|
-
zoomType =
|
|
15359
|
+
zoomType = boxBounds;
|
|
15252
15360
|
break;
|
|
15253
15361
|
|
|
15254
15362
|
case "fit-width":
|
|
15255
|
-
zoomType = new Bounds(
|
|
15363
|
+
zoomType = new Bounds(boxBounds);
|
|
15256
15364
|
zoomType.height = 0;
|
|
15257
15365
|
break;
|
|
15258
15366
|
|
|
15259
15367
|
case "fit-height":
|
|
15260
|
-
zoomType = new Bounds(
|
|
15368
|
+
zoomType = new Bounds(boxBounds);
|
|
15261
15369
|
zoomType.width = 0;
|
|
15262
15370
|
break;
|
|
15263
15371
|
}
|
|
@@ -16524,6 +16632,8 @@ var LeaferUI = function(exports) {
|
|
|
16524
16632
|
}
|
|
16525
16633
|
constructor(target, keyframe, options, isTemp) {
|
|
16526
16634
|
super();
|
|
16635
|
+
this.nowIndex = 0;
|
|
16636
|
+
this.playedTotalTime = 0;
|
|
16527
16637
|
if (keyframe) {
|
|
16528
16638
|
if (keyframe.keyframes) options = keyframe, keyframe = keyframe.keyframes; else if (keyframe.style) options = keyframe,
|
|
16529
16639
|
keyframe = keyframe.style;
|
|
@@ -16570,7 +16680,7 @@ var LeaferUI = function(exports) {
|
|
|
16570
16680
|
play() {
|
|
16571
16681
|
if (this.destroyed) return;
|
|
16572
16682
|
this.running = true;
|
|
16573
|
-
if (!this.started) this.clearTimer(), this.start(); else if (!this.timer) this.
|
|
16683
|
+
if (!this.started) this.clearTimer(), this.start(); else if (!this.timer) this.startRequestAnimate();
|
|
16574
16684
|
this.emitType(AnimateEvent.PLAY);
|
|
16575
16685
|
}
|
|
16576
16686
|
pause() {
|
|
@@ -16584,14 +16694,28 @@ var LeaferUI = function(exports) {
|
|
|
16584
16694
|
this.complete();
|
|
16585
16695
|
this.emitType(AnimateEvent.STOP);
|
|
16586
16696
|
}
|
|
16587
|
-
seek(time) {
|
|
16697
|
+
seek(time, includeDelay) {
|
|
16588
16698
|
if (this.destroyed) return;
|
|
16589
|
-
|
|
16699
|
+
const {delay: delay} = this;
|
|
16700
|
+
if (isObject(time)) time = UnitConvert.number(time, this.duration + (includeDelay ? delay : 0));
|
|
16701
|
+
if (includeDelay) time -= delay;
|
|
16590
16702
|
if (time) time /= this.speed;
|
|
16591
|
-
|
|
16703
|
+
let waitBeginTime;
|
|
16704
|
+
if (time < 0) {
|
|
16705
|
+
waitBeginTime = -time;
|
|
16706
|
+
time = 0;
|
|
16707
|
+
}
|
|
16708
|
+
if (!this.started || time < this.time || !time) this.start(true);
|
|
16592
16709
|
this.time = time;
|
|
16593
|
-
this.animate(0, true);
|
|
16594
|
-
this.clearTimer(() =>
|
|
16710
|
+
if (!waitBeginTime) this.animate(0, true);
|
|
16711
|
+
this.clearTimer(() => {
|
|
16712
|
+
if (waitBeginTime) {
|
|
16713
|
+
this.timer = setTimeout(() => {
|
|
16714
|
+
this.timer = 0;
|
|
16715
|
+
this.begin();
|
|
16716
|
+
}, waitBeginTime * 1e3);
|
|
16717
|
+
} else this.startRequestAnimate();
|
|
16718
|
+
});
|
|
16595
16719
|
this.emitType(AnimateEvent.SEEK);
|
|
16596
16720
|
}
|
|
16597
16721
|
kill(complete = true, killStyle) {
|
|
@@ -16674,14 +16798,24 @@ var LeaferUI = function(exports) {
|
|
|
16674
16798
|
}
|
|
16675
16799
|
}
|
|
16676
16800
|
}
|
|
16677
|
-
|
|
16801
|
+
startRequestAnimate() {
|
|
16678
16802
|
this.requestAnimateTime = Date.now();
|
|
16803
|
+
this.requestAnimatePageTime = 0;
|
|
16804
|
+
if (!this.waitRequestRender) this.requestAnimate();
|
|
16805
|
+
}
|
|
16806
|
+
requestAnimate() {
|
|
16807
|
+
this.waitRequestRender = true;
|
|
16679
16808
|
Platform.requestRender(this.animate.bind(this));
|
|
16680
16809
|
}
|
|
16681
|
-
animate(
|
|
16810
|
+
animate(pageTime, seek) {
|
|
16682
16811
|
if (!seek) {
|
|
16812
|
+
this.waitRequestRender = false;
|
|
16683
16813
|
if (!this.running) return;
|
|
16684
|
-
|
|
16814
|
+
let frameTime;
|
|
16815
|
+
if (pageTime && this.requestAnimatePageTime) frameTime = pageTime - this.requestAnimatePageTime; else frameTime = Date.now() - this.requestAnimateTime;
|
|
16816
|
+
this.time += frameTime / 1e3;
|
|
16817
|
+
this.requestAnimatePageTime = pageTime;
|
|
16818
|
+
this.requestAnimateTime = Date.now();
|
|
16685
16819
|
}
|
|
16686
16820
|
const {duration: duration} = this, realTime = this.time * this.speed;
|
|
16687
16821
|
if (realTime < duration) {
|
|
@@ -16722,21 +16856,24 @@ var LeaferUI = function(exports) {
|
|
|
16722
16856
|
}
|
|
16723
16857
|
start(seek) {
|
|
16724
16858
|
this.requestAnimateTime = 1;
|
|
16725
|
-
const {reverse: reverse} = this;
|
|
16859
|
+
const {reverse: reverse, jump: jump} = this;
|
|
16726
16860
|
if (reverse || this.mainReverse) this.mainReverse = reverse;
|
|
16727
16861
|
if (this.looped) this.looped = 0;
|
|
16728
16862
|
if (seek) this.begin(true); else {
|
|
16729
16863
|
const {delay: delay} = this;
|
|
16730
|
-
if (delay)
|
|
16731
|
-
this.
|
|
16732
|
-
this.
|
|
16733
|
-
|
|
16864
|
+
if (delay) {
|
|
16865
|
+
if (jump) this.begin(true);
|
|
16866
|
+
this.timer = setTimeout(() => {
|
|
16867
|
+
this.timer = 0;
|
|
16868
|
+
this.begin();
|
|
16869
|
+
}, delay / this.speed * 1e3);
|
|
16870
|
+
} else this.begin();
|
|
16734
16871
|
}
|
|
16735
16872
|
}
|
|
16736
16873
|
begin(seek) {
|
|
16737
16874
|
this.playedTotalTime = this.time = 0;
|
|
16738
16875
|
this.mainReverse ? this.setTo() : this.setFrom();
|
|
16739
|
-
if (!seek) this.
|
|
16876
|
+
if (!seek) this.startRequestAnimate();
|
|
16740
16877
|
}
|
|
16741
16878
|
end() {
|
|
16742
16879
|
this.mainReverse ? this.setFrom() : this.setTo();
|
|
@@ -16840,6 +16977,7 @@ var LeaferUI = function(exports) {
|
|
|
16840
16977
|
__decorate([ animateAttr(1) ], exports.Animate.prototype, "speed", void 0);
|
|
16841
16978
|
__decorate([ animateAttr(true) ], exports.Animate.prototype, "autoplay", void 0);
|
|
16842
16979
|
__decorate([ animateAttr() ], exports.Animate.prototype, "join", void 0);
|
|
16980
|
+
__decorate([ animateAttr() ], exports.Animate.prototype, "jump", void 0);
|
|
16843
16981
|
__decorate([ animateAttr() ], exports.Animate.prototype, "attrs", void 0);
|
|
16844
16982
|
exports.Animate = __decorate([ useModule(LeafEventer) ], exports.Animate);
|
|
16845
16983
|
exports.AnimateList = class AnimateList extends exports.Animate {
|
|
@@ -16884,8 +17022,8 @@ var LeaferUI = function(exports) {
|
|
|
16884
17022
|
this.each(item => item.stop());
|
|
16885
17023
|
this.emitType(AnimateEvent.STOP);
|
|
16886
17024
|
}
|
|
16887
|
-
seek(time) {
|
|
16888
|
-
this.each(item => item.seek(time));
|
|
17025
|
+
seek(time, includeDelay) {
|
|
17026
|
+
this.each(item => item.seek(time, includeDelay));
|
|
16889
17027
|
this.emitType(AnimateEvent.SEEK);
|
|
16890
17028
|
}
|
|
16891
17029
|
kill(complete, killStyle) {
|
|
@@ -17069,7 +17207,7 @@ var LeaferUI = function(exports) {
|
|
|
17069
17207
|
const rgbaMatch = /^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*\.?\d+)/i;
|
|
17070
17208
|
const hslMatch = /^hsl\((\d+),\s*(\d+)%\s*,\s*(\d+)%/i;
|
|
17071
17209
|
const hslaMatch = /^hsla\((\d+),\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d*\.?\d+)/i;
|
|
17072
|
-
const int = parseInt, float = parseFloat, {round: round$1} = Math;
|
|
17210
|
+
const int = parseInt, float$1 = parseFloat, {round: round$1} = Math;
|
|
17073
17211
|
let cache = {}, totalCache = 0;
|
|
17074
17212
|
function colorToRGBA(color, opacity) {
|
|
17075
17213
|
let RGBA;
|
|
@@ -17177,16 +17315,16 @@ var LeaferUI = function(exports) {
|
|
|
17177
17315
|
r: int(match[1]),
|
|
17178
17316
|
g: int(match[2]),
|
|
17179
17317
|
b: int(match[3]),
|
|
17180
|
-
a: float(match[4])
|
|
17318
|
+
a: float$1(match[4])
|
|
17181
17319
|
};
|
|
17182
17320
|
}
|
|
17183
17321
|
function hslToRGBA(color) {
|
|
17184
17322
|
const match = hslMatch.exec(color);
|
|
17185
|
-
return hsla(float(match[1]), float(match[2]), float(match[3]), 1);
|
|
17323
|
+
return hsla(float$1(match[1]), float$1(match[2]), float$1(match[3]), 1);
|
|
17186
17324
|
}
|
|
17187
17325
|
function hslaToRGBA(color) {
|
|
17188
17326
|
const match = hslaMatch.exec(color);
|
|
17189
|
-
return hsla(float(match[1]), float(match[2]), float(match[3]), float(match[4]));
|
|
17327
|
+
return hsla(float$1(match[1]), float$1(match[2]), float$1(match[3]), float$1(match[4]));
|
|
17190
17328
|
}
|
|
17191
17329
|
const n1 = 1 / 6, n2 = .5, n3 = 2 / 3, n4 = 1 / 3;
|
|
17192
17330
|
function hue(p, q, t) {
|
|
@@ -17389,7 +17527,7 @@ var LeaferUI = function(exports) {
|
|
|
17389
17527
|
}
|
|
17390
17528
|
};
|
|
17391
17529
|
const {getDistance: getDistance} = HighBezierHelper;
|
|
17392
|
-
const {M: M, L: L, C: C, Z: Z} = PathCommandMap;
|
|
17530
|
+
const {M: M, L: L, C: C, Z: Z} = PathCommandMap, {float: float} = MathHelper;
|
|
17393
17531
|
const tempPoint = {}, tempFrom = {};
|
|
17394
17532
|
const HighCurveHelper = {
|
|
17395
17533
|
transform(data, matrix) {
|
|
@@ -17524,7 +17662,7 @@ var LeaferUI = function(exports) {
|
|
|
17524
17662
|
getDistancePath(distanceData, motionDistance, motionPrecision) {
|
|
17525
17663
|
const {segments: segments, data: data} = distanceData, path = [];
|
|
17526
17664
|
motionDistance = UnitConvert.number(motionDistance, distanceData.total);
|
|
17527
|
-
let total = 0, distance, to = {};
|
|
17665
|
+
let total = 0, distance, cutDistance, to = {};
|
|
17528
17666
|
let i = 0, index = 0, x = 0, y = 0, toX, toY, command;
|
|
17529
17667
|
let x1, y1, x2, y2, t;
|
|
17530
17668
|
const len = data.length;
|
|
@@ -17536,14 +17674,17 @@ var LeaferUI = function(exports) {
|
|
|
17536
17674
|
toX = data[i + 1];
|
|
17537
17675
|
toY = data[i + 2];
|
|
17538
17676
|
distance = segments[index];
|
|
17539
|
-
if (total + distance
|
|
17677
|
+
if (total + distance > motionDistance || !distanceData.total) {
|
|
17540
17678
|
if (!i) x = toX, y = toY;
|
|
17541
17679
|
tempFrom.x = x;
|
|
17542
17680
|
tempFrom.y = y;
|
|
17543
17681
|
to.x = toX;
|
|
17544
17682
|
to.y = toY;
|
|
17545
|
-
|
|
17546
|
-
|
|
17683
|
+
cutDistance = float(motionDistance - total);
|
|
17684
|
+
if (cutDistance) {
|
|
17685
|
+
PointHelper.getDistancePoint(tempFrom, to, cutDistance, true);
|
|
17686
|
+
path.push(command, to.x, to.y);
|
|
17687
|
+
}
|
|
17547
17688
|
return path;
|
|
17548
17689
|
}
|
|
17549
17690
|
x = toX;
|
|
@@ -17557,9 +17698,12 @@ var LeaferUI = function(exports) {
|
|
|
17557
17698
|
toX = data[i + 5];
|
|
17558
17699
|
toY = data[i + 6];
|
|
17559
17700
|
distance = segments[index];
|
|
17560
|
-
if (total + distance
|
|
17561
|
-
|
|
17562
|
-
|
|
17701
|
+
if (total + distance > motionDistance) {
|
|
17702
|
+
cutDistance = float(motionDistance - total);
|
|
17703
|
+
if (cutDistance) {
|
|
17704
|
+
t = HighBezierHelper.getT(cutDistance, distance, x, y, x1, y1, x2, y2, toX, toY, motionPrecision);
|
|
17705
|
+
HighBezierHelper.cut(path, t, x, y, x1, y1, x2, y2, toX, toY);
|
|
17706
|
+
}
|
|
17563
17707
|
return path;
|
|
17564
17708
|
}
|
|
17565
17709
|
x = toX;
|
|
@@ -18202,6 +18346,7 @@ var LeaferUI = function(exports) {
|
|
|
18202
18346
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
18203
18347
|
child = children[i];
|
|
18204
18348
|
result = method(child, options);
|
|
18349
|
+
if (typeof result === "boolean") result = result ? 1 : 0;
|
|
18205
18350
|
if (result === Yes || result === YesAndSkip) {
|
|
18206
18351
|
if (list) {
|
|
18207
18352
|
list.push(child);
|
|
@@ -18747,7 +18892,7 @@ var LeaferUI = function(exports) {
|
|
|
18747
18892
|
exports.surfaceType = surfaceType;
|
|
18748
18893
|
exports.tempBounds = tempBounds$2;
|
|
18749
18894
|
exports.tempMatrix = tempMatrix$2;
|
|
18750
|
-
exports.tempPoint = tempPoint$
|
|
18895
|
+
exports.tempPoint = tempPoint$4;
|
|
18751
18896
|
exports.tryToNumber = tryToNumber;
|
|
18752
18897
|
exports.useCanvas = useCanvas;
|
|
18753
18898
|
exports.useModule = useModule;
|