@leafer/miniapp 1.9.6 → 1.9.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/miniapp.cjs +11 -0
- package/dist/miniapp.esm.js +2 -0
- package/dist/miniapp.esm.min.js +1 -1
- package/dist/miniapp.min.cjs +1 -1
- package/dist/miniapp.module.js +670 -412
- package/dist/miniapp.module.min.js +1 -1
- package/dist/miniapp.module.min.js.map +1 -1
- package/package.json +21 -20
- package/src/index.ts +2 -0
- package/types/index.d.ts +1 -0
package/dist/miniapp.module.js
CHANGED
|
@@ -247,18 +247,34 @@ class LeafData {
|
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
249
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
const
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
250
|
+
let tempA, tempB, tempTo;
|
|
251
|
+
|
|
252
|
+
const {max: max$5} = Math, tempFour = [ 0, 0, 0, 0 ];
|
|
253
|
+
|
|
254
|
+
const FourNumberHelper = {
|
|
255
|
+
zero: [ ...tempFour ],
|
|
256
|
+
tempFour: tempFour,
|
|
257
|
+
set(to, top, right, bottom, left) {
|
|
258
|
+
if (right === undefined) right = bottom = left = top;
|
|
259
|
+
to[0] = top;
|
|
260
|
+
to[1] = right;
|
|
261
|
+
to[2] = bottom;
|
|
262
|
+
to[3] = left;
|
|
263
|
+
return to;
|
|
264
|
+
},
|
|
265
|
+
setTemp(top, right, bottom, left) {
|
|
266
|
+
return set$1(tempFour, top, right, bottom, left);
|
|
267
|
+
},
|
|
268
|
+
toTempAB(a, b, change) {
|
|
269
|
+
tempTo = change ? isNumber(a) ? b : a : [];
|
|
270
|
+
if (isNumber(a)) tempA = setTemp(a), tempB = b; else if (isNumber(b)) tempA = a,
|
|
271
|
+
tempB = setTemp(b); else tempA = a, tempB = b;
|
|
272
|
+
if (tempA.length !== 4) tempA = get$5(tempA);
|
|
273
|
+
if (tempB.length !== 4) tempB = get$5(tempB);
|
|
258
274
|
},
|
|
259
|
-
|
|
275
|
+
get(num, maxValue) {
|
|
260
276
|
let data;
|
|
261
|
-
if (
|
|
277
|
+
if (!isNumber(num)) {
|
|
262
278
|
switch (num.length) {
|
|
263
279
|
case 4:
|
|
264
280
|
data = isUndefined(maxValue) ? num : [ ...num ];
|
|
@@ -281,9 +297,39 @@ const MathHelper = {
|
|
|
281
297
|
}
|
|
282
298
|
}
|
|
283
299
|
if (!data) data = [ num, num, num, num ];
|
|
284
|
-
if (maxValue) for (let i = 0; i < 4; i++) if (data[i] > maxValue) data[i] = maxValue;
|
|
300
|
+
if (!isUndefined(maxValue)) for (let i = 0; i < 4; i++) if (data[i] > maxValue) data[i] = maxValue;
|
|
285
301
|
return data;
|
|
286
302
|
},
|
|
303
|
+
max(t, other, change) {
|
|
304
|
+
if (isNumber(t) && isNumber(other)) return max$5(t, other);
|
|
305
|
+
toTempAB(t, other, change);
|
|
306
|
+
return set$1(tempTo, max$5(tempA[0], tempB[0]), max$5(tempA[1], tempB[1]), max$5(tempA[2], tempB[2]), max$5(tempA[3], tempB[3]));
|
|
307
|
+
},
|
|
308
|
+
add(t, other, change) {
|
|
309
|
+
if (isNumber(t) && isNumber(other)) return t + other;
|
|
310
|
+
toTempAB(t, other, change);
|
|
311
|
+
return set$1(tempTo, tempA[0] + tempB[0], tempA[1] + tempB[1], tempA[2] + tempB[2], tempA[3] + tempB[3]);
|
|
312
|
+
},
|
|
313
|
+
swapAndScale(t, scaleX, scaleY, change) {
|
|
314
|
+
if (isNumber(t)) return scaleX === scaleY ? t * scaleX : [ t * scaleY, t * scaleX ];
|
|
315
|
+
const to = change ? t : [];
|
|
316
|
+
const [top, right, bottom, left] = t.length === 4 ? t : get$5(t);
|
|
317
|
+
return set$1(to, bottom * scaleY, left * scaleX, top * scaleY, right * scaleX);
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
const {set: set$1, get: get$5, setTemp: setTemp, toTempAB: toTempAB} = FourNumberHelper;
|
|
322
|
+
|
|
323
|
+
const {round: round$6, pow: pow$2, PI: PI$4} = Math;
|
|
324
|
+
|
|
325
|
+
const MathHelper = {
|
|
326
|
+
within(value, min, max) {
|
|
327
|
+
if (isObject(min)) max = min.max, min = min.min;
|
|
328
|
+
if (!isUndefined(min) && value < min) value = min;
|
|
329
|
+
if (!isUndefined(max) && value > max) value = max;
|
|
330
|
+
return value;
|
|
331
|
+
},
|
|
332
|
+
fourNumber: FourNumberHelper.get,
|
|
287
333
|
formatRotation(rotation, unsign) {
|
|
288
334
|
rotation %= 360;
|
|
289
335
|
if (unsign) {
|
|
@@ -423,14 +469,23 @@ const MatrixHelper = {
|
|
|
423
469
|
t.c *= scaleY;
|
|
424
470
|
t.d *= scaleY;
|
|
425
471
|
},
|
|
472
|
+
pixelScale(t, pixelRatio, to) {
|
|
473
|
+
to || (to = t);
|
|
474
|
+
to.a = t.a * pixelRatio;
|
|
475
|
+
to.b = t.b * pixelRatio;
|
|
476
|
+
to.c = t.c * pixelRatio;
|
|
477
|
+
to.d = t.d * pixelRatio;
|
|
478
|
+
to.e = t.e * pixelRatio;
|
|
479
|
+
to.f = t.f * pixelRatio;
|
|
480
|
+
},
|
|
426
481
|
scaleOfOuter(t, origin, scaleX, scaleY) {
|
|
427
|
-
M$
|
|
428
|
-
M$
|
|
482
|
+
M$b.toInnerPoint(t, origin, tempPoint$4);
|
|
483
|
+
M$b.scaleOfInner(t, tempPoint$4, scaleX, scaleY);
|
|
429
484
|
},
|
|
430
485
|
scaleOfInner(t, origin, scaleX, scaleY = scaleX) {
|
|
431
|
-
M$
|
|
432
|
-
M$
|
|
433
|
-
M$
|
|
486
|
+
M$b.translateInner(t, origin.x, origin.y);
|
|
487
|
+
M$b.scale(t, scaleX, scaleY);
|
|
488
|
+
M$b.translateInner(t, -origin.x, -origin.y);
|
|
434
489
|
},
|
|
435
490
|
rotate(t, rotation) {
|
|
436
491
|
const {a: a, b: b, c: c, d: d} = t;
|
|
@@ -443,13 +498,13 @@ const MatrixHelper = {
|
|
|
443
498
|
t.d = c * sinR + d * cosR;
|
|
444
499
|
},
|
|
445
500
|
rotateOfOuter(t, origin, rotation) {
|
|
446
|
-
M$
|
|
447
|
-
M$
|
|
501
|
+
M$b.toInnerPoint(t, origin, tempPoint$4);
|
|
502
|
+
M$b.rotateOfInner(t, tempPoint$4, rotation);
|
|
448
503
|
},
|
|
449
504
|
rotateOfInner(t, origin, rotation) {
|
|
450
|
-
M$
|
|
451
|
-
M$
|
|
452
|
-
M$
|
|
505
|
+
M$b.translateInner(t, origin.x, origin.y);
|
|
506
|
+
M$b.rotate(t, rotation);
|
|
507
|
+
M$b.translateInner(t, -origin.x, -origin.y);
|
|
453
508
|
},
|
|
454
509
|
skew(t, skewX, skewY) {
|
|
455
510
|
const {a: a, b: b, c: c, d: d} = t;
|
|
@@ -465,13 +520,13 @@ const MatrixHelper = {
|
|
|
465
520
|
}
|
|
466
521
|
},
|
|
467
522
|
skewOfOuter(t, origin, skewX, skewY) {
|
|
468
|
-
M$
|
|
469
|
-
M$
|
|
523
|
+
M$b.toInnerPoint(t, origin, tempPoint$4);
|
|
524
|
+
M$b.skewOfInner(t, tempPoint$4, skewX, skewY);
|
|
470
525
|
},
|
|
471
526
|
skewOfInner(t, origin, skewX, skewY = 0) {
|
|
472
|
-
M$
|
|
473
|
-
M$
|
|
474
|
-
M$
|
|
527
|
+
M$b.translateInner(t, origin.x, origin.y);
|
|
528
|
+
M$b.skew(t, skewX, skewY);
|
|
529
|
+
M$b.translateInner(t, -origin.x, -origin.y);
|
|
475
530
|
},
|
|
476
531
|
multiply(t, child) {
|
|
477
532
|
const {a: a, b: b, c: c, d: d, e: e, f: f} = t;
|
|
@@ -510,15 +565,15 @@ const MatrixHelper = {
|
|
|
510
565
|
to.f = e * parent.b + f * parent.d + parent.f;
|
|
511
566
|
},
|
|
512
567
|
divide(t, child) {
|
|
513
|
-
M$
|
|
568
|
+
M$b.multiply(t, M$b.tempInvert(child));
|
|
514
569
|
},
|
|
515
570
|
divideParent(t, parent) {
|
|
516
|
-
M$
|
|
571
|
+
M$b.multiplyParent(t, M$b.tempInvert(parent));
|
|
517
572
|
},
|
|
518
573
|
tempInvert(t) {
|
|
519
|
-
const {tempMatrix: tempMatrix} = M$
|
|
520
|
-
M$
|
|
521
|
-
M$
|
|
574
|
+
const {tempMatrix: tempMatrix} = M$b;
|
|
575
|
+
M$b.copy(tempMatrix, t);
|
|
576
|
+
M$b.invert(tempMatrix);
|
|
522
577
|
return tempMatrix;
|
|
523
578
|
},
|
|
524
579
|
invert(t) {
|
|
@@ -596,7 +651,7 @@ const MatrixHelper = {
|
|
|
596
651
|
}
|
|
597
652
|
t.e = x;
|
|
598
653
|
t.f = y;
|
|
599
|
-
if (origin = origin || around) M$
|
|
654
|
+
if (origin = origin || around) M$b.translateInner(t, -origin.x, -origin.y, !around);
|
|
600
655
|
},
|
|
601
656
|
getLayout(t, origin, around, firstSkewY) {
|
|
602
657
|
const {a: a, b: b, c: c, d: d, e: e, f: f} = t;
|
|
@@ -657,11 +712,11 @@ const MatrixHelper = {
|
|
|
657
712
|
return world;
|
|
658
713
|
},
|
|
659
714
|
reset(t) {
|
|
660
|
-
M$
|
|
715
|
+
M$b.set(t);
|
|
661
716
|
}
|
|
662
717
|
};
|
|
663
718
|
|
|
664
|
-
const M$
|
|
719
|
+
const M$b = MatrixHelper;
|
|
665
720
|
|
|
666
721
|
const {toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$3} = MatrixHelper;
|
|
667
722
|
|
|
@@ -922,6 +977,10 @@ class Matrix {
|
|
|
922
977
|
this.scaleY *= y || x;
|
|
923
978
|
return this;
|
|
924
979
|
}
|
|
980
|
+
pixelScale(pixelRatio) {
|
|
981
|
+
MatrixHelper.pixelScale(this, pixelRatio);
|
|
982
|
+
return this;
|
|
983
|
+
}
|
|
925
984
|
scaleOfOuter(origin, x, y) {
|
|
926
985
|
MatrixHelper.scaleOfOuter(this, origin, x, y);
|
|
927
986
|
return this;
|
|
@@ -1001,7 +1060,7 @@ class Matrix {
|
|
|
1001
1060
|
}
|
|
1002
1061
|
}
|
|
1003
1062
|
|
|
1004
|
-
const tempMatrix$
|
|
1063
|
+
const tempMatrix$2 = new Matrix;
|
|
1005
1064
|
|
|
1006
1065
|
const TwoPointBoundsHelper = {
|
|
1007
1066
|
tempPointBounds: {},
|
|
@@ -1151,10 +1210,10 @@ const point$2 = {};
|
|
|
1151
1210
|
|
|
1152
1211
|
const toPoint$5 = {};
|
|
1153
1212
|
|
|
1154
|
-
const tempBounds$
|
|
1213
|
+
const tempBounds$3 = {};
|
|
1155
1214
|
|
|
1156
1215
|
const BoundsHelper = {
|
|
1157
|
-
tempBounds: tempBounds$
|
|
1216
|
+
tempBounds: tempBounds$3,
|
|
1158
1217
|
set(t, x = 0, y = 0, width = 0, height = 0) {
|
|
1159
1218
|
t.x = x;
|
|
1160
1219
|
t.y = y;
|
|
@@ -1205,19 +1264,11 @@ const BoundsHelper = {
|
|
|
1205
1264
|
B.move(t, x, y);
|
|
1206
1265
|
return t;
|
|
1207
1266
|
},
|
|
1208
|
-
toOffsetOutBounds(t, to,
|
|
1209
|
-
if (!to)
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
}
|
|
1214
|
-
if (parent) {
|
|
1215
|
-
to.offsetX = -(B.maxX(parent) - t.x);
|
|
1216
|
-
to.offsetY = -(B.maxY(parent) - t.y);
|
|
1217
|
-
} else {
|
|
1218
|
-
to.offsetX = t.x + t.width;
|
|
1219
|
-
to.offsetY = t.y + t.height;
|
|
1220
|
-
}
|
|
1267
|
+
toOffsetOutBounds(t, to, offsetBounds) {
|
|
1268
|
+
if (!to) to = t; else copy$c(to, t);
|
|
1269
|
+
if (!offsetBounds) offsetBounds = t;
|
|
1270
|
+
to.offsetX = B.maxX(offsetBounds);
|
|
1271
|
+
to.offsetY = B.maxY(offsetBounds);
|
|
1221
1272
|
B.move(to, -to.offsetX, -to.offsetY);
|
|
1222
1273
|
},
|
|
1223
1274
|
scale(t, scaleX, scaleY = scaleX, onlySize) {
|
|
@@ -1231,9 +1282,9 @@ const BoundsHelper = {
|
|
|
1231
1282
|
t.height *= scaleY;
|
|
1232
1283
|
},
|
|
1233
1284
|
tempToOuterOf(t, matrix) {
|
|
1234
|
-
B.copy(tempBounds$
|
|
1235
|
-
B.toOuterOf(tempBounds$
|
|
1236
|
-
return tempBounds$
|
|
1285
|
+
B.copy(tempBounds$3, t);
|
|
1286
|
+
B.toOuterOf(tempBounds$3, matrix);
|
|
1287
|
+
return tempBounds$3;
|
|
1237
1288
|
},
|
|
1238
1289
|
getOuterOf(t, matrix) {
|
|
1239
1290
|
t = Object.assign({}, t);
|
|
@@ -1291,9 +1342,9 @@ const BoundsHelper = {
|
|
|
1291
1342
|
put(t, put, align = "center", putScale = 1, changeSize = true, to) {
|
|
1292
1343
|
to || (to = put);
|
|
1293
1344
|
if (isString(putScale)) putScale = B.getFitScale(t, put, putScale === "cover");
|
|
1294
|
-
tempBounds$
|
|
1295
|
-
tempBounds$
|
|
1296
|
-
AlignHelper.toPoint(align, tempBounds$
|
|
1345
|
+
tempBounds$3.width = changeSize ? put.width *= putScale : put.width * putScale;
|
|
1346
|
+
tempBounds$3.height = changeSize ? put.height *= putScale : put.height * putScale;
|
|
1347
|
+
AlignHelper.toPoint(align, tempBounds$3, t, to, true, true);
|
|
1297
1348
|
},
|
|
1298
1349
|
getSpread(t, spread, side) {
|
|
1299
1350
|
const n = {};
|
|
@@ -1363,7 +1414,7 @@ const BoundsHelper = {
|
|
|
1363
1414
|
first = false;
|
|
1364
1415
|
if (!addMode) copy$c(t, bounds);
|
|
1365
1416
|
} else {
|
|
1366
|
-
add$
|
|
1417
|
+
add$2(t, bounds);
|
|
1367
1418
|
}
|
|
1368
1419
|
}
|
|
1369
1420
|
}
|
|
@@ -1377,7 +1428,7 @@ const BoundsHelper = {
|
|
|
1377
1428
|
B.set(t, point.x, point.y);
|
|
1378
1429
|
},
|
|
1379
1430
|
addPoint(t, point) {
|
|
1380
|
-
add$
|
|
1431
|
+
add$2(t, point, true);
|
|
1381
1432
|
},
|
|
1382
1433
|
getPoints(t) {
|
|
1383
1434
|
const {x: x, y: y, width: width, height: height} = t;
|
|
@@ -1448,7 +1499,7 @@ const BoundsHelper = {
|
|
|
1448
1499
|
|
|
1449
1500
|
const B = BoundsHelper;
|
|
1450
1501
|
|
|
1451
|
-
const {add: add$
|
|
1502
|
+
const {add: add$2, copy: copy$c} = B;
|
|
1452
1503
|
|
|
1453
1504
|
class Bounds {
|
|
1454
1505
|
get minX() {
|
|
@@ -1593,7 +1644,7 @@ class Bounds {
|
|
|
1593
1644
|
}
|
|
1594
1645
|
}
|
|
1595
1646
|
|
|
1596
|
-
const tempBounds$
|
|
1647
|
+
const tempBounds$2 = new Bounds;
|
|
1597
1648
|
|
|
1598
1649
|
class AutoBounds {
|
|
1599
1650
|
constructor(top, right, bottom, left, width, height) {
|
|
@@ -2146,7 +2197,7 @@ __decorate([ contextMethod() ], Canvas$1.prototype, "measureText", null);
|
|
|
2146
2197
|
|
|
2147
2198
|
__decorate([ contextMethod() ], Canvas$1.prototype, "strokeText", null);
|
|
2148
2199
|
|
|
2149
|
-
const {copy: copy$b, multiplyParent: multiplyParent$4} = MatrixHelper, {round: round$4} = Math, tempPixelBounds = new Bounds, tempPixelBounds2 = new Bounds;
|
|
2200
|
+
const {copy: copy$b, multiplyParent: multiplyParent$4, pixelScale: pixelScale} = MatrixHelper, {round: round$4} = Math, tempPixelBounds = new Bounds, tempPixelBounds2 = new Bounds;
|
|
2150
2201
|
|
|
2151
2202
|
const minSize = {
|
|
2152
2203
|
width: 1,
|
|
@@ -2247,13 +2298,8 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
2247
2298
|
setWorld(matrix, parentMatrix) {
|
|
2248
2299
|
const {pixelRatio: pixelRatio, pixelSnap: pixelSnap} = this, w = this.worldTransform;
|
|
2249
2300
|
if (parentMatrix) multiplyParent$4(matrix, parentMatrix, w);
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
w.c = matrix.c * pixelRatio;
|
|
2253
|
-
w.d = matrix.d * pixelRatio;
|
|
2254
|
-
w.e = matrix.e * pixelRatio;
|
|
2255
|
-
w.f = matrix.f * pixelRatio;
|
|
2256
|
-
if (pixelSnap) {
|
|
2301
|
+
pixelScale(matrix, pixelRatio, w);
|
|
2302
|
+
if (pixelSnap && !matrix.ignorePixelSnap) {
|
|
2257
2303
|
if (matrix.half && matrix.half * pixelRatio % 2) w.e = round$4(w.e - .5) + .5, w.f = round$4(w.f - .5) + .5; else w.e = round$4(w.e),
|
|
2258
2304
|
w.f = round$4(w.f);
|
|
2259
2305
|
}
|
|
@@ -2552,14 +2598,14 @@ const {setPoint: setPoint$4, addPoint: addPoint$2} = TwoPointBoundsHelper;
|
|
|
2552
2598
|
|
|
2553
2599
|
const {set: set, toNumberPoints: toNumberPoints$1} = PointHelper;
|
|
2554
2600
|
|
|
2555
|
-
const {M: M$
|
|
2601
|
+
const {M: M$a, L: L$a, C: C$8, Q: Q$7, Z: Z$8} = PathCommandMap;
|
|
2556
2602
|
|
|
2557
2603
|
const tempPoint$2 = {};
|
|
2558
2604
|
|
|
2559
2605
|
const BezierHelper = {
|
|
2560
2606
|
points(data, originPoints, curve, close) {
|
|
2561
2607
|
let points = toNumberPoints$1(originPoints);
|
|
2562
|
-
data.push(M$
|
|
2608
|
+
data.push(M$a, points[0], points[1]);
|
|
2563
2609
|
if (curve && points.length > 5) {
|
|
2564
2610
|
let aX, aY, bX, bY, cX, cY, c1X, c1Y, c2X, c2Y;
|
|
2565
2611
|
let ba, cb, d, len = points.length;
|
|
@@ -2666,7 +2712,7 @@ const BezierHelper = {
|
|
|
2666
2712
|
let startX = x = rotationCos * radiusX * startCos - rotationSin * radiusY * startSin;
|
|
2667
2713
|
let startY = y = rotationSin * radiusX * startCos + rotationCos * radiusY * startSin;
|
|
2668
2714
|
let fromX = cx + x, fromY = cy + y;
|
|
2669
|
-
if (data) data.push(data.length ? L$a : M$
|
|
2715
|
+
if (data) data.push(data.length ? L$a : M$a, fromX, fromY);
|
|
2670
2716
|
if (setPointBounds) setPoint$4(setPointBounds, fromX, fromY);
|
|
2671
2717
|
if (setStartPoint) set(setStartPoint, fromX, fromY);
|
|
2672
2718
|
for (let i = 0; i < parts; i++) {
|
|
@@ -2796,7 +2842,7 @@ const EllipseHelper = {
|
|
|
2796
2842
|
}
|
|
2797
2843
|
};
|
|
2798
2844
|
|
|
2799
|
-
const {M: M$
|
|
2845
|
+
const {M: M$9, m: m, L: L$9, l: l, H: H, h: h, V: V, v: v, C: C$7, c: c, S: S, s: s, Q: Q$6, q: q, T: T, t: t, A: A, a: a, Z: Z$7, z: z, N: N$5, D: D$6, X: X$5, G: G$5, F: F$6, O: O$6, P: P$5, U: U$5} = PathCommandMap;
|
|
2800
2846
|
|
|
2801
2847
|
const {rect: rect$3, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse: ellipse$4, quadraticCurveTo: quadraticCurveTo$1} = BezierHelper;
|
|
2802
2848
|
|
|
@@ -2888,10 +2934,10 @@ const PathConvert = {
|
|
|
2888
2934
|
old[i + 1] += x;
|
|
2889
2935
|
old[i + 2] += y;
|
|
2890
2936
|
|
|
2891
|
-
case M$
|
|
2937
|
+
case M$9:
|
|
2892
2938
|
x = old[i + 1];
|
|
2893
2939
|
y = old[i + 2];
|
|
2894
|
-
data.push(M$
|
|
2940
|
+
data.push(M$9, x, y);
|
|
2895
2941
|
i += 3;
|
|
2896
2942
|
break;
|
|
2897
2943
|
|
|
@@ -3078,7 +3124,7 @@ const PathConvert = {
|
|
|
3078
3124
|
list.forEach(item => {
|
|
3079
3125
|
switch (item.name) {
|
|
3080
3126
|
case "M":
|
|
3081
|
-
data.push(M$
|
|
3127
|
+
data.push(M$9, item.x, item.y);
|
|
3082
3128
|
break;
|
|
3083
3129
|
|
|
3084
3130
|
case "L":
|
|
@@ -3117,7 +3163,7 @@ const PathConvert = {
|
|
|
3117
3163
|
|
|
3118
3164
|
const {current: current, pushData: pushData, copyData: copyData} = PathConvert;
|
|
3119
3165
|
|
|
3120
|
-
const {M: M$
|
|
3166
|
+
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;
|
|
3121
3167
|
|
|
3122
3168
|
const {getMinDistanceFrom: getMinDistanceFrom, getRadianFrom: getRadianFrom} = PointHelper;
|
|
3123
3169
|
|
|
@@ -3130,7 +3176,7 @@ const PathCommandDataHelper = {
|
|
|
3130
3176
|
data.length = 0;
|
|
3131
3177
|
},
|
|
3132
3178
|
moveTo(data, x, y) {
|
|
3133
|
-
data.push(M$
|
|
3179
|
+
data.push(M$8, x, y);
|
|
3134
3180
|
},
|
|
3135
3181
|
lineTo(data, x, y) {
|
|
3136
3182
|
data.push(L$8, x, y);
|
|
@@ -3185,12 +3231,12 @@ const PathCommandDataHelper = {
|
|
|
3185
3231
|
},
|
|
3186
3232
|
drawEllipse(data, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise) {
|
|
3187
3233
|
BezierHelper.ellipse(null, x, y, radiusX, radiusY, isNull(rotation) ? 0 : rotation, isNull(startAngle) ? 0 : startAngle, isNull(endAngle) ? 360 : endAngle, anticlockwise, null, null, startPoint);
|
|
3188
|
-
data.push(M$
|
|
3234
|
+
data.push(M$8, startPoint.x, startPoint.y);
|
|
3189
3235
|
ellipse$3(data, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise);
|
|
3190
3236
|
},
|
|
3191
3237
|
drawArc(data, x, y, radius, startAngle, endAngle, anticlockwise) {
|
|
3192
3238
|
BezierHelper.arc(null, x, y, radius, isNull(startAngle) ? 0 : startAngle, isNull(endAngle) ? 360 : endAngle, anticlockwise, null, null, startPoint);
|
|
3193
|
-
data.push(M$
|
|
3239
|
+
data.push(M$8, startPoint.x, startPoint.y);
|
|
3194
3240
|
arc$2(data, x, y, radius, startAngle, endAngle, anticlockwise);
|
|
3195
3241
|
},
|
|
3196
3242
|
drawPoints(data, points, curve, close) {
|
|
@@ -3292,7 +3338,7 @@ class PathCreator {
|
|
|
3292
3338
|
paint() {}
|
|
3293
3339
|
}
|
|
3294
3340
|
|
|
3295
|
-
const {M: M$
|
|
3341
|
+
const {M: M$7, L: L$7, C: C$5, Q: Q$4, Z: Z$5, N: N$3, D: D$4, X: X$3, G: G$3, F: F$4, O: O$4, P: P$3, U: U$3} = PathCommandMap;
|
|
3296
3342
|
|
|
3297
3343
|
const debug$e = Debug.get("PathDrawer");
|
|
3298
3344
|
|
|
@@ -3304,7 +3350,7 @@ const PathDrawer = {
|
|
|
3304
3350
|
while (i < len) {
|
|
3305
3351
|
command = data[i];
|
|
3306
3352
|
switch (command) {
|
|
3307
|
-
case M$
|
|
3353
|
+
case M$7:
|
|
3308
3354
|
drawer.moveTo(data[i + 1], data[i + 2]);
|
|
3309
3355
|
i += 3;
|
|
3310
3356
|
break;
|
|
@@ -3377,7 +3423,7 @@ const PathDrawer = {
|
|
|
3377
3423
|
}
|
|
3378
3424
|
};
|
|
3379
3425
|
|
|
3380
|
-
const {M: M$
|
|
3426
|
+
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;
|
|
3381
3427
|
|
|
3382
3428
|
const {toTwoPointBounds: toTwoPointBounds, toTwoPointBoundsByQuadraticCurve: toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc: arc, ellipse: ellipse$1} = BezierHelper;
|
|
3383
3429
|
|
|
@@ -3412,7 +3458,7 @@ const PathBounds = {
|
|
|
3412
3458
|
}
|
|
3413
3459
|
}
|
|
3414
3460
|
switch (command) {
|
|
3415
|
-
case M$
|
|
3461
|
+
case M$6:
|
|
3416
3462
|
case L$6:
|
|
3417
3463
|
x = data[i + 1];
|
|
3418
3464
|
y = data[i + 2];
|
|
@@ -3512,7 +3558,7 @@ const PathBounds = {
|
|
|
3512
3558
|
}
|
|
3513
3559
|
};
|
|
3514
3560
|
|
|
3515
|
-
const {M: M$
|
|
3561
|
+
const {M: M$5, L: L$5, Z: Z$3} = PathCommandMap;
|
|
3516
3562
|
|
|
3517
3563
|
const {getCenterX: getCenterX, getCenterY: getCenterY} = PointHelper;
|
|
3518
3564
|
|
|
@@ -3527,16 +3573,16 @@ const PathCorner = {
|
|
|
3527
3573
|
while (i < len) {
|
|
3528
3574
|
command = data[i];
|
|
3529
3575
|
switch (command) {
|
|
3530
|
-
case M$
|
|
3576
|
+
case M$5:
|
|
3531
3577
|
startX = lastX = data[i + 1];
|
|
3532
3578
|
startY = lastY = data[i + 2];
|
|
3533
3579
|
i += 3;
|
|
3534
3580
|
if (data[i] === L$5) {
|
|
3535
3581
|
secondX = data[i + 1];
|
|
3536
3582
|
secondY = data[i + 2];
|
|
3537
|
-
smooth.push(M$
|
|
3583
|
+
smooth.push(M$5, getCenterX(startX, secondX), getCenterY(startY, secondY));
|
|
3538
3584
|
} else {
|
|
3539
|
-
smooth.push(M$
|
|
3585
|
+
smooth.push(M$5, startX, startY);
|
|
3540
3586
|
}
|
|
3541
3587
|
break;
|
|
3542
3588
|
|
|
@@ -3977,7 +4023,7 @@ const I$1 = ImageManager;
|
|
|
3977
4023
|
|
|
3978
4024
|
const {IMAGE: IMAGE, create: create$1} = IncrementId;
|
|
3979
4025
|
|
|
3980
|
-
const {floor: floor$2, max: max$
|
|
4026
|
+
const {floor: floor$2, max: max$4} = Math;
|
|
3981
4027
|
|
|
3982
4028
|
class LeaferImage {
|
|
3983
4029
|
get url() {
|
|
@@ -4066,7 +4112,7 @@ class LeaferImage {
|
|
|
4066
4112
|
}
|
|
4067
4113
|
if (data) return data;
|
|
4068
4114
|
}
|
|
4069
|
-
const canvas = Platform.origin.createCanvas(max$
|
|
4115
|
+
const canvas = Platform.origin.createCanvas(max$4(floor$2(width + (xGap || 0)), 1), max$4(floor$2(height + (yGap || 0)), 1));
|
|
4070
4116
|
const ctx = canvas.getContext("2d");
|
|
4071
4117
|
if (opacity) ctx.globalAlpha = opacity;
|
|
4072
4118
|
ctx.imageSmoothingEnabled = smooth === false ? false : true;
|
|
@@ -4265,6 +4311,18 @@ function surfaceType(defaultValue) {
|
|
|
4265
4311
|
}));
|
|
4266
4312
|
}
|
|
4267
4313
|
|
|
4314
|
+
function dimType(defaultValue) {
|
|
4315
|
+
return decorateLeafAttr(defaultValue, key => attr({
|
|
4316
|
+
set(value) {
|
|
4317
|
+
if (this.__setAttr(key, value)) {
|
|
4318
|
+
const data = this.__;
|
|
4319
|
+
DataHelper.stintSet(data, "__useDim", data.dim || data.bright || data.dimskip);
|
|
4320
|
+
this.__layout.surfaceChange();
|
|
4321
|
+
}
|
|
4322
|
+
}
|
|
4323
|
+
}));
|
|
4324
|
+
}
|
|
4325
|
+
|
|
4268
4326
|
function opacityType(defaultValue) {
|
|
4269
4327
|
return decorateLeafAttr(defaultValue, key => attr({
|
|
4270
4328
|
set(value) {
|
|
@@ -4309,7 +4367,7 @@ function sortType(defaultValue) {
|
|
|
4309
4367
|
return decorateLeafAttr(defaultValue, key => attr({
|
|
4310
4368
|
set(value) {
|
|
4311
4369
|
if (this.__setAttr(key, value)) {
|
|
4312
|
-
this.__layout.
|
|
4370
|
+
this.__layout.surfaceChange();
|
|
4313
4371
|
this.waitParent(() => {
|
|
4314
4372
|
this.parent.__layout.childrenSortChange();
|
|
4315
4373
|
});
|
|
@@ -4346,7 +4404,7 @@ function hitType(defaultValue) {
|
|
|
4346
4404
|
set(value) {
|
|
4347
4405
|
if (this.__setAttr(key, value)) {
|
|
4348
4406
|
this.__layout.hitCanvasChanged = true;
|
|
4349
|
-
if (Debug.showBounds === "hit") this.__layout.
|
|
4407
|
+
if (Debug.showBounds === "hit") this.__layout.surfaceChange();
|
|
4350
4408
|
if (this.leafer) this.leafer.updateCursor();
|
|
4351
4409
|
}
|
|
4352
4410
|
}
|
|
@@ -4848,7 +4906,7 @@ const WaitHelper = {
|
|
|
4848
4906
|
|
|
4849
4907
|
const {getRelativeWorld: getRelativeWorld$1, updateBounds: updateBounds$3} = LeafHelper;
|
|
4850
4908
|
|
|
4851
|
-
const {toOuterOf: toOuterOf$
|
|
4909
|
+
const {toOuterOf: toOuterOf$3, getPoints: getPoints, copy: copy$8} = BoundsHelper;
|
|
4852
4910
|
|
|
4853
4911
|
const localContent = "_localContentBounds";
|
|
4854
4912
|
|
|
@@ -4871,7 +4929,7 @@ class LeafLayout {
|
|
|
4871
4929
|
this._renderBounds = bounds;
|
|
4872
4930
|
}
|
|
4873
4931
|
get localContentBounds() {
|
|
4874
|
-
toOuterOf$
|
|
4932
|
+
toOuterOf$3(this.contentBounds, this.leaf.__localMatrix, this[localContent] || (this[localContent] = {}));
|
|
4875
4933
|
return this[localContent];
|
|
4876
4934
|
}
|
|
4877
4935
|
get localStrokeBounds() {
|
|
@@ -4881,15 +4939,15 @@ class LeafLayout {
|
|
|
4881
4939
|
return this._localRenderBounds || this;
|
|
4882
4940
|
}
|
|
4883
4941
|
get worldContentBounds() {
|
|
4884
|
-
toOuterOf$
|
|
4942
|
+
toOuterOf$3(this.contentBounds, this.leaf.__world, this[worldContent] || (this[worldContent] = {}));
|
|
4885
4943
|
return this[worldContent];
|
|
4886
4944
|
}
|
|
4887
4945
|
get worldBoxBounds() {
|
|
4888
|
-
toOuterOf$
|
|
4946
|
+
toOuterOf$3(this.boxBounds, this.leaf.__world, this[worldBox] || (this[worldBox] = {}));
|
|
4889
4947
|
return this[worldBox];
|
|
4890
4948
|
}
|
|
4891
4949
|
get worldStrokeBounds() {
|
|
4892
|
-
toOuterOf$
|
|
4950
|
+
toOuterOf$3(this.strokeBounds, this.leaf.__world, this[worldStroke] || (this[worldStroke] = {}));
|
|
4893
4951
|
return this[worldStroke];
|
|
4894
4952
|
}
|
|
4895
4953
|
get a() {
|
|
@@ -5741,14 +5799,14 @@ const {updateMatrix: updateMatrix$3, updateAllMatrix: updateAllMatrix$3} = LeafH
|
|
|
5741
5799
|
|
|
5742
5800
|
const {updateBounds: updateBounds$2} = BranchHelper;
|
|
5743
5801
|
|
|
5744
|
-
const {toOuterOf: toOuterOf$
|
|
5802
|
+
const {toOuterOf: toOuterOf$2, copyAndSpread: copyAndSpread$3, copy: copy$7} = BoundsHelper;
|
|
5745
5803
|
|
|
5746
5804
|
const {toBounds: toBounds$1} = PathBounds;
|
|
5747
5805
|
|
|
5748
5806
|
const LeafBounds = {
|
|
5749
5807
|
__updateWorldBounds() {
|
|
5750
5808
|
const layout = this.__layout;
|
|
5751
|
-
toOuterOf$
|
|
5809
|
+
toOuterOf$2(layout.renderBounds, this.__world, this.__world);
|
|
5752
5810
|
if (layout.resized) {
|
|
5753
5811
|
if (layout.resized === "inner") this.__onUpdateSize();
|
|
5754
5812
|
if (this.__hasLocalEvent) BoundsEvent.emitLocal(this);
|
|
@@ -5804,13 +5862,13 @@ const LeafBounds = {
|
|
|
5804
5862
|
__updateLocalBoxBounds() {
|
|
5805
5863
|
if (this.__hasMotionPath) this.__updateMotionPath();
|
|
5806
5864
|
if (this.__hasAutoLayout) this.__updateAutoLayout();
|
|
5807
|
-
toOuterOf$
|
|
5865
|
+
toOuterOf$2(this.__layout.boxBounds, this.__local, this.__local);
|
|
5808
5866
|
},
|
|
5809
5867
|
__updateLocalStrokeBounds() {
|
|
5810
|
-
toOuterOf$
|
|
5868
|
+
toOuterOf$2(this.__layout.strokeBounds, this.__localMatrix, this.__layout.localStrokeBounds);
|
|
5811
5869
|
},
|
|
5812
5870
|
__updateLocalRenderBounds() {
|
|
5813
|
-
toOuterOf$
|
|
5871
|
+
toOuterOf$2(this.__layout.renderBounds, this.__localMatrix, this.__layout.localRenderBounds);
|
|
5814
5872
|
},
|
|
5815
5873
|
__updateBoxBounds(_secondLayout, _bounds) {
|
|
5816
5874
|
const b = this.__layout.boxBounds;
|
|
@@ -5848,11 +5906,11 @@ const LeafBounds = {
|
|
|
5848
5906
|
},
|
|
5849
5907
|
__updateStrokeBounds(_bounds) {
|
|
5850
5908
|
const layout = this.__layout;
|
|
5851
|
-
copyAndSpread$
|
|
5909
|
+
copyAndSpread$3(layout.strokeBounds, layout.boxBounds, layout.strokeBoxSpread);
|
|
5852
5910
|
},
|
|
5853
5911
|
__updateRenderBounds(_bounds) {
|
|
5854
|
-
const layout = this.__layout;
|
|
5855
|
-
|
|
5912
|
+
const layout = this.__layout, {renderSpread: renderSpread} = layout;
|
|
5913
|
+
isNumber(renderSpread) && renderSpread <= 0 ? copy$7(layout.renderBounds, layout.strokeBounds) : copyAndSpread$3(layout.renderBounds, layout.boxBounds, renderSpread);
|
|
5856
5914
|
}
|
|
5857
5915
|
};
|
|
5858
5916
|
|
|
@@ -5861,6 +5919,7 @@ const LeafRender = {
|
|
|
5861
5919
|
if (options.shape) return this.__renderShape(canvas, options);
|
|
5862
5920
|
if (this.__worldOpacity) {
|
|
5863
5921
|
const data = this.__;
|
|
5922
|
+
if (data.bright && !options.topRendering) return options.topList.add(this);
|
|
5864
5923
|
canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
|
|
5865
5924
|
canvas.opacity = options.dimOpacity && !data.dimskip ? data.opacity * options.dimOpacity : data.opacity;
|
|
5866
5925
|
if (this.__.__single) {
|
|
@@ -5909,7 +5968,9 @@ const BranchRender = {
|
|
|
5909
5968
|
this.__nowWorld = this.__getNowWorld(options);
|
|
5910
5969
|
if (this.__worldOpacity) {
|
|
5911
5970
|
const data = this.__;
|
|
5912
|
-
if (data.
|
|
5971
|
+
if (data.__useDim) {
|
|
5972
|
+
if (data.dim) options.dimOpacity = data.dim === true ? .2 : data.dim; else if (data.bright && !options.topRendering) return options.topList.add(this); else if (data.dimskip) options.dimOpacity && (options.dimOpacity = 0);
|
|
5973
|
+
}
|
|
5913
5974
|
if (data.__single && !this.isBranchLeaf) {
|
|
5914
5975
|
if (data.eraser === "path") return this.__renderEraser(canvas, options);
|
|
5915
5976
|
const tempCanvas = canvas.getSameCanvas(false, true);
|
|
@@ -5947,11 +6008,13 @@ const tempScaleData$1 = {};
|
|
|
5947
6008
|
|
|
5948
6009
|
const {LEAF: LEAF, create: create} = IncrementId;
|
|
5949
6010
|
|
|
6011
|
+
const {stintSet: stintSet$3} = DataHelper;
|
|
6012
|
+
|
|
5950
6013
|
const {toInnerPoint: toInnerPoint, toOuterPoint: toOuterPoint, multiplyParent: multiplyParent$1} = MatrixHelper;
|
|
5951
6014
|
|
|
5952
|
-
const {toOuterOf: toOuterOf} = BoundsHelper;
|
|
6015
|
+
const {toOuterOf: toOuterOf$1} = BoundsHelper;
|
|
5953
6016
|
|
|
5954
|
-
const {copy: copy$6, move: move$
|
|
6017
|
+
const {copy: copy$6, move: move$8} = PointHelper;
|
|
5955
6018
|
|
|
5956
6019
|
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;
|
|
5957
6020
|
|
|
@@ -6227,8 +6290,9 @@ let Leaf = class Leaf {
|
|
|
6227
6290
|
if (!this.__cameraWorld) this.__cameraWorld = {};
|
|
6228
6291
|
const cameraWorld = this.__cameraWorld, world = this.__world;
|
|
6229
6292
|
multiplyParent$1(world, options.matrix, cameraWorld, undefined, world);
|
|
6230
|
-
toOuterOf(this.__layout.renderBounds, cameraWorld, cameraWorld);
|
|
6231
|
-
cameraWorld
|
|
6293
|
+
toOuterOf$1(this.__layout.renderBounds, cameraWorld, cameraWorld);
|
|
6294
|
+
stintSet$3(cameraWorld, "half", world.half);
|
|
6295
|
+
stintSet$3(cameraWorld, "ignorePixelSnap", world.ignorePixelSnap);
|
|
6232
6296
|
return cameraWorld;
|
|
6233
6297
|
} else {
|
|
6234
6298
|
return this.__world;
|
|
@@ -6262,7 +6326,7 @@ let Leaf = class Leaf {
|
|
|
6262
6326
|
getWorldBounds(inner, relative, change) {
|
|
6263
6327
|
const matrix = relative ? getRelativeWorld(this, relative) : this.worldTransform;
|
|
6264
6328
|
const to = change ? inner : {};
|
|
6265
|
-
toOuterOf(inner, matrix, to);
|
|
6329
|
+
toOuterOf$1(inner, matrix, to);
|
|
6266
6330
|
return to;
|
|
6267
6331
|
}
|
|
6268
6332
|
worldToLocal(world, to, distance, relative) {
|
|
@@ -6295,7 +6359,7 @@ let Leaf = class Leaf {
|
|
|
6295
6359
|
}
|
|
6296
6360
|
getBoxPointByInner(inner, _relative, _distance, change) {
|
|
6297
6361
|
const point = change ? inner : Object.assign({}, inner), {x: x, y: y} = this.boxBounds;
|
|
6298
|
-
move$
|
|
6362
|
+
move$8(point, -x, -y);
|
|
6299
6363
|
return point;
|
|
6300
6364
|
}
|
|
6301
6365
|
getInnerPoint(world, relative, distance, change) {
|
|
@@ -6305,7 +6369,7 @@ let Leaf = class Leaf {
|
|
|
6305
6369
|
}
|
|
6306
6370
|
getInnerPointByBox(box, _relative, _distance, change) {
|
|
6307
6371
|
const point = change ? box : Object.assign({}, box), {x: x, y: y} = this.boxBounds;
|
|
6308
|
-
move$
|
|
6372
|
+
move$8(point, x, y);
|
|
6309
6373
|
return point;
|
|
6310
6374
|
}
|
|
6311
6375
|
getInnerPointByLocal(local, _relative, distance, change) {
|
|
@@ -6751,7 +6815,7 @@ class LeafLevelList {
|
|
|
6751
6815
|
}
|
|
6752
6816
|
}
|
|
6753
6817
|
|
|
6754
|
-
const version = "1.9.
|
|
6818
|
+
const version = "1.9.8";
|
|
6755
6819
|
|
|
6756
6820
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6757
6821
|
get allowBackgroundColor() {
|
|
@@ -7329,6 +7393,7 @@ class Renderer {
|
|
|
7329
7393
|
usePartRender: true,
|
|
7330
7394
|
maxFPS: 120
|
|
7331
7395
|
};
|
|
7396
|
+
this.frames = [];
|
|
7332
7397
|
this.target = target;
|
|
7333
7398
|
this.canvas = canvas;
|
|
7334
7399
|
if (userConfig) this.config = DataHelper.default(userConfig, this.config);
|
|
@@ -7458,7 +7523,7 @@ class Renderer {
|
|
|
7458
7523
|
};
|
|
7459
7524
|
if (this.needFill) canvas.fillWorld(bounds, this.config.fill);
|
|
7460
7525
|
if (Debug.showRepaint) Debug.drawRepaint(canvas, bounds);
|
|
7461
|
-
this.target
|
|
7526
|
+
Platform.render(this.target, canvas, options);
|
|
7462
7527
|
this.renderBounds = realBounds = realBounds || bounds;
|
|
7463
7528
|
this.renderOptions = options;
|
|
7464
7529
|
this.totalBounds.isEmpty() ? this.totalBounds = realBounds : this.totalBounds.add(realBounds);
|
|
@@ -7481,12 +7546,15 @@ class Renderer {
|
|
|
7481
7546
|
const target = this.target;
|
|
7482
7547
|
if (this.requestTime || !target) return;
|
|
7483
7548
|
if (target.parentApp) return target.parentApp.requestRender(false);
|
|
7484
|
-
|
|
7549
|
+
this.requestTime = this.frameTime || Date.now();
|
|
7485
7550
|
const render = () => {
|
|
7486
|
-
const nowFPS = 1e3 / (Date.now() - requestTime);
|
|
7551
|
+
const nowFPS = 1e3 / ((this.frameTime = Date.now()) - this.requestTime);
|
|
7487
7552
|
const {maxFPS: maxFPS} = this.config;
|
|
7488
|
-
if (maxFPS && nowFPS > maxFPS
|
|
7489
|
-
|
|
7553
|
+
if (maxFPS && nowFPS > maxFPS) return Platform.requestRender(render);
|
|
7554
|
+
const {frames: frames} = this;
|
|
7555
|
+
if (frames.length > 30) frames.shift();
|
|
7556
|
+
frames.push(nowFPS);
|
|
7557
|
+
this.FPS = Math.round(frames.reduce((a, b) => a + b, 0) / frames.length);
|
|
7490
7558
|
this.requestTime = 0;
|
|
7491
7559
|
this.checkRender();
|
|
7492
7560
|
};
|
|
@@ -7734,6 +7802,15 @@ Object.assign(Creator, {
|
|
|
7734
7802
|
|
|
7735
7803
|
Platform.layout = Layouter.fullLayout;
|
|
7736
7804
|
|
|
7805
|
+
Platform.render = function(target, canvas, options) {
|
|
7806
|
+
const topOptions = Object.assign(Object.assign({}, options), {
|
|
7807
|
+
topRendering: true
|
|
7808
|
+
});
|
|
7809
|
+
options.topList = new LeafList;
|
|
7810
|
+
target.__render(canvas, options);
|
|
7811
|
+
if (options.topList.length) options.topList.forEach(item => item.__render(canvas, topOptions));
|
|
7812
|
+
};
|
|
7813
|
+
|
|
7737
7814
|
function effectType(defaultValue) {
|
|
7738
7815
|
return decorateLeafAttr(defaultValue, key => attr({
|
|
7739
7816
|
set(value) {
|
|
@@ -8133,39 +8210,41 @@ class CanvasData extends RectData {
|
|
|
8133
8210
|
}
|
|
8134
8211
|
}
|
|
8135
8212
|
|
|
8213
|
+
const {max: max$3, add: add$1} = FourNumberHelper;
|
|
8214
|
+
|
|
8136
8215
|
const UIBounds = {
|
|
8137
8216
|
__updateStrokeSpread() {
|
|
8138
|
-
let
|
|
8217
|
+
let spread = 0, boxSpread = 0;
|
|
8139
8218
|
const data = this.__, {strokeAlign: strokeAlign, __maxStrokeWidth: strokeWidth} = data, box = this.__box;
|
|
8140
8219
|
if ((data.stroke || data.hitStroke === "all") && strokeWidth && strokeAlign !== "inside") {
|
|
8141
|
-
|
|
8220
|
+
boxSpread = spread = strokeAlign === "center" ? strokeWidth / 2 : strokeWidth;
|
|
8142
8221
|
if (!data.__boxStroke) {
|
|
8143
|
-
const miterLimitAddWidth = data.__isLinePath ? 0 : 10 *
|
|
8222
|
+
const miterLimitAddWidth = data.__isLinePath ? 0 : 10 * spread;
|
|
8144
8223
|
const storkeCapAddWidth = data.strokeCap === "none" ? 0 : strokeWidth;
|
|
8145
|
-
|
|
8224
|
+
spread += Math.max(miterLimitAddWidth, storkeCapAddWidth);
|
|
8146
8225
|
}
|
|
8147
8226
|
}
|
|
8148
|
-
if (data.__useArrow)
|
|
8227
|
+
if (data.__useArrow) spread += strokeWidth * 5;
|
|
8149
8228
|
if (box) {
|
|
8150
|
-
|
|
8151
|
-
|
|
8229
|
+
spread = max$3(spread, box.__layout.strokeSpread = box.__updateStrokeSpread());
|
|
8230
|
+
boxSpread = Math.max(boxSpread, box.__layout.strokeBoxSpread);
|
|
8152
8231
|
}
|
|
8153
|
-
this.__layout.strokeBoxSpread =
|
|
8154
|
-
return
|
|
8232
|
+
this.__layout.strokeBoxSpread = boxSpread;
|
|
8233
|
+
return spread;
|
|
8155
8234
|
},
|
|
8156
8235
|
__updateRenderSpread() {
|
|
8157
|
-
let
|
|
8158
|
-
const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__;
|
|
8159
|
-
if (shadow)
|
|
8160
|
-
if (blur)
|
|
8161
|
-
if (filter)
|
|
8162
|
-
if (renderSpread)
|
|
8163
|
-
|
|
8164
|
-
|
|
8165
|
-
if (
|
|
8166
|
-
|
|
8167
|
-
|
|
8168
|
-
return
|
|
8236
|
+
let spread = 0;
|
|
8237
|
+
const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__, {strokeSpread: strokeSpread} = this.__layout, box = this.__box;
|
|
8238
|
+
if (shadow) spread = Effect.getShadowRenderSpread(this, shadow);
|
|
8239
|
+
if (blur) spread = max$3(spread, blur);
|
|
8240
|
+
if (filter) spread = add$1(spread, Filter.getSpread(filter));
|
|
8241
|
+
if (renderSpread) spread = add$1(spread, renderSpread);
|
|
8242
|
+
if (strokeSpread) spread = add$1(spread, strokeSpread);
|
|
8243
|
+
let shapeSpread = spread;
|
|
8244
|
+
if (innerShadow) shapeSpread = max$3(shapeSpread, Effect.getInnerShadowSpread(this, innerShadow));
|
|
8245
|
+
if (backgroundBlur) shapeSpread = max$3(shapeSpread, backgroundBlur);
|
|
8246
|
+
this.__layout.renderShapeSpread = shapeSpread;
|
|
8247
|
+
return box ? max$3(box.__updateRenderSpread(), spread) : spread;
|
|
8169
8248
|
}
|
|
8170
8249
|
};
|
|
8171
8250
|
|
|
@@ -8509,9 +8588,9 @@ __decorate([ visibleType(true) ], UI.prototype, "visible", void 0);
|
|
|
8509
8588
|
|
|
8510
8589
|
__decorate([ surfaceType(false) ], UI.prototype, "locked", void 0);
|
|
8511
8590
|
|
|
8512
|
-
__decorate([
|
|
8591
|
+
__decorate([ dimType(false) ], UI.prototype, "dim", void 0);
|
|
8513
8592
|
|
|
8514
|
-
__decorate([
|
|
8593
|
+
__decorate([ dimType(false) ], UI.prototype, "dimskip", void 0);
|
|
8515
8594
|
|
|
8516
8595
|
__decorate([ sortType(0) ], UI.prototype, "zIndex", void 0);
|
|
8517
8596
|
|
|
@@ -9476,7 +9555,7 @@ __decorate([ resizeType() ], Canvas.prototype, "contextSettings", void 0);
|
|
|
9476
9555
|
|
|
9477
9556
|
Canvas = __decorate([ registerUI() ], Canvas);
|
|
9478
9557
|
|
|
9479
|
-
const {copyAndSpread: copyAndSpread$
|
|
9558
|
+
const {copyAndSpread: copyAndSpread$2, includes: includes, spread: spread, setList: setList} = BoundsHelper;
|
|
9480
9559
|
|
|
9481
9560
|
let Text = class Text extends UI {
|
|
9482
9561
|
get __tag() {
|
|
@@ -9523,13 +9602,13 @@ let Text = class Text extends UI {
|
|
|
9523
9602
|
if (this.isOverflow) setList(data.__textBoxBounds = {}, [ b, contentBounds ]), layout.renderChanged = true; else data.__textBoxBounds = b;
|
|
9524
9603
|
}
|
|
9525
9604
|
__updateRenderSpread() {
|
|
9526
|
-
let
|
|
9527
|
-
if (!
|
|
9528
|
-
return
|
|
9605
|
+
let spread = super.__updateRenderSpread();
|
|
9606
|
+
if (!spread) spread = this.isOverflow ? 1 : 0;
|
|
9607
|
+
return spread;
|
|
9529
9608
|
}
|
|
9530
9609
|
__updateRenderBounds() {
|
|
9531
9610
|
const {renderBounds: renderBounds, renderSpread: renderSpread} = this.__layout;
|
|
9532
|
-
copyAndSpread$
|
|
9611
|
+
copyAndSpread$2(renderBounds, this.__.__textBoxBounds, renderSpread);
|
|
9533
9612
|
if (this.__box) this.__box.__layout.renderBounds = renderBounds;
|
|
9534
9613
|
}
|
|
9535
9614
|
__updateChange() {
|
|
@@ -9955,9 +10034,9 @@ let DragEvent = class DragEvent extends PointerEvent {
|
|
|
9955
10034
|
static setData(data) {
|
|
9956
10035
|
this.data = data;
|
|
9957
10036
|
}
|
|
9958
|
-
static getValidMove(leaf,
|
|
9959
|
-
const move = leaf.getLocalPoint(
|
|
9960
|
-
PointHelper.move(move,
|
|
10037
|
+
static getValidMove(leaf, localStart, worldTotal, checkLimit = true) {
|
|
10038
|
+
const move = leaf.getLocalPoint(worldTotal, null, true);
|
|
10039
|
+
PointHelper.move(move, localStart.x - leaf.x, localStart.y - leaf.y);
|
|
9961
10040
|
if (checkLimit) this.limitMove(leaf, move);
|
|
9962
10041
|
DragBoundsHelper.axisMove(leaf, move);
|
|
9963
10042
|
return move;
|
|
@@ -10987,8 +11066,8 @@ ui$5.__updateHitCanvas = function() {
|
|
|
10987
11066
|
if (isHitPixel) {
|
|
10988
11067
|
const {renderBounds: renderBounds} = this.__layout;
|
|
10989
11068
|
const size = Platform.image.hitCanvasSize;
|
|
10990
|
-
const scale = h.hitScale = tempBounds$
|
|
10991
|
-
const {x: x, y: y, width: width, height: height} = tempBounds$
|
|
11069
|
+
const scale = h.hitScale = tempBounds$2.set(0, 0, size, size).getFitMatrix(renderBounds).a;
|
|
11070
|
+
const {x: x, y: y, width: width, height: height} = tempBounds$2.set(renderBounds).scale(scale);
|
|
10992
11071
|
h.resize({
|
|
10993
11072
|
width: width,
|
|
10994
11073
|
height: height,
|
|
@@ -11085,8 +11164,8 @@ canvas$1.hitStroke = function(point, strokeWidth) {
|
|
|
11085
11164
|
canvas$1.hitPixel = function(radiusPoint, offset, scale = 1) {
|
|
11086
11165
|
let {x: x, y: y, radiusX: radiusX, radiusY: radiusY} = radiusPoint;
|
|
11087
11166
|
if (offset) x -= offset.x, y -= offset.y;
|
|
11088
|
-
tempBounds$
|
|
11089
|
-
const {data: data} = this.context.getImageData(tempBounds$
|
|
11167
|
+
tempBounds$2.set(x - radiusX, y - radiusY, radiusX * 2, radiusY * 2).scale(scale).ceil();
|
|
11168
|
+
const {data: data} = this.context.getImageData(tempBounds$2.x, tempBounds$2.y, tempBounds$2.width || 1, tempBounds$2.height || 1);
|
|
11090
11169
|
for (let i = 0, len = data.length; i < len; i += 4) {
|
|
11091
11170
|
if (data[i + 3] > 0) return true;
|
|
11092
11171
|
}
|
|
@@ -11398,24 +11477,29 @@ function drawOutside(stroke, ui, canvas) {
|
|
|
11398
11477
|
}
|
|
11399
11478
|
}
|
|
11400
11479
|
|
|
11401
|
-
const {getSpread: getSpread, getOuterOf: getOuterOf, getByMove: getByMove, getIntersectData: getIntersectData} = BoundsHelper;
|
|
11480
|
+
const {getSpread: getSpread, copyAndSpread: copyAndSpread$1, toOuterOf: toOuterOf, getOuterOf: getOuterOf, getByMove: getByMove, move: move$7, getIntersectData: getIntersectData} = BoundsHelper;
|
|
11481
|
+
|
|
11482
|
+
const tempBounds$1 = {};
|
|
11402
11483
|
|
|
11403
11484
|
function shape(ui, current, options) {
|
|
11404
11485
|
const canvas = current.getSameCanvas();
|
|
11405
|
-
const nowWorld = ui.__nowWorld,
|
|
11406
|
-
|
|
11486
|
+
const currentBounds = current.bounds, nowWorld = ui.__nowWorld, layout = ui.__layout;
|
|
11487
|
+
const nowWorldShapeBounds = ui.__nowWorldShapeBounds || (ui.__nowWorldShapeBounds = {});
|
|
11488
|
+
toOuterOf(layout.strokeSpread ? (copyAndSpread$1(tempBounds$1, layout.boxBounds, layout.strokeSpread),
|
|
11489
|
+
tempBounds$1) : layout.boxBounds, nowWorld, nowWorldShapeBounds);
|
|
11490
|
+
let bounds, renderBounds, matrix, fitMatrix, shapeBounds, worldCanvas;
|
|
11407
11491
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true);
|
|
11408
|
-
if (currentBounds.includes(
|
|
11492
|
+
if (currentBounds.includes(nowWorldShapeBounds)) {
|
|
11409
11493
|
worldCanvas = canvas;
|
|
11410
|
-
bounds = shapeBounds =
|
|
11494
|
+
bounds = shapeBounds = nowWorldShapeBounds;
|
|
11495
|
+
renderBounds = nowWorld;
|
|
11411
11496
|
} else {
|
|
11412
|
-
const {renderShapeSpread: spread} = ui.__layout;
|
|
11413
11497
|
let worldClipBounds;
|
|
11414
11498
|
if (Platform.fullImageShadow) {
|
|
11415
|
-
worldClipBounds =
|
|
11499
|
+
worldClipBounds = nowWorldShapeBounds;
|
|
11416
11500
|
} else {
|
|
11417
|
-
const spreadBounds =
|
|
11418
|
-
worldClipBounds = getIntersectData(spreadBounds,
|
|
11501
|
+
const spreadBounds = layout.renderShapeSpread ? getSpread(currentBounds, FourNumberHelper.swapAndScale(layout.renderShapeSpread, scaleX, scaleY)) : currentBounds;
|
|
11502
|
+
worldClipBounds = getIntersectData(spreadBounds, nowWorldShapeBounds);
|
|
11419
11503
|
}
|
|
11420
11504
|
fitMatrix = currentBounds.getFitMatrix(worldClipBounds);
|
|
11421
11505
|
let {a: fitScaleX, d: fitScaleY} = fitMatrix;
|
|
@@ -11425,8 +11509,10 @@ function shape(ui, current, options) {
|
|
|
11425
11509
|
scaleX *= fitScaleX;
|
|
11426
11510
|
scaleY *= fitScaleY;
|
|
11427
11511
|
}
|
|
11428
|
-
shapeBounds = getOuterOf(
|
|
11512
|
+
shapeBounds = getOuterOf(nowWorldShapeBounds, fitMatrix);
|
|
11429
11513
|
bounds = getByMove(shapeBounds, -fitMatrix.e, -fitMatrix.f);
|
|
11514
|
+
renderBounds = getOuterOf(nowWorld, fitMatrix);
|
|
11515
|
+
move$7(renderBounds, -fitMatrix.e, -fitMatrix.f);
|
|
11430
11516
|
const userMatrix = options.matrix;
|
|
11431
11517
|
if (userMatrix) {
|
|
11432
11518
|
matrix = new Matrix(fitMatrix);
|
|
@@ -11445,6 +11531,7 @@ function shape(ui, current, options) {
|
|
|
11445
11531
|
matrix: matrix,
|
|
11446
11532
|
fitMatrix: fitMatrix,
|
|
11447
11533
|
bounds: bounds,
|
|
11534
|
+
renderBounds: renderBounds,
|
|
11448
11535
|
worldCanvas: worldCanvas,
|
|
11449
11536
|
shapeBounds: shapeBounds,
|
|
11450
11537
|
scaleX: scaleX,
|
|
@@ -11548,7 +11635,7 @@ const PaintModule = {
|
|
|
11548
11635
|
shape: shape
|
|
11549
11636
|
};
|
|
11550
11637
|
|
|
11551
|
-
let origin$1 = {}, tempMatrix = getMatrixData();
|
|
11638
|
+
let origin$1 = {}, tempMatrix$1 = getMatrixData();
|
|
11552
11639
|
|
|
11553
11640
|
const {get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate$2, skew: skewHelper} = MatrixHelper;
|
|
11554
11641
|
|
|
@@ -11563,12 +11650,12 @@ function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
|
11563
11650
|
data.transform = transform;
|
|
11564
11651
|
}
|
|
11565
11652
|
|
|
11566
|
-
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew,
|
|
11653
|
+
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY) {
|
|
11567
11654
|
const transform = get$3();
|
|
11568
11655
|
layout$3(transform, box, x, y, scaleX, scaleY, rotation, skew);
|
|
11569
|
-
if (
|
|
11570
|
-
tempMatrix.a =
|
|
11571
|
-
multiplyParent(transform, tempMatrix);
|
|
11656
|
+
if (clipScaleX) {
|
|
11657
|
+
tempMatrix$1.a = clipScaleX, tempMatrix$1.d = clipScaleY;
|
|
11658
|
+
multiplyParent(transform, tempMatrix$1);
|
|
11572
11659
|
}
|
|
11573
11660
|
data.transform = transform;
|
|
11574
11661
|
}
|
|
@@ -11669,7 +11756,12 @@ function getPatternData(paint, box, image) {
|
|
|
11669
11756
|
|
|
11670
11757
|
case "normal":
|
|
11671
11758
|
case "clip":
|
|
11672
|
-
if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew)
|
|
11759
|
+
if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew) {
|
|
11760
|
+
let clipScaleX, clipScaleY;
|
|
11761
|
+
if (clipSize) clipScaleX = box.width / clipSize.width, clipScaleY = box.height / clipSize.height;
|
|
11762
|
+
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY);
|
|
11763
|
+
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX : scaleX, scaleY = scaleY ? scaleY * clipScaleY : clipScaleY;
|
|
11764
|
+
}
|
|
11673
11765
|
break;
|
|
11674
11766
|
|
|
11675
11767
|
case "repeat":
|
|
@@ -11827,7 +11919,7 @@ function ignoreRender(ui, value) {
|
|
|
11827
11919
|
|
|
11828
11920
|
const {get: get$1, scale: scale$2, copy: copy$4} = MatrixHelper;
|
|
11829
11921
|
|
|
11830
|
-
const {floor: floor$1, ceil: ceil$1, max: max$
|
|
11922
|
+
const {floor: floor$1, ceil: ceil$1, max: max$2, abs: abs$4} = Math;
|
|
11831
11923
|
|
|
11832
11924
|
function createPattern(ui, paint, pixelRatio) {
|
|
11833
11925
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
@@ -11876,8 +11968,8 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
11876
11968
|
if (transform || scaleX !== 1 || scaleY !== 1) {
|
|
11877
11969
|
const canvasWidth = width + (xGap || 0);
|
|
11878
11970
|
const canvasHeight = height + (yGap || 0);
|
|
11879
|
-
scaleX /= canvasWidth / max$
|
|
11880
|
-
scaleY /= canvasHeight / max$
|
|
11971
|
+
scaleX /= canvasWidth / max$2(floor$1(canvasWidth), 1);
|
|
11972
|
+
scaleY /= canvasHeight / max$2(floor$1(canvasHeight), 1);
|
|
11881
11973
|
if (!imageMatrix) {
|
|
11882
11974
|
imageMatrix = get$1();
|
|
11883
11975
|
if (transform) copy$4(imageMatrix, transform);
|
|
@@ -11903,17 +11995,15 @@ function checkImage(ui, canvas, paint, allowDraw) {
|
|
|
11903
11995
|
if (allowDraw) {
|
|
11904
11996
|
if (data.repeat) {
|
|
11905
11997
|
allowDraw = false;
|
|
11906
|
-
} else {
|
|
11907
|
-
|
|
11908
|
-
|
|
11909
|
-
|
|
11910
|
-
|
|
11911
|
-
|
|
11912
|
-
|
|
11913
|
-
height *= data.scaleY;
|
|
11914
|
-
}
|
|
11915
|
-
allowDraw = width * height > Platform.image.maxCacheSize;
|
|
11998
|
+
} else if (!(paint.changeful || Platform.name === "miniapp" && ResizeEvent.isResizing(ui) || Export.running)) {
|
|
11999
|
+
let {width: width, height: height} = data;
|
|
12000
|
+
width *= scaleX * pixelRatio;
|
|
12001
|
+
height *= scaleY * pixelRatio;
|
|
12002
|
+
if (data.scaleX) {
|
|
12003
|
+
width *= data.scaleX;
|
|
12004
|
+
height *= data.scaleY;
|
|
11916
12005
|
}
|
|
12006
|
+
allowDraw = width * height > Platform.image.maxCacheSize;
|
|
11917
12007
|
}
|
|
11918
12008
|
}
|
|
11919
12009
|
if (allowDraw) {
|
|
@@ -12093,20 +12183,20 @@ const PaintGradientModule = {
|
|
|
12093
12183
|
getTransform: getTransform
|
|
12094
12184
|
};
|
|
12095
12185
|
|
|
12096
|
-
const {copy: copy$3, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper;
|
|
12186
|
+
const {copy: copy$3, move: move$6, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max$1} = Math;
|
|
12097
12187
|
|
|
12098
|
-
const tempBounds = {};
|
|
12188
|
+
const tempBounds = {}, tempMatrix = new Matrix;
|
|
12099
12189
|
|
|
12100
12190
|
const offsetOutBounds$1 = {};
|
|
12101
12191
|
|
|
12102
12192
|
function shadow$1(ui, current, shape) {
|
|
12103
|
-
let copyBounds,
|
|
12104
|
-
const {__nowWorld: nowWorld
|
|
12193
|
+
let copyBounds, transform;
|
|
12194
|
+
const {__nowWorld: nowWorld} = ui;
|
|
12105
12195
|
const {shadow: shadow} = ui.__;
|
|
12106
|
-
const {worldCanvas: worldCanvas, bounds: bounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
12196
|
+
const {worldCanvas: worldCanvas, bounds: bounds, renderBounds: renderBounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
12107
12197
|
const other = current.getSameCanvas();
|
|
12108
12198
|
const end = shadow.length - 1;
|
|
12109
|
-
toOffsetOutBounds$1(bounds, offsetOutBounds$1);
|
|
12199
|
+
toOffsetOutBounds$1(bounds, offsetOutBounds$1, renderBounds);
|
|
12110
12200
|
shadow.forEach((item, index) => {
|
|
12111
12201
|
let otherScale = 1;
|
|
12112
12202
|
if (item.scaleFixed) {
|
|
@@ -12114,54 +12204,61 @@ function shadow$1(ui, current, shape) {
|
|
|
12114
12204
|
if (sx > 1) otherScale = 1 / sx;
|
|
12115
12205
|
}
|
|
12116
12206
|
other.setWorldShadow(offsetOutBounds$1.offsetX + item.x * scaleX * otherScale, offsetOutBounds$1.offsetY + item.y * scaleY * otherScale, item.blur * scaleX * otherScale, ColorConvert.string(item.color));
|
|
12117
|
-
|
|
12118
|
-
|
|
12119
|
-
|
|
12207
|
+
transform = getShadowTransform(ui, other, shape, item, offsetOutBounds$1, otherScale);
|
|
12208
|
+
if (transform) other.setTransform(transform);
|
|
12209
|
+
drawWorldShadow(other, offsetOutBounds$1, shape);
|
|
12210
|
+
if (transform) other.resetTransform();
|
|
12211
|
+
copyBounds = renderBounds;
|
|
12120
12212
|
if (item.box) {
|
|
12121
12213
|
other.restore();
|
|
12122
12214
|
other.save();
|
|
12123
12215
|
if (worldCanvas) {
|
|
12124
|
-
other.copyWorld(other,
|
|
12216
|
+
other.copyWorld(other, renderBounds, nowWorld, "copy");
|
|
12125
12217
|
copyBounds = nowWorld;
|
|
12126
12218
|
}
|
|
12127
12219
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, "destination-out") : other.copyWorld(shape.canvas, shapeBounds, bounds, "destination-out");
|
|
12128
12220
|
}
|
|
12129
|
-
|
|
12221
|
+
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
12130
12222
|
if (end && index < end) other.clearWorld(copyBounds);
|
|
12131
12223
|
});
|
|
12132
12224
|
other.recycle(copyBounds);
|
|
12133
12225
|
}
|
|
12134
12226
|
|
|
12135
|
-
function
|
|
12136
|
-
let
|
|
12137
|
-
shadow.forEach(item =>
|
|
12138
|
-
|
|
12227
|
+
function getShadowRenderSpread(_ui, shadow) {
|
|
12228
|
+
let top = 0, right = 0, bottom = 0, left = 0, x, y, spread, blur;
|
|
12229
|
+
shadow.forEach(item => {
|
|
12230
|
+
x = item.x || 0, y = item.y || 0, spread = item.spread || 0, blur = (item.blur || 0) * 1.5;
|
|
12231
|
+
top = max$1(top, spread + blur - y);
|
|
12232
|
+
right = max$1(right, spread + blur + x);
|
|
12233
|
+
bottom = max$1(bottom, spread + blur + y);
|
|
12234
|
+
left = max$1(left, spread + blur - x);
|
|
12235
|
+
});
|
|
12236
|
+
return top === right && right === bottom && bottom === left ? top : [ top, right, bottom, left ];
|
|
12237
|
+
}
|
|
12238
|
+
|
|
12239
|
+
function getShadowTransform(ui, canvas, _shape, shadow, outBounds, otherScale, isInnerShaodw) {
|
|
12240
|
+
if (shadow.spread) {
|
|
12241
|
+
const spreadScale = 1 + shadow.spread * 2 / ui.__layout.strokeBounds.width * otherScale * (isInnerShaodw ? -1 : 1);
|
|
12242
|
+
tempMatrix.set().scaleOfOuter({
|
|
12243
|
+
x: (outBounds.x + outBounds.width / 2) * canvas.pixelRatio,
|
|
12244
|
+
y: (outBounds.y + outBounds.height / 2) * canvas.pixelRatio
|
|
12245
|
+
}, spreadScale);
|
|
12246
|
+
return tempMatrix;
|
|
12247
|
+
}
|
|
12248
|
+
return undefined;
|
|
12139
12249
|
}
|
|
12140
12250
|
|
|
12141
|
-
function drawWorldShadow(canvas, outBounds,
|
|
12142
|
-
const {
|
|
12251
|
+
function drawWorldShadow(canvas, outBounds, shape) {
|
|
12252
|
+
const {shapeBounds: shapeBounds} = shape;
|
|
12253
|
+
let from, to;
|
|
12143
12254
|
if (Platform.fullImageShadow) {
|
|
12144
12255
|
copy$3(tempBounds, canvas.bounds);
|
|
12145
|
-
tempBounds.x
|
|
12146
|
-
|
|
12147
|
-
if (spreadScale) {
|
|
12148
|
-
const {fitMatrix: fitMatrix} = shape;
|
|
12149
|
-
tempBounds.x -= (bounds.x + (fitMatrix ? fitMatrix.e : 0) + bounds.width / 2) * (spreadScale - 1);
|
|
12150
|
-
tempBounds.y -= (bounds.y + (fitMatrix ? fitMatrix.f : 0) + bounds.height / 2) * (spreadScale - 1);
|
|
12151
|
-
tempBounds.width *= spreadScale;
|
|
12152
|
-
tempBounds.height *= spreadScale;
|
|
12153
|
-
}
|
|
12154
|
-
canvas.copyWorld(shape.canvas, canvas.bounds, tempBounds);
|
|
12256
|
+
move$6(tempBounds, outBounds.x - shapeBounds.x, outBounds.y - shapeBounds.y);
|
|
12257
|
+
from = canvas.bounds, to = tempBounds;
|
|
12155
12258
|
} else {
|
|
12156
|
-
|
|
12157
|
-
copy$3(tempBounds, outBounds);
|
|
12158
|
-
tempBounds.x -= outBounds.width / 2 * (spreadScale - 1);
|
|
12159
|
-
tempBounds.y -= outBounds.height / 2 * (spreadScale - 1);
|
|
12160
|
-
tempBounds.width *= spreadScale;
|
|
12161
|
-
tempBounds.height *= spreadScale;
|
|
12162
|
-
}
|
|
12163
|
-
canvas.copyWorld(shape.canvas, shapeBounds, spreadScale ? tempBounds : outBounds);
|
|
12259
|
+
from = shapeBounds, to = outBounds;
|
|
12164
12260
|
}
|
|
12261
|
+
canvas.copyWorld(shape.canvas, from, to);
|
|
12165
12262
|
}
|
|
12166
12263
|
|
|
12167
12264
|
const {toOffsetOutBounds: toOffsetOutBounds} = BoundsHelper;
|
|
@@ -12169,13 +12266,13 @@ const {toOffsetOutBounds: toOffsetOutBounds} = BoundsHelper;
|
|
|
12169
12266
|
const offsetOutBounds = {};
|
|
12170
12267
|
|
|
12171
12268
|
function innerShadow(ui, current, shape) {
|
|
12172
|
-
let copyBounds,
|
|
12173
|
-
const {__nowWorld: nowWorld
|
|
12269
|
+
let copyBounds, transform;
|
|
12270
|
+
const {__nowWorld: nowWorld} = ui;
|
|
12174
12271
|
const {innerShadow: innerShadow} = ui.__;
|
|
12175
|
-
const {worldCanvas: worldCanvas, bounds: bounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
12272
|
+
const {worldCanvas: worldCanvas, bounds: bounds, renderBounds: renderBounds, shapeBounds: shapeBounds, scaleX: scaleX, scaleY: scaleY} = shape;
|
|
12176
12273
|
const other = current.getSameCanvas();
|
|
12177
12274
|
const end = innerShadow.length - 1;
|
|
12178
|
-
toOffsetOutBounds(bounds, offsetOutBounds);
|
|
12275
|
+
toOffsetOutBounds(bounds, offsetOutBounds, renderBounds);
|
|
12179
12276
|
innerShadow.forEach((item, index) => {
|
|
12180
12277
|
let otherScale = 1;
|
|
12181
12278
|
if (item.scaleFixed) {
|
|
@@ -12184,16 +12281,17 @@ function innerShadow(ui, current, shape) {
|
|
|
12184
12281
|
}
|
|
12185
12282
|
other.save();
|
|
12186
12283
|
other.setWorldShadow(offsetOutBounds.offsetX + item.x * scaleX * otherScale, offsetOutBounds.offsetY + item.y * scaleY * otherScale, item.blur * scaleX * otherScale);
|
|
12187
|
-
|
|
12188
|
-
|
|
12284
|
+
transform = getShadowTransform(ui, other, shape, item, offsetOutBounds, otherScale, true);
|
|
12285
|
+
if (transform) other.setTransform(transform);
|
|
12286
|
+
drawWorldShadow(other, offsetOutBounds, shape);
|
|
12189
12287
|
other.restore();
|
|
12190
12288
|
if (worldCanvas) {
|
|
12191
|
-
other.copyWorld(other,
|
|
12289
|
+
other.copyWorld(other, renderBounds, nowWorld, "copy");
|
|
12192
12290
|
other.copyWorld(worldCanvas, nowWorld, nowWorld, "source-out");
|
|
12193
12291
|
copyBounds = nowWorld;
|
|
12194
12292
|
} else {
|
|
12195
12293
|
other.copyWorld(shape.canvas, shapeBounds, bounds, "source-out");
|
|
12196
|
-
copyBounds =
|
|
12294
|
+
copyBounds = renderBounds;
|
|
12197
12295
|
}
|
|
12198
12296
|
other.fillWorld(copyBounds, ColorConvert.string(item.color), "source-in");
|
|
12199
12297
|
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
@@ -12202,6 +12300,8 @@ function innerShadow(ui, current, shape) {
|
|
|
12202
12300
|
other.recycle(copyBounds);
|
|
12203
12301
|
}
|
|
12204
12302
|
|
|
12303
|
+
const getInnerShadowSpread = getShadowRenderSpread;
|
|
12304
|
+
|
|
12205
12305
|
function blur(ui, current, origin) {
|
|
12206
12306
|
const {blur: blur} = ui.__;
|
|
12207
12307
|
origin.setWorldBlur(blur * ui.__nowWorld.a);
|
|
@@ -12216,10 +12316,12 @@ const EffectModule = {
|
|
|
12216
12316
|
innerShadow: innerShadow,
|
|
12217
12317
|
blur: blur,
|
|
12218
12318
|
backgroundBlur: backgroundBlur,
|
|
12219
|
-
|
|
12319
|
+
getShadowRenderSpread: getShadowRenderSpread,
|
|
12320
|
+
getShadowTransform: getShadowTransform,
|
|
12220
12321
|
isTransformShadow(_shadow) {
|
|
12221
12322
|
return undefined;
|
|
12222
|
-
}
|
|
12323
|
+
},
|
|
12324
|
+
getInnerShadowSpread: getInnerShadowSpread
|
|
12223
12325
|
};
|
|
12224
12326
|
|
|
12225
12327
|
const {excludeRenderBounds: excludeRenderBounds} = LeafBoundsHelper;
|
|
@@ -12236,6 +12338,7 @@ Group.prototype.__renderMask = function(canvas, options) {
|
|
|
12236
12338
|
maskEnd(this, currentMask, canvas, contentCanvas, maskCanvas, maskOpacity, undefined, true);
|
|
12237
12339
|
maskCanvas = contentCanvas = null;
|
|
12238
12340
|
}
|
|
12341
|
+
if (mask === "clipping" || mask === "clipping-path") excludeRenderBounds(child, options) || child.__render(canvas, options);
|
|
12239
12342
|
maskOpacity = child.__.opacity;
|
|
12240
12343
|
usedGrayscaleAlpha = false;
|
|
12241
12344
|
if (mask === "path" || mask === "clipping-path") {
|
|
@@ -12253,7 +12356,6 @@ Group.prototype.__renderMask = function(canvas, options) {
|
|
|
12253
12356
|
if (!contentCanvas) contentCanvas = getCanvas(canvas);
|
|
12254
12357
|
child.__render(maskCanvas, options);
|
|
12255
12358
|
}
|
|
12256
|
-
if (mask === "clipping" || mask === "clipping-path") excludeRenderBounds(child, options) || child.__render(canvas, options);
|
|
12257
12359
|
continue;
|
|
12258
12360
|
}
|
|
12259
12361
|
const childBlendMode = maskOpacity === 1 && child.__.__blendMode;
|
|
@@ -12892,22 +12994,25 @@ function targetAttr(fn) {
|
|
|
12892
12994
|
set(value) {
|
|
12893
12995
|
const old = this[privateKey];
|
|
12894
12996
|
if (old !== value) {
|
|
12895
|
-
|
|
12997
|
+
const t = this;
|
|
12998
|
+
if (t.config) {
|
|
12896
12999
|
const isSelect = key === "target";
|
|
12897
13000
|
if (isSelect) {
|
|
12898
|
-
|
|
12899
|
-
if (this.single) this.element.syncEventer = null;
|
|
12900
|
-
const {beforeSelect: beforeSelect} = this.config;
|
|
13001
|
+
const {beforeSelect: beforeSelect} = t.config;
|
|
12901
13002
|
if (beforeSelect) {
|
|
12902
13003
|
const check = beforeSelect({
|
|
12903
13004
|
target: value
|
|
12904
13005
|
});
|
|
12905
13006
|
if (isObject(check)) value = check; else if (check === false) return;
|
|
12906
13007
|
}
|
|
13008
|
+
t.setDimOthers(false);
|
|
13009
|
+
t.setBright(false);
|
|
13010
|
+
if (isArray(value) && value.length > 1 && value[0].locked) value.splice(0, 1);
|
|
13011
|
+
if (t.single) t.element.syncEventer = null;
|
|
12907
13012
|
}
|
|
12908
13013
|
const type = isSelect ? EditorEvent.BEFORE_SELECT : EditorEvent.BEFORE_HOVER;
|
|
12909
13014
|
if (this.hasEvent(type)) this.emitEvent(new EditorEvent(type, {
|
|
12910
|
-
editor:
|
|
13015
|
+
editor: t,
|
|
12911
13016
|
value: value,
|
|
12912
13017
|
oldValue: old
|
|
12913
13018
|
}));
|
|
@@ -13089,11 +13194,12 @@ class EditSelect extends Group {
|
|
|
13089
13194
|
return !!this.originList;
|
|
13090
13195
|
}
|
|
13091
13196
|
get running() {
|
|
13092
|
-
const {editor: editor} = this;
|
|
13093
|
-
return this.hittable && editor.visible && editor.hittable && editor.mergeConfig.selector &&
|
|
13197
|
+
const {editor: editor, app: app} = this;
|
|
13198
|
+
return this.hittable && editor.visible && editor.hittable && editor.mergeConfig.selector && (app && app.mode === "normal");
|
|
13094
13199
|
}
|
|
13095
13200
|
get isMoveMode() {
|
|
13096
|
-
|
|
13201
|
+
const {app: app} = this;
|
|
13202
|
+
return app && app.interaction.moveMode;
|
|
13097
13203
|
}
|
|
13098
13204
|
constructor(editor) {
|
|
13099
13205
|
super();
|
|
@@ -13156,12 +13262,12 @@ class EditSelect extends Group {
|
|
|
13156
13262
|
onTap(e) {
|
|
13157
13263
|
if (e.multiTouch) return;
|
|
13158
13264
|
const {editor: editor} = this;
|
|
13159
|
-
const {select: select} = editor.mergeConfig;
|
|
13265
|
+
const {select: select, selectKeep: selectKeep} = editor.mergeConfig;
|
|
13160
13266
|
if (select === "tap") this.checkAndSelect(e); else if (this.waitSelect) this.waitSelect();
|
|
13161
13267
|
if (this.needRemoveItem) {
|
|
13162
13268
|
editor.removeItem(this.needRemoveItem);
|
|
13163
13269
|
} else if (this.isMoveMode) {
|
|
13164
|
-
editor.target = null;
|
|
13270
|
+
if (!selectKeep) editor.target = null;
|
|
13165
13271
|
}
|
|
13166
13272
|
}
|
|
13167
13273
|
checkAndSelect(e) {
|
|
@@ -13176,7 +13282,7 @@ class EditSelect extends Group {
|
|
|
13176
13282
|
editor.target = find;
|
|
13177
13283
|
}
|
|
13178
13284
|
} else if (this.allow(e.target)) {
|
|
13179
|
-
if (!this.isHoldMultipleSelectKey(e)) editor.target = null;
|
|
13285
|
+
if (!this.isHoldMultipleSelectKey(e) && !this.editor.mergedConfig.selectKeep) editor.target = null;
|
|
13180
13286
|
}
|
|
13181
13287
|
}
|
|
13182
13288
|
}
|
|
@@ -13295,91 +13401,95 @@ const {toPoint: toPoint} = AroundHelper;
|
|
|
13295
13401
|
const {within: within$3, sign: sign$1} = MathHelper;
|
|
13296
13402
|
|
|
13297
13403
|
const EditDataHelper = {
|
|
13298
|
-
getScaleData(target, startBounds, direction,
|
|
13404
|
+
getScaleData(target, startBounds, direction, totalMoveOrScale, lockRatio, around, flipable, scaleMode) {
|
|
13299
13405
|
let align, origin = {}, scaleX = 1, scaleY = 1;
|
|
13300
13406
|
const {boxBounds: boxBounds, widthRange: widthRange, heightRange: heightRange, dragBounds: dragBounds, worldBoxBounds: worldBoxBounds} = target;
|
|
13301
13407
|
const {width: width, height: height} = startBounds;
|
|
13302
|
-
if (around) {
|
|
13303
|
-
totalMove.x *= 2;
|
|
13304
|
-
totalMove.y *= 2;
|
|
13305
|
-
}
|
|
13306
13408
|
const originChangedScaleX = target.scaleX / startBounds.scaleX;
|
|
13307
13409
|
const originChangedScaleY = target.scaleY / startBounds.scaleY;
|
|
13308
13410
|
const signX = sign$1(originChangedScaleX);
|
|
13309
13411
|
const signY = sign$1(originChangedScaleY);
|
|
13310
13412
|
const changedScaleX = scaleMode ? originChangedScaleX : signX * boxBounds.width / width;
|
|
13311
13413
|
const changedScaleY = scaleMode ? originChangedScaleY : signY * boxBounds.height / height;
|
|
13312
|
-
|
|
13313
|
-
|
|
13314
|
-
|
|
13315
|
-
|
|
13316
|
-
|
|
13317
|
-
|
|
13318
|
-
|
|
13319
|
-
|
|
13320
|
-
|
|
13321
|
-
|
|
13322
|
-
|
|
13414
|
+
if (isNumber(totalMoveOrScale)) {
|
|
13415
|
+
scaleX = scaleY = Math.sqrt(totalMoveOrScale);
|
|
13416
|
+
} else {
|
|
13417
|
+
if (around) {
|
|
13418
|
+
totalMoveOrScale.x *= 2;
|
|
13419
|
+
totalMoveOrScale.y *= 2;
|
|
13420
|
+
}
|
|
13421
|
+
totalMoveOrScale.x *= scaleMode ? originChangedScaleX : signX;
|
|
13422
|
+
totalMoveOrScale.y *= scaleMode ? originChangedScaleY : signY;
|
|
13423
|
+
const topScale = (-totalMoveOrScale.y + height) / height;
|
|
13424
|
+
const rightScale = (totalMoveOrScale.x + width) / width;
|
|
13425
|
+
const bottomScale = (totalMoveOrScale.y + height) / height;
|
|
13426
|
+
const leftScale = (-totalMoveOrScale.x + width) / width;
|
|
13427
|
+
switch (direction) {
|
|
13428
|
+
case top$1:
|
|
13429
|
+
scaleY = topScale;
|
|
13430
|
+
align = "bottom";
|
|
13431
|
+
break;
|
|
13323
13432
|
|
|
13324
|
-
|
|
13325
|
-
|
|
13326
|
-
|
|
13327
|
-
|
|
13433
|
+
case right$2:
|
|
13434
|
+
scaleX = rightScale;
|
|
13435
|
+
align = "left";
|
|
13436
|
+
break;
|
|
13328
13437
|
|
|
13329
|
-
|
|
13330
|
-
|
|
13331
|
-
|
|
13332
|
-
|
|
13438
|
+
case bottom$1:
|
|
13439
|
+
scaleY = bottomScale;
|
|
13440
|
+
align = "top";
|
|
13441
|
+
break;
|
|
13333
13442
|
|
|
13334
|
-
|
|
13335
|
-
|
|
13336
|
-
|
|
13337
|
-
|
|
13443
|
+
case left$2:
|
|
13444
|
+
scaleX = leftScale;
|
|
13445
|
+
align = "right";
|
|
13446
|
+
break;
|
|
13338
13447
|
|
|
13339
|
-
|
|
13340
|
-
|
|
13341
|
-
|
|
13342
|
-
|
|
13343
|
-
|
|
13448
|
+
case topLeft$1:
|
|
13449
|
+
scaleY = topScale;
|
|
13450
|
+
scaleX = leftScale;
|
|
13451
|
+
align = "bottom-right";
|
|
13452
|
+
break;
|
|
13344
13453
|
|
|
13345
|
-
|
|
13346
|
-
|
|
13347
|
-
|
|
13348
|
-
|
|
13349
|
-
|
|
13454
|
+
case topRight$1:
|
|
13455
|
+
scaleY = topScale;
|
|
13456
|
+
scaleX = rightScale;
|
|
13457
|
+
align = "bottom-left";
|
|
13458
|
+
break;
|
|
13350
13459
|
|
|
13351
|
-
|
|
13352
|
-
|
|
13353
|
-
|
|
13354
|
-
|
|
13355
|
-
|
|
13460
|
+
case bottomRight:
|
|
13461
|
+
scaleY = bottomScale;
|
|
13462
|
+
scaleX = rightScale;
|
|
13463
|
+
align = "top-left";
|
|
13464
|
+
break;
|
|
13356
13465
|
|
|
13357
|
-
|
|
13358
|
-
|
|
13359
|
-
|
|
13360
|
-
|
|
13361
|
-
|
|
13362
|
-
|
|
13363
|
-
|
|
13364
|
-
|
|
13365
|
-
|
|
13366
|
-
|
|
13367
|
-
|
|
13368
|
-
|
|
13369
|
-
|
|
13370
|
-
|
|
13371
|
-
|
|
13466
|
+
case bottomLeft:
|
|
13467
|
+
scaleY = bottomScale;
|
|
13468
|
+
scaleX = leftScale;
|
|
13469
|
+
align = "top-right";
|
|
13470
|
+
}
|
|
13471
|
+
if (lockRatio) {
|
|
13472
|
+
if (lockRatio === "corner" && direction % 2) {
|
|
13473
|
+
lockRatio = false;
|
|
13474
|
+
} else {
|
|
13475
|
+
let scale;
|
|
13476
|
+
switch (direction) {
|
|
13477
|
+
case top$1:
|
|
13478
|
+
case bottom$1:
|
|
13479
|
+
scale = scaleY;
|
|
13480
|
+
break;
|
|
13372
13481
|
|
|
13373
|
-
|
|
13374
|
-
|
|
13375
|
-
|
|
13376
|
-
|
|
13482
|
+
case left$2:
|
|
13483
|
+
case right$2:
|
|
13484
|
+
scale = scaleX;
|
|
13485
|
+
break;
|
|
13377
13486
|
|
|
13378
|
-
|
|
13379
|
-
|
|
13487
|
+
default:
|
|
13488
|
+
scale = Math.sqrt(Math.abs(scaleX * scaleY));
|
|
13489
|
+
}
|
|
13490
|
+
scaleX = scaleX < 0 ? -scale : scale;
|
|
13491
|
+
scaleY = scaleY < 0 ? -scale : scale;
|
|
13380
13492
|
}
|
|
13381
|
-
scaleX = scaleX < 0 ? -scale : scale;
|
|
13382
|
-
scaleY = scaleY < 0 ? -scale : scale;
|
|
13383
13493
|
}
|
|
13384
13494
|
}
|
|
13385
13495
|
const useScaleX = scaleX !== 1, useScaleY = scaleY !== 1;
|
|
@@ -13578,13 +13688,18 @@ const cacheCursors = {};
|
|
|
13578
13688
|
function updatePointCursor(editBox, e) {
|
|
13579
13689
|
const {enterPoint: point, dragging: dragging, skewing: skewing, resizing: resizing, flippedX: flippedX, flippedY: flippedY} = editBox;
|
|
13580
13690
|
if (!point || !editBox.editor.editing || !editBox.canUse) return;
|
|
13691
|
+
if (point.name === "rect") return updateMoveCursor(editBox);
|
|
13581
13692
|
if (point.name === "circle") return;
|
|
13582
|
-
|
|
13693
|
+
let {rotation: rotation} = editBox;
|
|
13694
|
+
const {pointType: pointType} = point, {moveCursor: moveCursor, resizeCursor: resizeCursor, rotateCursor: rotateCursor, skewCursor: skewCursor, moveable: moveable, resizeable: resizeable, rotateable: rotateable, skewable: skewable} = editBox.mergeConfig;
|
|
13695
|
+
if (pointType === "move") {
|
|
13696
|
+
point.cursor = moveCursor;
|
|
13697
|
+
if (!moveable) point.visible = false;
|
|
13698
|
+
return;
|
|
13699
|
+
} else if (pointType === "button") {
|
|
13583
13700
|
if (!point.cursor) point.cursor = "pointer";
|
|
13584
13701
|
return;
|
|
13585
13702
|
}
|
|
13586
|
-
let {rotation: rotation} = editBox;
|
|
13587
|
-
const {pointType: pointType} = point, {resizeCursor: resizeCursor, rotateCursor: rotateCursor, skewCursor: skewCursor, resizeable: resizeable, rotateable: rotateable, skewable: skewable} = editBox.mergeConfig;
|
|
13588
13703
|
let showResize = pointType.includes("resize");
|
|
13589
13704
|
if (showResize && rotateable && (editBox.isHoldRotateKey(e) || !resizeable)) showResize = false;
|
|
13590
13705
|
const showSkew = skewable && !showResize && (point.name === "resize-line" || pointType === "skew");
|
|
@@ -13662,10 +13777,13 @@ class EditBox extends Group {
|
|
|
13662
13777
|
const {moveable: moveable, resizeable: resizeable, rotateable: rotateable} = this.mergeConfig;
|
|
13663
13778
|
return isString(moveable) || isString(resizeable) || isString(rotateable);
|
|
13664
13779
|
}
|
|
13780
|
+
get canDragLimitAnimate() {
|
|
13781
|
+
return this.moving && this.mergeConfig.dragLimitAnimate && this.target.dragBounds;
|
|
13782
|
+
}
|
|
13665
13783
|
constructor(editor) {
|
|
13666
13784
|
super();
|
|
13667
13785
|
this.view = new Group;
|
|
13668
|
-
this.rect = new
|
|
13786
|
+
this.rect = new EditPoint({
|
|
13669
13787
|
name: "rect",
|
|
13670
13788
|
hitFill: "all",
|
|
13671
13789
|
hitStroke: "none",
|
|
@@ -13727,12 +13845,13 @@ class EditBox extends Group {
|
|
|
13727
13845
|
this.listenPointEvents(resizePoint, "resize", i);
|
|
13728
13846
|
}
|
|
13729
13847
|
this.listenPointEvents(circle, "rotate", 2);
|
|
13848
|
+
this.listenPointEvents(rect, "move", 8);
|
|
13730
13849
|
view.addMany(...rotatePoints, rect, circle, buttons, ...resizeLines, ...resizePoints);
|
|
13731
13850
|
this.add(view);
|
|
13732
13851
|
}
|
|
13733
13852
|
load() {
|
|
13734
|
-
const {target: target, mergeConfig: mergeConfig, single: single, rect: rect, circle: circle, resizePoints: resizePoints} = this;
|
|
13735
|
-
const {stroke: stroke, strokeWidth: strokeWidth} = mergeConfig;
|
|
13853
|
+
const {target: target, mergeConfig: mergeConfig, single: single, rect: rect, circle: circle, resizePoints: resizePoints, resizeLines: resizeLines} = this;
|
|
13854
|
+
const {stroke: stroke, strokeWidth: strokeWidth, resizeLine: resizeLine} = mergeConfig;
|
|
13736
13855
|
const pointsStyle = this.getPointsStyle();
|
|
13737
13856
|
const middlePointsStyle = this.getMiddlePointsStyle();
|
|
13738
13857
|
this.visible = !target.locked;
|
|
@@ -13741,6 +13860,10 @@ class EditBox extends Group {
|
|
|
13741
13860
|
resizeP = resizePoints[i];
|
|
13742
13861
|
resizeP.set(this.getPointStyle(i % 2 ? middlePointsStyle[(i - 1) / 2 % middlePointsStyle.length] : pointsStyle[i / 2 % pointsStyle.length]));
|
|
13743
13862
|
resizeP.rotation = (i - (i % 2 ? 1 : 0)) / 2 * 90;
|
|
13863
|
+
if (i % 2) resizeLines[(i - 1) / 2].set(Object.assign({
|
|
13864
|
+
pointType: "resize",
|
|
13865
|
+
rotation: (i - 1) / 2 * 90
|
|
13866
|
+
}, resizeLine || {}));
|
|
13744
13867
|
}
|
|
13745
13868
|
circle.set(this.getPointStyle(mergeConfig.circle || mergeConfig.rotatePoint || pointsStyle[0]));
|
|
13746
13869
|
rect.set(Object.assign({
|
|
@@ -13785,10 +13908,12 @@ class EditBox extends Group {
|
|
|
13785
13908
|
if (this.app) this.rect.syncEventer = this.app.interaction.bottomList = null;
|
|
13786
13909
|
}
|
|
13787
13910
|
updateBounds(bounds) {
|
|
13788
|
-
const {
|
|
13789
|
-
const {
|
|
13790
|
-
const {middlePoint: middlePoint, resizeable: resizeable, rotateable: rotateable, hideOnSmall: hideOnSmall, editBox: editBox, mask: mask, spread: spread, hideRotatePoints: hideRotatePoints, hideResizeLines: hideResizeLines} = mergeConfig;
|
|
13911
|
+
const {editor: editor, mergeConfig: mergeConfig, single: single, rect: rect, circle: circle, buttons: buttons, resizePoints: resizePoints, rotatePoints: rotatePoints, resizeLines: resizeLines} = this;
|
|
13912
|
+
const {editMask: editMask} = editor;
|
|
13913
|
+
const {middlePoint: middlePoint, resizeable: resizeable, rotateable: rotateable, hideOnSmall: hideOnSmall, editBox: editBox, mask: mask, dimOthers: dimOthers, bright: bright, spread: spread, hideRotatePoints: hideRotatePoints, hideResizeLines: hideResizeLines} = mergeConfig;
|
|
13791
13914
|
editMask.visible = mask ? true : 0;
|
|
13915
|
+
editor.setDimOthers(dimOthers);
|
|
13916
|
+
editor.setBright(!!dimOthers || bright);
|
|
13792
13917
|
if (spread) BoundsHelper.spread(bounds, spread);
|
|
13793
13918
|
if (this.view.worldOpacity) {
|
|
13794
13919
|
const {width: width, height: height} = bounds;
|
|
@@ -13809,10 +13934,10 @@ class EditBox extends Group {
|
|
|
13809
13934
|
resizeL.visible = resizeP.visible && !hideResizeLines;
|
|
13810
13935
|
resizeP.visible = rotateP.visible = showPoints && !!middlePoint;
|
|
13811
13936
|
if ((i + 1) / 2 % 2) {
|
|
13812
|
-
resizeL.width = width;
|
|
13937
|
+
resizeL.width = width + resizeL.height;
|
|
13813
13938
|
if (hideOnSmall && resizeP.width * 2 > width) resizeP.visible = false;
|
|
13814
13939
|
} else {
|
|
13815
|
-
resizeL.
|
|
13940
|
+
resizeL.width = height + resizeL.height;
|
|
13816
13941
|
if (hideOnSmall && resizeP.width * 2 > height) resizeP.visible = false;
|
|
13817
13942
|
}
|
|
13818
13943
|
}
|
|
@@ -13888,10 +14013,9 @@ class EditBox extends Group {
|
|
|
13888
14013
|
onDragStart(e) {
|
|
13889
14014
|
this.dragging = true;
|
|
13890
14015
|
const point = this.dragPoint = e.current, {pointType: pointType} = point;
|
|
13891
|
-
const {
|
|
13892
|
-
if (
|
|
14016
|
+
const {moveable: moveable, resizeable: resizeable, rotateable: rotateable, skewable: skewable} = this.mergeConfig;
|
|
14017
|
+
if (pointType === "move") {
|
|
13893
14018
|
moveable && (this.moving = true);
|
|
13894
|
-
editor.opacity = hideOnMove ? 0 : 1;
|
|
13895
14019
|
} else {
|
|
13896
14020
|
if (pointType.includes("rotate") || this.isHoldRotateKey(e) || !resizeable) {
|
|
13897
14021
|
rotateable && (this.rotating = true);
|
|
@@ -13900,69 +14024,74 @@ class EditBox extends Group {
|
|
|
13900
14024
|
} else if (pointType === "resize") resizeable && (this.resizing = true);
|
|
13901
14025
|
if (pointType === "skew") skewable && (this.skewing = true);
|
|
13902
14026
|
}
|
|
13903
|
-
|
|
13904
|
-
dragStartData.y = e.y;
|
|
13905
|
-
dragStartData.point = {
|
|
13906
|
-
x: target.x,
|
|
13907
|
-
y: target.y
|
|
13908
|
-
};
|
|
13909
|
-
dragStartData.bounds = Object.assign({}, target.getLayoutBounds("box", "local"));
|
|
13910
|
-
dragStartData.rotation = target.rotation;
|
|
13911
|
-
if (pointType && pointType.includes("resize")) ResizeEvent.resizingKeys = editor.leafList.keys;
|
|
13912
|
-
}
|
|
13913
|
-
onDragEnd(e) {
|
|
13914
|
-
if (this.moving && this.mergeConfig.dragLimitAnimate && this.target.dragBounds) this.transformTool.onMove(e);
|
|
13915
|
-
this.dragPoint = null;
|
|
13916
|
-
this.resetDoing();
|
|
13917
|
-
const {name: name, pointType: pointType} = e.current;
|
|
13918
|
-
if (name === "rect") this.editor.opacity = 1;
|
|
13919
|
-
if (pointType && pointType.includes("resize")) ResizeEvent.resizingKeys = null;
|
|
14027
|
+
this.onTransformStart(e);
|
|
13920
14028
|
}
|
|
13921
14029
|
onDrag(e) {
|
|
13922
14030
|
const {transformTool: transformTool, moving: moving, resizing: resizing, rotating: rotating, skewing: skewing} = this;
|
|
13923
14031
|
if (moving) {
|
|
13924
14032
|
transformTool.onMove(e);
|
|
13925
|
-
updateMoveCursor(this);
|
|
13926
14033
|
} else if (resizing || rotating || skewing) {
|
|
13927
14034
|
const point = e.current;
|
|
13928
14035
|
if (point.pointType) this.enterPoint = point;
|
|
13929
14036
|
if (rotating) transformTool.onRotate(e);
|
|
13930
14037
|
if (resizing) transformTool.onScale(e);
|
|
13931
14038
|
if (skewing) transformTool.onSkew(e);
|
|
13932
|
-
updatePointCursor(this, e);
|
|
13933
14039
|
}
|
|
14040
|
+
updatePointCursor(this, e);
|
|
13934
14041
|
}
|
|
13935
|
-
|
|
13936
|
-
|
|
14042
|
+
onDragEnd(e) {
|
|
14043
|
+
this.onTransformEnd(e);
|
|
14044
|
+
this.dragPoint = null;
|
|
14045
|
+
}
|
|
14046
|
+
onTransformStart(e) {
|
|
14047
|
+
if (this.canUse) {
|
|
14048
|
+
if (this.moving) this.editor.opacity = this.mergedConfig.hideOnMove ? 0 : 1;
|
|
14049
|
+
if (this.resizing) ResizeEvent.resizingKeys = this.editor.leafList.keys;
|
|
14050
|
+
const {dragStartData: dragStartData, target: target} = this;
|
|
14051
|
+
dragStartData.x = e.x;
|
|
14052
|
+
dragStartData.y = e.y;
|
|
14053
|
+
dragStartData.totalOffset = getPointData();
|
|
14054
|
+
dragStartData.point = {
|
|
14055
|
+
x: target.x,
|
|
14056
|
+
y: target.y
|
|
14057
|
+
};
|
|
14058
|
+
dragStartData.bounds = Object.assign({}, target.getLayoutBounds("box", "local"));
|
|
14059
|
+
dragStartData.rotation = target.rotation;
|
|
14060
|
+
}
|
|
14061
|
+
}
|
|
14062
|
+
onTransformEnd(e) {
|
|
14063
|
+
if (this.canUse) {
|
|
14064
|
+
if (this.canDragLimitAnimate && (e instanceof DragEvent || e instanceof MoveEvent)) this.transformTool.onMove(e);
|
|
14065
|
+
if (this.resizing) ResizeEvent.resizingKeys = null;
|
|
14066
|
+
this.dragging = this.gesturing = this.moving = this.resizing = this.rotating = this.skewing = false;
|
|
14067
|
+
this.editor.opacity = 1;
|
|
14068
|
+
this.update();
|
|
14069
|
+
}
|
|
13937
14070
|
}
|
|
13938
14071
|
onMove(e) {
|
|
13939
14072
|
if (this.canGesture && e.moveType !== "drag") {
|
|
13940
14073
|
e.stop();
|
|
13941
|
-
if (isString(this.
|
|
14074
|
+
if (isString(this.mergedConfig.moveable)) {
|
|
13942
14075
|
this.gesturing = this.moving = true;
|
|
13943
|
-
this.transformTool.onMove(e);
|
|
14076
|
+
e.type === MoveEvent.START ? this.onTransformStart(e) : this.transformTool.onMove(e);
|
|
13944
14077
|
}
|
|
13945
14078
|
}
|
|
13946
14079
|
}
|
|
13947
|
-
onMoveEnd(e) {
|
|
13948
|
-
if (this.moving) this.transformTool.onMove(e);
|
|
13949
|
-
this.resetDoing();
|
|
13950
|
-
}
|
|
13951
14080
|
onScale(e) {
|
|
13952
14081
|
if (this.canGesture) {
|
|
13953
14082
|
e.stop();
|
|
13954
|
-
if (isString(this.
|
|
14083
|
+
if (isString(this.mergedConfig.resizeable)) {
|
|
13955
14084
|
this.gesturing = this.resizing = true;
|
|
13956
|
-
this.transformTool.onScale(e);
|
|
14085
|
+
e.type === ZoomEvent.START ? this.onTransformStart(e) : this.transformTool.onScale(e);
|
|
13957
14086
|
}
|
|
13958
14087
|
}
|
|
13959
14088
|
}
|
|
13960
14089
|
onRotate(e) {
|
|
13961
14090
|
if (this.canGesture) {
|
|
13962
14091
|
e.stop();
|
|
13963
|
-
if (isString(this.
|
|
14092
|
+
if (isString(this.mergedConfig.rotateable)) {
|
|
13964
14093
|
this.gesturing = this.rotating = true;
|
|
13965
|
-
this.transformTool.onRotate(e);
|
|
14094
|
+
e.type === RotateEvent.START ? this.onTransformStart(e) : this.transformTool.onRotate(e);
|
|
13966
14095
|
}
|
|
13967
14096
|
}
|
|
13968
14097
|
}
|
|
@@ -13975,8 +14104,7 @@ class EditBox extends Group {
|
|
|
13975
14104
|
updatePointCursor(this, e);
|
|
13976
14105
|
}
|
|
13977
14106
|
onArrow(e) {
|
|
13978
|
-
|
|
13979
|
-
if (this.canUse && editor.editing && this.mergeConfig.keyEvent) {
|
|
14107
|
+
if (this.canUse && this.mergeConfig.keyEvent) {
|
|
13980
14108
|
let x = 0, y = 0;
|
|
13981
14109
|
const distance = e.shiftKey ? 10 : 1;
|
|
13982
14110
|
switch (e.code) {
|
|
@@ -13995,7 +14123,7 @@ class EditBox extends Group {
|
|
|
13995
14123
|
case "ArrowRight":
|
|
13996
14124
|
x = distance;
|
|
13997
14125
|
}
|
|
13998
|
-
if (x || y) transformTool.move(x, y);
|
|
14126
|
+
if (x || y) this.transformTool.move(x, y);
|
|
13999
14127
|
}
|
|
14000
14128
|
}
|
|
14001
14129
|
onDoubleTap(e) {
|
|
@@ -14026,19 +14154,17 @@ class EditBox extends Group {
|
|
|
14026
14154
|
listenPointEvents(point, type, direction) {
|
|
14027
14155
|
point.direction = direction;
|
|
14028
14156
|
point.pointType = type;
|
|
14029
|
-
|
|
14030
|
-
this.enterPoint = null;
|
|
14031
|
-
} ] ];
|
|
14032
|
-
if (point.name !== "circle") events.push([ PointerEvent.ENTER, e => {
|
|
14157
|
+
this.__eventIds.push(point.on_([ [ DragEvent.START, this.onDragStart, this ], [ DragEvent.DRAG, this.onDrag, this ], [ DragEvent.END, this.onDragEnd, this ], [ PointerEvent.ENTER, e => {
|
|
14033
14158
|
this.enterPoint = point, updatePointCursor(this, e);
|
|
14034
|
-
} ])
|
|
14035
|
-
|
|
14159
|
+
} ], [ PointerEvent.LEAVE, () => {
|
|
14160
|
+
this.enterPoint = null;
|
|
14161
|
+
} ] ]));
|
|
14036
14162
|
}
|
|
14037
14163
|
__listenEvents() {
|
|
14038
14164
|
const {rect: rect, editor: editor, __eventIds: events} = this;
|
|
14039
|
-
events.push(rect.on_([ [
|
|
14165
|
+
events.push(rect.on_([ [ PointerEvent.DOUBLE_TAP, this.onDoubleTap, this ], [ PointerEvent.LONG_PRESS, this.onLongPress, this ] ]));
|
|
14040
14166
|
this.waitLeafer(() => {
|
|
14041
|
-
events.push(editor.app.on_([ [ [ KeyEvent.HOLD, KeyEvent.UP ], this.onKey, this ], [ KeyEvent.DOWN, this.onArrow, this ], [ MoveEvent.BEFORE_MOVE, this.onMove, this, true ], [ ZoomEvent.BEFORE_ZOOM, this.onScale, this, true ], [ RotateEvent.BEFORE_ROTATE, this.onRotate, this, true ], [ MoveEvent.END,
|
|
14167
|
+
events.push(editor.app.on_([ [ [ KeyEvent.HOLD, KeyEvent.UP ], this.onKey, this ], [ KeyEvent.DOWN, this.onArrow, this ], [ [ MoveEvent.START, MoveEvent.BEFORE_MOVE ], this.onMove, this, true ], [ [ ZoomEvent.START, ZoomEvent.BEFORE_ZOOM ], this.onScale, this, true ], [ [ RotateEvent.START, RotateEvent.BEFORE_ROTATE ], this.onRotate, this, true ], [ [ MoveEvent.END, ZoomEvent.END, RotateEvent.END ], this.onTransformEnd, this ] ]));
|
|
14042
14168
|
});
|
|
14043
14169
|
}
|
|
14044
14170
|
__removeListenEvents() {
|
|
@@ -14436,56 +14562,61 @@ class TransformTool {
|
|
|
14436
14562
|
const isMoveEnd = e.type === MoveEvent.END || e.type === DragEvent.END;
|
|
14437
14563
|
const axisDrag = isString(target.draggable);
|
|
14438
14564
|
const checkLimitMove = !dragLimitAnimate || isMoveEnd || axisDrag;
|
|
14565
|
+
const total = {
|
|
14566
|
+
x: e.totalX,
|
|
14567
|
+
y: e.totalY
|
|
14568
|
+
};
|
|
14439
14569
|
if (e instanceof MoveEvent) {
|
|
14440
|
-
move
|
|
14441
|
-
if (checkLimitMove) DragEvent.limitMove(target, move);
|
|
14442
|
-
} else {
|
|
14443
|
-
const total = {
|
|
14444
|
-
x: e.totalX,
|
|
14445
|
-
y: e.totalY
|
|
14446
|
-
};
|
|
14447
|
-
if (e.shiftKey) {
|
|
14448
|
-
if (Math.abs(total.x) > Math.abs(total.y)) total.y = 0; else total.x = 0;
|
|
14449
|
-
}
|
|
14450
|
-
move = DragEvent.getValidMove(target, dragStartData.point, total, checkLimitMove);
|
|
14570
|
+
PointHelper.move(total, target.getWorldPointByLocal(dragStartData.totalOffset, null, true));
|
|
14451
14571
|
}
|
|
14572
|
+
if (e.shiftKey) {
|
|
14573
|
+
if (Math.abs(total.x) > Math.abs(total.y)) total.y = 0; else total.x = 0;
|
|
14574
|
+
}
|
|
14575
|
+
move = DragEvent.getValidMove(target, dragStartData.point, total, checkLimitMove);
|
|
14452
14576
|
if (move.x || move.y) {
|
|
14453
14577
|
if (dragLimitAnimate && !axisDrag && isMoveEnd) LeafHelper.animateMove(this, move, isNumber(dragLimitAnimate) ? dragLimitAnimate : .3); else this.move(move);
|
|
14454
14578
|
}
|
|
14455
14579
|
}
|
|
14456
14580
|
onScale(e) {
|
|
14457
14581
|
const {target: target, mergeConfig: mergeConfig, single: single, dragStartData: dragStartData} = this.editBox;
|
|
14458
|
-
let {around: around, lockRatio: lockRatio, flipable: flipable, editSize: editSize} = mergeConfig;
|
|
14582
|
+
let {around: around, lockRatio: lockRatio, flipable: flipable, editSize: editSize} = mergeConfig, totalMove;
|
|
14459
14583
|
if (e instanceof ZoomEvent) {
|
|
14460
|
-
|
|
14584
|
+
around = target.getBoxPoint(e);
|
|
14585
|
+
totalMove = e.totalScale;
|
|
14461
14586
|
} else {
|
|
14462
|
-
|
|
14463
|
-
|
|
14464
|
-
|
|
14465
|
-
|
|
14466
|
-
|
|
14467
|
-
|
|
14468
|
-
|
|
14469
|
-
|
|
14470
|
-
|
|
14587
|
+
totalMove = e.getInnerTotal(target);
|
|
14588
|
+
}
|
|
14589
|
+
const {direction: direction} = e.current;
|
|
14590
|
+
if (e.shiftKey || target.lockRatio) lockRatio = true;
|
|
14591
|
+
const data = EditDataHelper.getScaleData(target, dragStartData.bounds, direction, totalMove, lockRatio, EditDataHelper.getAround(around, e.altKey), flipable, !single || editSize === "scale");
|
|
14592
|
+
const targetX = target.x, targetY = target.y;
|
|
14593
|
+
if (e instanceof DragEvent && this.editTool && this.editTool.onScaleWithDrag) {
|
|
14594
|
+
data.drag = e;
|
|
14595
|
+
this.scaleWithDrag(data);
|
|
14596
|
+
} else {
|
|
14597
|
+
this.scaleOf(data.origin, data.scaleX, data.scaleY);
|
|
14471
14598
|
}
|
|
14599
|
+
PointHelper.move(dragStartData.totalOffset, target.x - targetX, target.y - targetY);
|
|
14472
14600
|
}
|
|
14473
14601
|
onRotate(e) {
|
|
14474
14602
|
const {target: target, mergeConfig: mergeConfig, dragStartData: dragStartData} = this.editBox;
|
|
14475
|
-
const {around: around, rotateAround: rotateAround, rotateGap: rotateGap} = mergeConfig;
|
|
14603
|
+
const {around: around, rotateAround: rotateAround, rotateGap: rotateGap, diagonalRotateKey: diagonalRotateKey} = mergeConfig;
|
|
14476
14604
|
const {direction: direction} = e.current;
|
|
14477
14605
|
let origin, rotation;
|
|
14478
14606
|
if (e instanceof RotateEvent) {
|
|
14479
14607
|
rotation = e.rotation;
|
|
14480
14608
|
origin = rotateAround ? AroundHelper.getPoint(rotateAround, target.boxBounds) : target.getBoxPoint(e);
|
|
14481
14609
|
} else {
|
|
14482
|
-
const
|
|
14610
|
+
const isDiagonalRotate = diagonalRotateKey ? e.isHoldKeys(diagonalRotateKey) : e.shiftKey;
|
|
14611
|
+
const data = EditDataHelper.getRotateData(target, direction, e, dragStartData, isDiagonalRotate ? null : rotateAround || target.around || target.origin || around || "center");
|
|
14483
14612
|
rotation = dragStartData.rotation + data.rotation - target.rotation;
|
|
14484
14613
|
origin = data.origin;
|
|
14485
14614
|
}
|
|
14486
14615
|
rotation = MathHelper.float(MathHelper.getGapRotation(rotation, rotateGap, target.rotation), 2);
|
|
14487
14616
|
if (!rotation) return;
|
|
14617
|
+
const targetX = target.x, targetY = target.y;
|
|
14488
14618
|
this.rotateOf(origin, rotation);
|
|
14619
|
+
PointHelper.move(dragStartData.totalOffset, target.x - targetX, target.y - targetY);
|
|
14489
14620
|
}
|
|
14490
14621
|
onSkew(e) {
|
|
14491
14622
|
const {target: target, mergeConfig: mergeConfig} = this.editBox;
|
|
@@ -14764,6 +14895,16 @@ let Editor = class Editor extends Group {
|
|
|
14764
14895
|
shiftItem(item) {
|
|
14765
14896
|
this.hasItem(item) ? this.removeItem(item) : this.addItem(item);
|
|
14766
14897
|
}
|
|
14898
|
+
setDimOthers(value, attrName = "dim", list) {
|
|
14899
|
+
if (!list) {
|
|
14900
|
+
const {dimTarget: dimTarget, targetLeafer: targetLeafer} = this;
|
|
14901
|
+
list = dimTarget ? isArray(dimTarget) ? dimTarget : [ dimTarget ] : [ targetLeafer ];
|
|
14902
|
+
}
|
|
14903
|
+
if (list[0] && list[0][attrName] !== (value || false)) list.forEach(item => DataHelper.stintSet(item, attrName, value));
|
|
14904
|
+
}
|
|
14905
|
+
setBright(value) {
|
|
14906
|
+
this.setDimOthers(value, "bright", this.list);
|
|
14907
|
+
}
|
|
14767
14908
|
update() {
|
|
14768
14909
|
if (this.editing) {
|
|
14769
14910
|
if (!this.element.parent) return this.cancel();
|
|
@@ -14986,10 +15127,10 @@ let Editor = class Editor extends Group {
|
|
|
14986
15127
|
|
|
14987
15128
|
__decorate([ mergeConfigAttr() ], Editor.prototype, "mergeConfig", void 0);
|
|
14988
15129
|
|
|
14989
|
-
__decorate([ targetAttr(onHover) ], Editor.prototype, "hoverTarget", void 0);
|
|
14990
|
-
|
|
14991
15130
|
__decorate([ targetAttr(onTarget) ], Editor.prototype, "target", void 0);
|
|
14992
15131
|
|
|
15132
|
+
__decorate([ targetAttr(onHover) ], Editor.prototype, "hoverTarget", void 0);
|
|
15133
|
+
|
|
14993
15134
|
Editor = __decorate([ useModule(TransformTool, [ "editBox", "editTool", "emitEvent" ]) ], Editor);
|
|
14994
15135
|
|
|
14995
15136
|
class InnerEditor {
|
|
@@ -15218,7 +15359,7 @@ let LineEditTool = class LineEditTool extends EditTool {
|
|
|
15218
15359
|
|
|
15219
15360
|
LineEditTool = __decorate([ registerEditTool() ], LineEditTool);
|
|
15220
15361
|
|
|
15221
|
-
const {M: M$
|
|
15362
|
+
const {M: M$4, L: L$3, C: C$3, Q: Q$2, Z: Z$2, N: N$1, D: D$1, X: X$1, G: G$1, F: F$1, O: O$2, P: P$1, U: U$1} = PathCommandMap;
|
|
15222
15363
|
|
|
15223
15364
|
const PathScaler = {
|
|
15224
15365
|
scale(data, scaleX, scaleY) {
|
|
@@ -15228,7 +15369,7 @@ const PathScaler = {
|
|
|
15228
15369
|
while (i < len) {
|
|
15229
15370
|
command = data[i];
|
|
15230
15371
|
switch (command) {
|
|
15231
|
-
case M$
|
|
15372
|
+
case M$4:
|
|
15232
15373
|
case L$3:
|
|
15233
15374
|
scalePoints(data, scaleX, scaleY, i, 1);
|
|
15234
15375
|
i += 3;
|
|
@@ -15567,6 +15708,13 @@ register("design", design);
|
|
|
15567
15708
|
register("document", document);
|
|
15568
15709
|
|
|
15569
15710
|
const MultiTouchHelper = {
|
|
15711
|
+
state: {
|
|
15712
|
+
type: "none",
|
|
15713
|
+
typeCount: 0,
|
|
15714
|
+
startTime: 0,
|
|
15715
|
+
totalData: null,
|
|
15716
|
+
center: {}
|
|
15717
|
+
},
|
|
15570
15718
|
getData(list) {
|
|
15571
15719
|
const a = list[0], b = list[1];
|
|
15572
15720
|
const lastCenter = PointHelper.getCenter(a.from, b.from);
|
|
@@ -15585,9 +15733,53 @@ const MultiTouchHelper = {
|
|
|
15585
15733
|
rotation: rotation,
|
|
15586
15734
|
center: center
|
|
15587
15735
|
};
|
|
15736
|
+
},
|
|
15737
|
+
getType(data, config) {
|
|
15738
|
+
const moveScore = Math.hypot(data.move.x, data.move.y) / (config.move || 5);
|
|
15739
|
+
const scaleScore = Math.abs(data.scale - 1) / (config.scale || .03);
|
|
15740
|
+
const rotateScore = Math.abs(data.rotation) / (config.rotation || 2);
|
|
15741
|
+
if (moveScore < 1 && scaleScore < 1 && rotateScore < 1) return "none";
|
|
15742
|
+
if (moveScore >= scaleScore && moveScore >= rotateScore) return "move";
|
|
15743
|
+
if (scaleScore >= rotateScore) return "zoom";
|
|
15744
|
+
return "rotate";
|
|
15745
|
+
},
|
|
15746
|
+
detect(data, config) {
|
|
15747
|
+
const {state: state} = M$3;
|
|
15748
|
+
const type = M$3.getType(data, config);
|
|
15749
|
+
if (!state.totalData) {
|
|
15750
|
+
state.startTime = Date.now();
|
|
15751
|
+
state.center = data.center;
|
|
15752
|
+
}
|
|
15753
|
+
M$3.add(data, state.totalData);
|
|
15754
|
+
state.totalData = data;
|
|
15755
|
+
if (type === state.type) {
|
|
15756
|
+
state.typeCount++;
|
|
15757
|
+
if (state.typeCount >= (config.count || 3) && type !== "none") return type;
|
|
15758
|
+
} else {
|
|
15759
|
+
state.type = type;
|
|
15760
|
+
state.typeCount = 1;
|
|
15761
|
+
}
|
|
15762
|
+
if (Date.now() - state.startTime >= (config.time || 160)) return M$3.getType(state.totalData, config);
|
|
15763
|
+
return "none";
|
|
15764
|
+
},
|
|
15765
|
+
add(data, add) {
|
|
15766
|
+
if (!add) return;
|
|
15767
|
+
PointHelper.move(data.move, add.move);
|
|
15768
|
+
data.scale *= add.scale;
|
|
15769
|
+
data.rotation += add.rotation;
|
|
15770
|
+
data.center = add.center;
|
|
15771
|
+
},
|
|
15772
|
+
reset() {
|
|
15773
|
+
const {state: state} = M$3;
|
|
15774
|
+
state.type = "none";
|
|
15775
|
+
state.typeCount = 0;
|
|
15776
|
+
state.startTime = 0;
|
|
15777
|
+
state.totalData = null;
|
|
15588
15778
|
}
|
|
15589
15779
|
};
|
|
15590
15780
|
|
|
15781
|
+
const M$3 = MultiTouchHelper;
|
|
15782
|
+
|
|
15591
15783
|
const {abs: abs$2, max: max} = Math, {sign: sign, within: within$2} = MathHelper;
|
|
15592
15784
|
|
|
15593
15785
|
const WheelEventHelper = {
|
|
@@ -15627,9 +15819,20 @@ const WheelEventHelper = {
|
|
|
15627
15819
|
}
|
|
15628
15820
|
};
|
|
15629
15821
|
|
|
15822
|
+
let totalX, totalY, totalScale, totalRotation;
|
|
15823
|
+
|
|
15630
15824
|
class Transformer {
|
|
15631
15825
|
get transforming() {
|
|
15632
|
-
return
|
|
15826
|
+
return this.moving || this.zooming || this.rotating;
|
|
15827
|
+
}
|
|
15828
|
+
get moving() {
|
|
15829
|
+
return !!this.moveData;
|
|
15830
|
+
}
|
|
15831
|
+
get zooming() {
|
|
15832
|
+
return !!this.zoomData;
|
|
15833
|
+
}
|
|
15834
|
+
get rotating() {
|
|
15835
|
+
return !!this.rotateData;
|
|
15633
15836
|
}
|
|
15634
15837
|
constructor(interaction) {
|
|
15635
15838
|
this.interaction = interaction;
|
|
@@ -15639,13 +15842,18 @@ class Transformer {
|
|
|
15639
15842
|
if (!data.moveType) data.moveType = "move";
|
|
15640
15843
|
if (!this.moveData) {
|
|
15641
15844
|
this.setPath(data);
|
|
15845
|
+
totalX = 0, totalY = 0;
|
|
15642
15846
|
this.moveData = Object.assign(Object.assign({}, data), {
|
|
15643
15847
|
moveX: 0,
|
|
15644
|
-
moveY: 0
|
|
15848
|
+
moveY: 0,
|
|
15849
|
+
totalX: totalX,
|
|
15850
|
+
totalY: totalY
|
|
15645
15851
|
});
|
|
15646
15852
|
interaction.emit(MoveEvent.START, this.moveData);
|
|
15647
15853
|
}
|
|
15648
15854
|
data.path = this.moveData.path;
|
|
15855
|
+
data.totalX = totalX = totalX + data.moveX;
|
|
15856
|
+
data.totalY = totalY = totalY + data.moveY;
|
|
15649
15857
|
interaction.emit(MoveEvent.BEFORE_MOVE, data);
|
|
15650
15858
|
interaction.emit(MoveEvent.MOVE, data);
|
|
15651
15859
|
this.transformEndWait();
|
|
@@ -15654,12 +15862,15 @@ class Transformer {
|
|
|
15654
15862
|
const {interaction: interaction} = this;
|
|
15655
15863
|
if (!this.zoomData) {
|
|
15656
15864
|
this.setPath(data);
|
|
15865
|
+
totalScale = 1;
|
|
15657
15866
|
this.zoomData = Object.assign(Object.assign({}, data), {
|
|
15658
|
-
scale: 1
|
|
15867
|
+
scale: 1,
|
|
15868
|
+
totalScale: totalScale
|
|
15659
15869
|
});
|
|
15660
15870
|
interaction.emit(ZoomEvent.START, this.zoomData);
|
|
15661
15871
|
}
|
|
15662
15872
|
data.path = this.zoomData.path;
|
|
15873
|
+
data.totalScale = totalScale = totalScale * data.scale;
|
|
15663
15874
|
interaction.emit(ZoomEvent.BEFORE_ZOOM, data);
|
|
15664
15875
|
interaction.emit(ZoomEvent.ZOOM, data);
|
|
15665
15876
|
this.transformEndWait();
|
|
@@ -15668,12 +15879,15 @@ class Transformer {
|
|
|
15668
15879
|
const {interaction: interaction} = this;
|
|
15669
15880
|
if (!this.rotateData) {
|
|
15670
15881
|
this.setPath(data);
|
|
15882
|
+
totalRotation = 0;
|
|
15671
15883
|
this.rotateData = Object.assign(Object.assign({}, data), {
|
|
15672
|
-
rotation: 0
|
|
15884
|
+
rotation: 0,
|
|
15885
|
+
totalRotation: totalRotation
|
|
15673
15886
|
});
|
|
15674
15887
|
interaction.emit(RotateEvent.START, this.rotateData);
|
|
15675
15888
|
}
|
|
15676
15889
|
data.path = this.rotateData.path;
|
|
15890
|
+
data.totalRotation = totalRotation = totalRotation + data.rotation;
|
|
15677
15891
|
interaction.emit(RotateEvent.BEFORE_ROTATE, data);
|
|
15678
15892
|
interaction.emit(RotateEvent.ROTATE, data);
|
|
15679
15893
|
this.transformEndWait();
|
|
@@ -15692,9 +15906,16 @@ class Transformer {
|
|
|
15692
15906
|
}
|
|
15693
15907
|
transformEnd() {
|
|
15694
15908
|
const {interaction: interaction, moveData: moveData, zoomData: zoomData, rotateData: rotateData} = this;
|
|
15695
|
-
if (moveData) interaction.emit(MoveEvent.END, moveData)
|
|
15696
|
-
|
|
15697
|
-
|
|
15909
|
+
if (moveData) interaction.emit(MoveEvent.END, Object.assign(Object.assign({}, moveData), {
|
|
15910
|
+
totalX: totalX,
|
|
15911
|
+
totalY: totalY
|
|
15912
|
+
}));
|
|
15913
|
+
if (zoomData) interaction.emit(ZoomEvent.END, Object.assign(Object.assign({}, zoomData), {
|
|
15914
|
+
totalScale: totalScale
|
|
15915
|
+
}));
|
|
15916
|
+
if (rotateData) interaction.emit(RotateEvent.END, Object.assign(Object.assign({}, rotateData), {
|
|
15917
|
+
totalRotation: totalRotation
|
|
15918
|
+
}));
|
|
15698
15919
|
this.reset();
|
|
15699
15920
|
}
|
|
15700
15921
|
reset() {
|
|
@@ -15792,14 +16013,39 @@ interaction.wheel = function(data) {
|
|
|
15792
16013
|
};
|
|
15793
16014
|
|
|
15794
16015
|
interaction.multiTouch = function(data, list) {
|
|
15795
|
-
|
|
15796
|
-
|
|
15797
|
-
Object.assign(data, center);
|
|
15798
|
-
data.multiTouch = true;
|
|
16016
|
+
const {disabled: disabled, singleGesture: singleGesture} = this.config.multiTouch;
|
|
16017
|
+
if (disabled) return;
|
|
15799
16018
|
this.pointerWaitCancel();
|
|
15800
|
-
|
|
15801
|
-
this.
|
|
15802
|
-
|
|
16019
|
+
let gestureData = MultiTouchHelper.getData(list);
|
|
16020
|
+
let {moving: moving, zooming: zooming, rotating: rotating} = this.transformer;
|
|
16021
|
+
if (singleGesture) {
|
|
16022
|
+
if (!this.transformer.transforming) {
|
|
16023
|
+
const type = MultiTouchHelper.detect(gestureData, isObject(singleGesture) ? singleGesture : {});
|
|
16024
|
+
switch (type) {
|
|
16025
|
+
case "move":
|
|
16026
|
+
moving = true;
|
|
16027
|
+
break;
|
|
16028
|
+
|
|
16029
|
+
case "zoom":
|
|
16030
|
+
zooming = true;
|
|
16031
|
+
break;
|
|
16032
|
+
|
|
16033
|
+
case "rotate":
|
|
16034
|
+
rotating = true;
|
|
16035
|
+
break;
|
|
16036
|
+
|
|
16037
|
+
default:
|
|
16038
|
+
return;
|
|
16039
|
+
}
|
|
16040
|
+
MultiTouchHelper.reset();
|
|
16041
|
+
}
|
|
16042
|
+
if (!moving) gestureData.center = MultiTouchHelper.state.center;
|
|
16043
|
+
} else moving = zooming = rotating = true;
|
|
16044
|
+
Object.assign(data, gestureData.center);
|
|
16045
|
+
data.multiTouch = true;
|
|
16046
|
+
if (rotating) this.rotate(getRotateEventData(gestureData.rotation, data));
|
|
16047
|
+
if (zooming) this.zoom(getZoomEventData(gestureData.scale, data));
|
|
16048
|
+
if (moving) this.move(getMoveEventData(gestureData.move, data));
|
|
15803
16049
|
};
|
|
15804
16050
|
|
|
15805
16051
|
const dragger = Dragger.prototype;
|
|
@@ -18764,6 +19010,18 @@ UI.addAttr("placeholderStyle", undefined, stateStyleType);
|
|
|
18764
19010
|
|
|
18765
19011
|
UI.addAttr("button", false, dataType);
|
|
18766
19012
|
|
|
19013
|
+
ui$1.set = function(data, transition) {
|
|
19014
|
+
if (data) {
|
|
19015
|
+
if (transition) {
|
|
19016
|
+
if (transition === "temp") {
|
|
19017
|
+
this.lockNormalStyle = true;
|
|
19018
|
+
Object.assign(this, data);
|
|
19019
|
+
this.lockNormalStyle = false;
|
|
19020
|
+
} else this.animate(data, transition);
|
|
19021
|
+
} else Object.assign(this, data);
|
|
19022
|
+
}
|
|
19023
|
+
};
|
|
19024
|
+
|
|
18767
19025
|
ui$1.focus = function(value = true) {
|
|
18768
19026
|
this.waitLeafer(() => {
|
|
18769
19027
|
let {focusData: focusData} = this.app.interaction;
|
|
@@ -19191,14 +19449,10 @@ const ExportModule = {
|
|
|
19191
19449
|
renderOptions.bounds = canvas.bounds;
|
|
19192
19450
|
}
|
|
19193
19451
|
canvas.save();
|
|
19194
|
-
|
|
19195
|
-
|
|
19196
|
-
|
|
19197
|
-
|
|
19198
|
-
leaf.fill = oldFill;
|
|
19199
|
-
} else {
|
|
19200
|
-
leaf.__render(canvas, renderOptions);
|
|
19201
|
-
}
|
|
19452
|
+
const igroneFill = isFrame && !isUndefined(fill), oldFill = leaf.get("fill");
|
|
19453
|
+
if (igroneFill) leaf.fill = "";
|
|
19454
|
+
Platform.render(leaf, canvas, renderOptions);
|
|
19455
|
+
if (igroneFill) leaf.fill = oldFill;
|
|
19202
19456
|
canvas.restore();
|
|
19203
19457
|
if (sliceLeaf) sliceLeaf.__updateWorldOpacity();
|
|
19204
19458
|
if (trim) {
|
|
@@ -19360,4 +19614,8 @@ Object.assign(Filter, {
|
|
|
19360
19614
|
}
|
|
19361
19615
|
});
|
|
19362
19616
|
|
|
19363
|
-
|
|
19617
|
+
Plugin.add("bright");
|
|
19618
|
+
|
|
19619
|
+
UI.addAttr("bright", false, dimType);
|
|
19620
|
+
|
|
19621
|
+
export { AlignHelper, Animate, AnimateEasing, AnimateEvent, AnimateList, Answer, App, AroundHelper, Arrow, ArrowData, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, DragEvent, Dragger, DropEvent, EditBox, EditDataHelper, EditPoint, EditSelect, EditSelectHelper, EditTool, EditToolCreator, Editor, EditorEvent, EditorGroupEvent, EditorHelper, EditorMoveEvent, EditorRotateEvent, EditorScaleEvent, EditorSkewEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Finder, Flow, FourNumberHelper, Frame, FrameData, Group, GroupData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, InnerEditor, InnerEditorEvent, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, LeaferTypeCreator, Line, LineData, LineEditTool, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, MyDragEvent, MyImage, MyPointerEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathArrowModule, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathMatrixHelper, PathNumberCommandLengthMap, PathNumberCommandMap, PathScaler, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Robot, RobotData, RotateEvent, Run, ScrollBar, SelectArea, Selector, Star, StarData, State, StringNumberMap, Stroker, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TransformTool, Transformer, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, WheelEventHelper, ZoomEvent, addViewport, addViewportConfig, affectRenderBoundsType, affectStrokeBoundsType, arrowType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createAttr, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, dimType, doBoundsType, doStrokeType, effectType, emptyData, eraserType, extraPropertyEventMap, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isArray, isData, isEmptyData, isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, motionPathType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerEditTool, registerInnerEditor, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleResize, scaleResizeFontSize, scaleResizeGroup, scaleResizePath, scaleResizePoints, scaleType, scrollType, sortType, stateStyleType, stateType, strokeType, surfaceType, tempBounds$2 as tempBounds, tempMatrix$2 as tempMatrix, tempPoint$3 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
|