@leafer/worker 2.1.2 → 2.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/worker.js +191 -133
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +191 -133
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +27 -27
package/dist/worker.js
CHANGED
|
@@ -434,7 +434,7 @@ var LeaferUI = function(exports) {
|
|
|
434
434
|
}
|
|
435
435
|
const {sin: sin$6, cos: cos$6, acos: acos, sqrt: sqrt$5} = Math;
|
|
436
436
|
const {float: float$6} = MathHelper;
|
|
437
|
-
const tempPoint$
|
|
437
|
+
const tempPoint$6 = {};
|
|
438
438
|
function getWorld() {
|
|
439
439
|
return Object.assign(Object.assign(Object.assign({}, getMatrixData()), getBoundsData()), {
|
|
440
440
|
scaleX: 1,
|
|
@@ -491,8 +491,8 @@ var LeaferUI = function(exports) {
|
|
|
491
491
|
to.f = t.f * pixelRatio;
|
|
492
492
|
},
|
|
493
493
|
scaleOfOuter(t, origin, scaleX, scaleY) {
|
|
494
|
-
M$c.toInnerPoint(t, origin, tempPoint$
|
|
495
|
-
M$c.scaleOfInner(t, tempPoint$
|
|
494
|
+
M$c.toInnerPoint(t, origin, tempPoint$6);
|
|
495
|
+
M$c.scaleOfInner(t, tempPoint$6, scaleX, scaleY);
|
|
496
496
|
},
|
|
497
497
|
scaleOfInner(t, origin, scaleX, scaleY = scaleX) {
|
|
498
498
|
M$c.translateInner(t, origin.x, origin.y);
|
|
@@ -510,8 +510,8 @@ var LeaferUI = function(exports) {
|
|
|
510
510
|
t.d = c * sinR + d * cosR;
|
|
511
511
|
},
|
|
512
512
|
rotateOfOuter(t, origin, rotation) {
|
|
513
|
-
M$c.toInnerPoint(t, origin, tempPoint$
|
|
514
|
-
M$c.rotateOfInner(t, tempPoint$
|
|
513
|
+
M$c.toInnerPoint(t, origin, tempPoint$6);
|
|
514
|
+
M$c.rotateOfInner(t, tempPoint$6, rotation);
|
|
515
515
|
},
|
|
516
516
|
rotateOfInner(t, origin, rotation) {
|
|
517
517
|
M$c.translateInner(t, origin.x, origin.y);
|
|
@@ -532,8 +532,8 @@ var LeaferUI = function(exports) {
|
|
|
532
532
|
}
|
|
533
533
|
},
|
|
534
534
|
skewOfOuter(t, origin, skewX, skewY) {
|
|
535
|
-
M$c.toInnerPoint(t, origin, tempPoint$
|
|
536
|
-
M$c.skewOfInner(t, tempPoint$
|
|
535
|
+
M$c.toInnerPoint(t, origin, tempPoint$6);
|
|
536
|
+
M$c.skewOfInner(t, tempPoint$6, skewX, skewY);
|
|
537
537
|
},
|
|
538
538
|
skewOfInner(t, origin, skewX, skewY = 0) {
|
|
539
539
|
M$c.translateInner(t, origin.x, origin.y);
|
|
@@ -729,7 +729,7 @@ var LeaferUI = function(exports) {
|
|
|
729
729
|
};
|
|
730
730
|
const M$c = MatrixHelper;
|
|
731
731
|
const {float: float$5} = MathHelper;
|
|
732
|
-
const {toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$
|
|
732
|
+
const {toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$4} = MatrixHelper;
|
|
733
733
|
const {sin: sin$5, cos: cos$5, abs: abs$b, sqrt: sqrt$4, atan2: atan2$2, min: min$3, round: round$5} = Math;
|
|
734
734
|
const PointHelper = {
|
|
735
735
|
defaultPoint: getPointData(),
|
|
@@ -785,7 +785,7 @@ var LeaferUI = function(exports) {
|
|
|
785
785
|
tempToOuterOf(t, matrix) {
|
|
786
786
|
const {tempPoint: temp} = P$7;
|
|
787
787
|
copy$c(temp, t);
|
|
788
|
-
toOuterPoint$
|
|
788
|
+
toOuterPoint$4(matrix, temp, temp);
|
|
789
789
|
return temp;
|
|
790
790
|
},
|
|
791
791
|
tempToInnerRadiusPointOf(t, matrix) {
|
|
@@ -809,7 +809,7 @@ var LeaferUI = function(exports) {
|
|
|
809
809
|
toInnerPoint$2(matrix, t, to);
|
|
810
810
|
},
|
|
811
811
|
toOuterOf(t, matrix, to) {
|
|
812
|
-
toOuterPoint$
|
|
812
|
+
toOuterPoint$4(matrix, t, to);
|
|
813
813
|
},
|
|
814
814
|
getCenter(t, to) {
|
|
815
815
|
return {
|
|
@@ -946,7 +946,7 @@ var LeaferUI = function(exports) {
|
|
|
946
946
|
return this;
|
|
947
947
|
}
|
|
948
948
|
}
|
|
949
|
-
const tempPoint$
|
|
949
|
+
const tempPoint$5 = new Point;
|
|
950
950
|
class Matrix {
|
|
951
951
|
constructor(a, b, c, d, e, f) {
|
|
952
952
|
this.set(a, b, c, d, e, f);
|
|
@@ -1199,7 +1199,7 @@ var LeaferUI = function(exports) {
|
|
|
1199
1199
|
}
|
|
1200
1200
|
};
|
|
1201
1201
|
const {tempPointBounds: tempPointBounds$1, setPoint: setPoint$5, addPoint: addPoint$3, toBounds: toBounds$3} = TwoPointBoundsHelper;
|
|
1202
|
-
const {toOuterPoint: toOuterPoint$
|
|
1202
|
+
const {toOuterPoint: toOuterPoint$3} = MatrixHelper;
|
|
1203
1203
|
const {float: float$4, fourNumber: fourNumber$1} = MathHelper;
|
|
1204
1204
|
const {floor: floor$2, ceil: ceil$2} = Math;
|
|
1205
1205
|
let right$4, bottom$3, boundsRight, boundsBottom;
|
|
@@ -1306,16 +1306,16 @@ var LeaferUI = function(exports) {
|
|
|
1306
1306
|
} else {
|
|
1307
1307
|
point$2.x = t.x;
|
|
1308
1308
|
point$2.y = t.y;
|
|
1309
|
-
toOuterPoint$
|
|
1309
|
+
toOuterPoint$3(matrix, point$2, toPoint$5);
|
|
1310
1310
|
setPoint$5(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
|
|
1311
1311
|
point$2.x = t.x + t.width;
|
|
1312
|
-
toOuterPoint$
|
|
1312
|
+
toOuterPoint$3(matrix, point$2, toPoint$5);
|
|
1313
1313
|
addPoint$3(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
|
|
1314
1314
|
point$2.y = t.y + t.height;
|
|
1315
|
-
toOuterPoint$
|
|
1315
|
+
toOuterPoint$3(matrix, point$2, toPoint$5);
|
|
1316
1316
|
addPoint$3(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
|
|
1317
1317
|
point$2.x = t.x;
|
|
1318
|
-
toOuterPoint$
|
|
1318
|
+
toOuterPoint$3(matrix, point$2, toPoint$5);
|
|
1319
1319
|
addPoint$3(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
|
|
1320
1320
|
toBounds$3(tempPointBounds$1, to);
|
|
1321
1321
|
}
|
|
@@ -2522,7 +2522,7 @@ var LeaferUI = function(exports) {
|
|
|
2522
2522
|
const {setPoint: setPoint$4, addPoint: addPoint$2} = TwoPointBoundsHelper;
|
|
2523
2523
|
const {set: set$1, toNumberPoints: toNumberPoints$1} = PointHelper;
|
|
2524
2524
|
const {M: M$b, L: L$b, C: C$9, Q: Q$7, Z: Z$9} = PathCommandMap;
|
|
2525
|
-
const tempPoint$
|
|
2525
|
+
const tempPoint$4 = {};
|
|
2526
2526
|
const BezierHelper = {
|
|
2527
2527
|
points(data, originPoints, curve, close) {
|
|
2528
2528
|
let points = toNumberPoints$1(originPoints);
|
|
@@ -2692,8 +2692,8 @@ var LeaferUI = function(exports) {
|
|
|
2692
2692
|
addMode ? addPoint$2(pointBounds, fromX, fromY) : setPoint$4(pointBounds, fromX, fromY);
|
|
2693
2693
|
addPoint$2(pointBounds, toX, toY);
|
|
2694
2694
|
for (let i = 0, len = tList.length; i < len; i++) {
|
|
2695
|
-
getPointAndSet(tList[i], fromX, fromY, x1, y1, x2, y2, toX, toY, tempPoint$
|
|
2696
|
-
addPoint$2(pointBounds, tempPoint$
|
|
2695
|
+
getPointAndSet(tList[i], fromX, fromY, x1, y1, x2, y2, toX, toY, tempPoint$4);
|
|
2696
|
+
addPoint$2(pointBounds, tempPoint$4.x, tempPoint$4.y);
|
|
2697
2697
|
}
|
|
2698
2698
|
},
|
|
2699
2699
|
getPointAndSet(t, fromX, fromY, x1, y1, x2, y2, toX, toY, setPoint) {
|
|
@@ -2850,6 +2850,7 @@ var LeaferUI = function(exports) {
|
|
|
2850
2850
|
current.length = PathCommandLengthMap[char];
|
|
2851
2851
|
current.index = 0;
|
|
2852
2852
|
pushData(data, current.name);
|
|
2853
|
+
if (char === "m") current.name = PathCommandMap["l"]; else if (char === "M") current.name = PathCommandMap["L"];
|
|
2853
2854
|
if (!needConvert && convertCommand[char]) needConvert = true;
|
|
2854
2855
|
} else {
|
|
2855
2856
|
if (char === "-" || char === "+") {
|
|
@@ -2882,10 +2883,9 @@ var LeaferUI = function(exports) {
|
|
|
2882
2883
|
old[i + 2] += y;
|
|
2883
2884
|
|
|
2884
2885
|
case M$a:
|
|
2885
|
-
x = old[i + 1];
|
|
2886
|
-
y = old[i + 2];
|
|
2887
|
-
|
|
2888
|
-
startY = y;
|
|
2886
|
+
x = startX = old[i + 1];
|
|
2887
|
+
y = startY = old[i + 2];
|
|
2888
|
+
data.push(M$a, x, y);
|
|
2889
2889
|
i += 3;
|
|
2890
2890
|
break;
|
|
2891
2891
|
|
|
@@ -2927,8 +2927,8 @@ var LeaferUI = function(exports) {
|
|
|
2927
2927
|
|
|
2928
2928
|
case S$1:
|
|
2929
2929
|
smooth = lastCommand === C$8 || lastCommand === S$1;
|
|
2930
|
-
x1 = smooth ? x * 2 - controlX :
|
|
2931
|
-
y1 = smooth ? y * 2 - controlY :
|
|
2930
|
+
x1 = smooth ? x * 2 - controlX : x;
|
|
2931
|
+
y1 = smooth ? y * 2 - controlY : y;
|
|
2932
2932
|
controlX = old[i + 1];
|
|
2933
2933
|
controlY = old[i + 2];
|
|
2934
2934
|
x = old[i + 3];
|
|
@@ -2962,8 +2962,8 @@ var LeaferUI = function(exports) {
|
|
|
2962
2962
|
|
|
2963
2963
|
case T:
|
|
2964
2964
|
smooth = lastCommand === Q$6 || lastCommand === T;
|
|
2965
|
-
controlX = smooth ? x * 2 - controlX :
|
|
2966
|
-
controlY = smooth ? y * 2 - controlY :
|
|
2965
|
+
controlX = smooth ? x * 2 - controlX : x;
|
|
2966
|
+
controlY = smooth ? y * 2 - controlY : y;
|
|
2967
2967
|
curveMode ? quadraticCurveTo$1(data, x, y, controlX, controlY, old[i + 1], old[i + 2]) : data.push(Q$6, controlX, controlY, old[i + 1], old[i + 2]);
|
|
2968
2968
|
x = old[i + 1];
|
|
2969
2969
|
y = old[i + 2];
|
|
@@ -4475,7 +4475,7 @@ var LeaferUI = function(exports) {
|
|
|
4475
4475
|
EventCreator.register(target);
|
|
4476
4476
|
};
|
|
4477
4477
|
}
|
|
4478
|
-
const {copy: copy$8, toInnerPoint: toInnerPoint$1, toOuterPoint: toOuterPoint$
|
|
4478
|
+
const {copy: copy$8, toInnerPoint: toInnerPoint$1, toOuterPoint: toOuterPoint$2, scaleOfOuter: scaleOfOuter$2, rotateOfOuter: rotateOfOuter$2, skewOfOuter: skewOfOuter, multiplyParent: multiplyParent$3, divideParent: divideParent, getLayout: getLayout} = MatrixHelper;
|
|
4479
4479
|
const matrix$3 = {}, {round: round$3} = Math;
|
|
4480
4480
|
const LeafHelper = {
|
|
4481
4481
|
updateAllMatrix(leaf, checkAutoLayout, waitAutoLayout) {
|
|
@@ -4556,7 +4556,7 @@ var LeaferUI = function(exports) {
|
|
|
4556
4556
|
x: x,
|
|
4557
4557
|
y: y
|
|
4558
4558
|
};
|
|
4559
|
-
isInnerPoint ? toOuterPoint$
|
|
4559
|
+
isInnerPoint ? toOuterPoint$2(t.localTransform, local, local, true) : t.parent && toInnerPoint$1(t.parent.scrollWorldTransform, local, local, true);
|
|
4560
4560
|
L$5.moveLocal(t, local.x, local.y, transition);
|
|
4561
4561
|
},
|
|
4562
4562
|
moveLocal(t, x, y = 0, transition) {
|
|
@@ -4569,10 +4569,10 @@ var LeaferUI = function(exports) {
|
|
|
4569
4569
|
y: y
|
|
4570
4570
|
}, transition) : (t.x = x, t.y = y);
|
|
4571
4571
|
},
|
|
4572
|
-
zoomOfWorld(t, origin, scaleX, scaleY, resize, transition) {
|
|
4573
|
-
L$5.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY, resize, transition);
|
|
4572
|
+
zoomOfWorld(t, origin, scaleX, scaleY, resize, transition, boundsType) {
|
|
4573
|
+
L$5.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY, resize, transition, boundsType);
|
|
4574
4574
|
},
|
|
4575
|
-
zoomOfLocal(t, origin, scaleX, scaleY = scaleX, resize, transition) {
|
|
4575
|
+
zoomOfLocal(t, origin, scaleX, scaleY = scaleX, resize, transition, boundsType) {
|
|
4576
4576
|
const o = t.__localMatrix;
|
|
4577
4577
|
if (!isNumber(scaleY)) {
|
|
4578
4578
|
if (scaleY) transition = scaleY;
|
|
@@ -4581,7 +4581,7 @@ var LeaferUI = function(exports) {
|
|
|
4581
4581
|
copy$8(matrix$3, o);
|
|
4582
4582
|
scaleOfOuter$2(matrix$3, origin, scaleX, scaleY);
|
|
4583
4583
|
if (L$5.hasHighPosition(t)) {
|
|
4584
|
-
L$5.setTransform(t, matrix$3, resize, transition);
|
|
4584
|
+
L$5.setTransform(t, matrix$3, resize, transition, boundsType);
|
|
4585
4585
|
} else {
|
|
4586
4586
|
const x = t.x + matrix$3.e - o.e, y = t.y + matrix$3.f - o.f;
|
|
4587
4587
|
if (transition && !resize) t.animate({
|
|
@@ -4589,7 +4589,7 @@ var LeaferUI = function(exports) {
|
|
|
4589
4589
|
y: y,
|
|
4590
4590
|
scaleX: t.scaleX * scaleX,
|
|
4591
4591
|
scaleY: t.scaleY * scaleY
|
|
4592
|
-
}, transition); else t.x = x, t.y = y, t.scaleResize(scaleX, scaleY, resize !== true);
|
|
4592
|
+
}, transition); else t.x = x, t.y = y, t.scaleResize(scaleX, scaleY, resize !== true, boundsType);
|
|
4593
4593
|
}
|
|
4594
4594
|
},
|
|
4595
4595
|
rotateOfWorld(t, origin, angle, transition) {
|
|
@@ -4613,18 +4613,18 @@ var LeaferUI = function(exports) {
|
|
|
4613
4613
|
skewOfOuter(matrix$3, origin, skewX, skewY);
|
|
4614
4614
|
L$5.setTransform(t, matrix$3, resize, transition);
|
|
4615
4615
|
},
|
|
4616
|
-
transformWorld(t, transform, resize, transition) {
|
|
4616
|
+
transformWorld(t, transform, resize, transition, boundsType) {
|
|
4617
4617
|
copy$8(matrix$3, t.worldTransform);
|
|
4618
4618
|
multiplyParent$3(matrix$3, transform);
|
|
4619
4619
|
if (t.parent) divideParent(matrix$3, t.parent.scrollWorldTransform);
|
|
4620
|
-
L$5.setTransform(t, matrix$3, resize, transition);
|
|
4620
|
+
L$5.setTransform(t, matrix$3, resize, transition, boundsType);
|
|
4621
4621
|
},
|
|
4622
|
-
transform(t, transform, resize, transition) {
|
|
4622
|
+
transform(t, transform, resize, transition, boundsType) {
|
|
4623
4623
|
copy$8(matrix$3, t.localTransform);
|
|
4624
4624
|
multiplyParent$3(matrix$3, transform);
|
|
4625
|
-
L$5.setTransform(t, matrix$3, resize, transition);
|
|
4625
|
+
L$5.setTransform(t, matrix$3, resize, transition, boundsType);
|
|
4626
4626
|
},
|
|
4627
|
-
setTransform(t, transform, resize, transition) {
|
|
4627
|
+
setTransform(t, transform, resize, transition, boundsType) {
|
|
4628
4628
|
const data = t.__, originPoint = data.origin && L$5.getInnerOrigin(t, data.origin);
|
|
4629
4629
|
const layout = getLayout(transform, originPoint, data.around && L$5.getInnerOrigin(t, data.around));
|
|
4630
4630
|
if (L$5.hasOffset(t)) {
|
|
@@ -4640,7 +4640,7 @@ var LeaferUI = function(exports) {
|
|
|
4640
4640
|
PointHelper.move(layout, originPoint.x - changedPoint.x, originPoint.y - changedPoint.y);
|
|
4641
4641
|
}
|
|
4642
4642
|
t.set(layout);
|
|
4643
|
-
t.scaleResize(scaleX, scaleY, false);
|
|
4643
|
+
t.scaleResize(scaleX, scaleY, false, boundsType);
|
|
4644
4644
|
} else t.set(layout, transition);
|
|
4645
4645
|
},
|
|
4646
4646
|
getFlipTransform(t, axis) {
|
|
@@ -4842,11 +4842,11 @@ var LeaferUI = function(exports) {
|
|
|
4842
4842
|
w.height *= scaleY;
|
|
4843
4843
|
w.scaleX *= scaleX;
|
|
4844
4844
|
w.scaleY *= scaleY;
|
|
4845
|
-
if (branch.isBranch) scale$
|
|
4845
|
+
if (branch.isBranch) scale$4(branch, x, y, scaleX, scaleY, a, b);
|
|
4846
4846
|
}
|
|
4847
4847
|
}
|
|
4848
4848
|
};
|
|
4849
|
-
const {pushAllChildBranch: pushAllChildBranch$1, pushAllBranchStack: pushAllBranchStack, updateBoundsByBranchStack: updateBoundsByBranchStack, move: move$9, scale: scale$
|
|
4849
|
+
const {pushAllChildBranch: pushAllChildBranch$1, pushAllBranchStack: pushAllBranchStack, updateBoundsByBranchStack: updateBoundsByBranchStack, move: move$9, scale: scale$4} = BranchHelper;
|
|
4850
4850
|
const WaitHelper = {
|
|
4851
4851
|
run(wait) {
|
|
4852
4852
|
if (wait && wait.length) {
|
|
@@ -5639,7 +5639,7 @@ var LeaferUI = function(exports) {
|
|
|
5639
5639
|
}
|
|
5640
5640
|
};
|
|
5641
5641
|
const {setLayout: setLayout, multiplyParent: multiplyParent$2, translateInner: translateInner, defaultWorld: defaultWorld} = MatrixHelper;
|
|
5642
|
-
const {toPoint: toPoint$4, tempPoint: tempPoint$
|
|
5642
|
+
const {toPoint: toPoint$4, tempPoint: tempPoint$3} = AroundHelper;
|
|
5643
5643
|
const LeafMatrix = {
|
|
5644
5644
|
__updateWorldMatrix() {
|
|
5645
5645
|
const {parent: parent, __layout: __layout, __world: __world, __scrollWorld: __scrollWorld, __: __} = this;
|
|
@@ -5659,8 +5659,8 @@ var LeaferUI = function(exports) {
|
|
|
5659
5659
|
local.e = data.x + data.offsetX;
|
|
5660
5660
|
local.f = data.y + data.offsetY;
|
|
5661
5661
|
if (data.around || data.origin) {
|
|
5662
|
-
toPoint$4(data.around || data.origin, layout.boxBounds, tempPoint$
|
|
5663
|
-
translateInner(local, -tempPoint$
|
|
5662
|
+
toPoint$4(data.around || data.origin, layout.boxBounds, tempPoint$3);
|
|
5663
|
+
translateInner(local, -tempPoint$3.x, -tempPoint$3.y, !data.around);
|
|
5664
5664
|
}
|
|
5665
5665
|
}
|
|
5666
5666
|
this.__layout.matrixChanged = undefined;
|
|
@@ -5689,39 +5689,45 @@ var LeaferUI = function(exports) {
|
|
|
5689
5689
|
this.__updateRenderPath();
|
|
5690
5690
|
this.__updateBoxBounds();
|
|
5691
5691
|
layout.resized = "inner";
|
|
5692
|
-
if (data.__strokeGeometry) data.__strokeGeometry = undefined;
|
|
5693
5692
|
}
|
|
5694
5693
|
if (layout.localBoxChanged) {
|
|
5695
5694
|
if (this.__local) this.__updateLocalBoxBounds();
|
|
5696
5695
|
layout.localBoxChanged = undefined;
|
|
5697
|
-
if (layout.strokeSpread) layout.strokeChanged = true;
|
|
5698
|
-
if (layout.renderSpread) layout.renderChanged = true;
|
|
5696
|
+
if (layout.strokeSpread && !layout.strokeChanged) layout.strokeChanged = layout.boxChanged ? true : 2;
|
|
5697
|
+
if (layout.renderSpread && !layout.renderChanged) layout.renderChanged = layout.boxChanged ? true : 2;
|
|
5699
5698
|
if (this.parent) this.parent.__layout.boxChange();
|
|
5700
5699
|
}
|
|
5701
5700
|
layout.boxChanged = undefined;
|
|
5702
5701
|
if (layout.strokeChanged) {
|
|
5703
|
-
layout.
|
|
5704
|
-
if (layout.strokeSpread) {
|
|
5705
|
-
if (layout.strokeBounds === layout.boxBounds) layout.spreadStroke();
|
|
5706
|
-
this.__updateStrokeBounds();
|
|
5702
|
+
if (layout.strokeChanged === 2) {
|
|
5707
5703
|
this.__updateLocalStrokeBounds();
|
|
5708
5704
|
} else {
|
|
5709
|
-
layout.
|
|
5705
|
+
layout.strokeSpread = this.__updateStrokeSpread();
|
|
5706
|
+
if (layout.strokeSpread) {
|
|
5707
|
+
if (layout.strokeBounds === layout.boxBounds) layout.spreadStroke();
|
|
5708
|
+
this.__updateStrokeBounds();
|
|
5709
|
+
this.__updateLocalStrokeBounds();
|
|
5710
|
+
} else {
|
|
5711
|
+
layout.spreadStrokeCancel();
|
|
5712
|
+
}
|
|
5713
|
+
layout.resized = "inner";
|
|
5714
|
+
if (layout.renderSpread || layout.strokeSpread !== layout.strokeBoxSpread) layout.renderChanged = true;
|
|
5710
5715
|
}
|
|
5711
5716
|
layout.strokeChanged = undefined;
|
|
5712
|
-
if (layout.renderSpread || layout.strokeSpread !== layout.strokeBoxSpread) layout.renderChanged = true;
|
|
5713
5717
|
if (this.parent) this.parent.__layout.strokeChange();
|
|
5714
|
-
layout.resized = "inner";
|
|
5715
|
-
if (data.__strokeGeometry) data.__strokeGeometry = undefined;
|
|
5716
5718
|
}
|
|
5717
5719
|
if (layout.renderChanged) {
|
|
5718
|
-
layout.
|
|
5719
|
-
if (layout.renderSpread) {
|
|
5720
|
-
if (layout.renderBounds === layout.boxBounds || layout.renderBounds === layout.strokeBounds) layout.spreadRender();
|
|
5721
|
-
this.__updateRenderBounds();
|
|
5720
|
+
if (layout.renderChanged === 2) {
|
|
5722
5721
|
this.__updateLocalRenderBounds();
|
|
5723
5722
|
} else {
|
|
5724
|
-
layout.
|
|
5723
|
+
layout.renderSpread = this.__updateRenderSpread();
|
|
5724
|
+
if (layout.renderSpread) {
|
|
5725
|
+
if (layout.renderBounds === layout.boxBounds || layout.renderBounds === layout.strokeBounds) layout.spreadRender();
|
|
5726
|
+
this.__updateRenderBounds();
|
|
5727
|
+
this.__updateLocalRenderBounds();
|
|
5728
|
+
} else {
|
|
5729
|
+
layout.spreadRenderCancel();
|
|
5730
|
+
}
|
|
5725
5731
|
}
|
|
5726
5732
|
layout.renderChanged = undefined;
|
|
5727
5733
|
if (this.parent) this.parent.__layout.renderChange();
|
|
@@ -5875,7 +5881,7 @@ var LeaferUI = function(exports) {
|
|
|
5875
5881
|
};
|
|
5876
5882
|
const {LEAF: LEAF, create: create} = IncrementId;
|
|
5877
5883
|
const {stintSet: stintSet$6} = DataHelper;
|
|
5878
|
-
const {toInnerPoint: toInnerPoint, toOuterPoint: toOuterPoint, multiplyParent: multiplyParent$1} = MatrixHelper;
|
|
5884
|
+
const {toInnerPoint: toInnerPoint, toOuterPoint: toOuterPoint$1, multiplyParent: multiplyParent$1} = MatrixHelper;
|
|
5879
5885
|
const {toOuterOf: toOuterOf$1} = BoundsHelper;
|
|
5880
5886
|
const {copy: copy$5, move: move$8} = PointHelper;
|
|
5881
5887
|
const {getScaleFixedData: getScaleFixedData$1} = MathHelper;
|
|
@@ -6209,7 +6215,7 @@ var LeaferUI = function(exports) {
|
|
|
6209
6215
|
toInnerPoint(this.worldTransform, world, to, distance);
|
|
6210
6216
|
}
|
|
6211
6217
|
innerToWorld(inner, to, distance, relative) {
|
|
6212
|
-
toOuterPoint(this.worldTransform, inner, to, distance);
|
|
6218
|
+
toOuterPoint$1(this.worldTransform, inner, to, distance);
|
|
6213
6219
|
if (relative) relative.worldToInner(to ? to : inner, null, distance);
|
|
6214
6220
|
}
|
|
6215
6221
|
getBoxPoint(world, relative, distance, change) {
|
|
@@ -6264,11 +6270,11 @@ var LeaferUI = function(exports) {
|
|
|
6264
6270
|
const layer = this.leafer ? this.leafer.zoomLayer : this;
|
|
6265
6271
|
return layer.getWorldPoint(page, relative, distance, change);
|
|
6266
6272
|
}
|
|
6267
|
-
setTransform(matrix, resize, transition) {
|
|
6268
|
-
setTransform(this, matrix, resize, transition);
|
|
6273
|
+
setTransform(matrix, resize, transition, boundsType) {
|
|
6274
|
+
setTransform(this, matrix, resize, transition, boundsType);
|
|
6269
6275
|
}
|
|
6270
|
-
transform(matrix, resize, transition) {
|
|
6271
|
-
transform(this, matrix, resize, transition);
|
|
6276
|
+
transform(matrix, resize, transition, boundsType) {
|
|
6277
|
+
transform(this, matrix, resize, transition, boundsType);
|
|
6272
6278
|
}
|
|
6273
6279
|
move(x, y, transition) {
|
|
6274
6280
|
moveLocal(this, x, y, transition);
|
|
@@ -6276,8 +6282,8 @@ var LeaferUI = function(exports) {
|
|
|
6276
6282
|
moveInner(x, y, transition) {
|
|
6277
6283
|
moveWorld(this, x, y, true, transition);
|
|
6278
6284
|
}
|
|
6279
|
-
scaleOf(origin, scaleX, scaleY, resize, transition) {
|
|
6280
|
-
zoomOfLocal(this, getLocalOrigin(this, origin), scaleX, scaleY, resize, transition);
|
|
6285
|
+
scaleOf(origin, scaleX, scaleY, resize, transition, boundsType) {
|
|
6286
|
+
zoomOfLocal(this, getLocalOrigin(this, origin), scaleX, scaleY, resize, transition, boundsType);
|
|
6281
6287
|
}
|
|
6282
6288
|
rotateOf(origin, rotation, transition) {
|
|
6283
6289
|
rotateOfLocal(this, getLocalOrigin(this, origin), rotation, transition);
|
|
@@ -6285,14 +6291,14 @@ var LeaferUI = function(exports) {
|
|
|
6285
6291
|
skewOf(origin, skewX, skewY, resize, transition) {
|
|
6286
6292
|
skewOfLocal(this, getLocalOrigin(this, origin), skewX, skewY, resize, transition);
|
|
6287
6293
|
}
|
|
6288
|
-
transformWorld(worldTransform, resize, transition) {
|
|
6289
|
-
transformWorld(this, worldTransform, resize, transition);
|
|
6294
|
+
transformWorld(worldTransform, resize, transition, boundsType) {
|
|
6295
|
+
transformWorld(this, worldTransform, resize, transition, boundsType);
|
|
6290
6296
|
}
|
|
6291
6297
|
moveWorld(x, y, transition) {
|
|
6292
6298
|
moveWorld(this, x, y, false, transition);
|
|
6293
6299
|
}
|
|
6294
|
-
scaleOfWorld(worldOrigin, scaleX, scaleY, resize, transition) {
|
|
6295
|
-
zoomOfWorld(this, worldOrigin, scaleX, scaleY, resize, transition);
|
|
6300
|
+
scaleOfWorld(worldOrigin, scaleX, scaleY, resize, transition, boundsType) {
|
|
6301
|
+
zoomOfWorld(this, worldOrigin, scaleX, scaleY, resize, transition, boundsType);
|
|
6296
6302
|
}
|
|
6297
6303
|
rotateOfWorld(worldOrigin, rotation) {
|
|
6298
6304
|
rotateOfWorld(this, worldOrigin, rotation);
|
|
@@ -6303,7 +6309,7 @@ var LeaferUI = function(exports) {
|
|
|
6303
6309
|
flip(axis, transition) {
|
|
6304
6310
|
transform(this, getFlipTransform(this, axis), false, transition);
|
|
6305
6311
|
}
|
|
6306
|
-
scaleResize(scaleX, scaleY = scaleX, _noResize) {
|
|
6312
|
+
scaleResize(scaleX, scaleY = scaleX, _noResize, _boundsType) {
|
|
6307
6313
|
this.scaleX *= scaleX;
|
|
6308
6314
|
this.scaleY *= scaleY;
|
|
6309
6315
|
}
|
|
@@ -6668,7 +6674,7 @@ var LeaferUI = function(exports) {
|
|
|
6668
6674
|
this.levelMap = null;
|
|
6669
6675
|
}
|
|
6670
6676
|
}
|
|
6671
|
-
const version = "2.1.
|
|
6677
|
+
const version = "2.1.4";
|
|
6672
6678
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6673
6679
|
get allowBackgroundColor() {
|
|
6674
6680
|
return true;
|
|
@@ -7297,7 +7303,7 @@ var LeaferUI = function(exports) {
|
|
|
7297
7303
|
}
|
|
7298
7304
|
}
|
|
7299
7305
|
Renderer.clipSpread = 10;
|
|
7300
|
-
const tempPoint$
|
|
7306
|
+
const tempPoint$2 = {};
|
|
7301
7307
|
const {copyRadiusPoint: copyRadiusPoint$1} = PointHelper;
|
|
7302
7308
|
const {hitRadiusPoint: hitRadiusPoint$1} = BoundsHelper;
|
|
7303
7309
|
class Picker {
|
|
@@ -7429,7 +7435,7 @@ var LeaferUI = function(exports) {
|
|
|
7429
7435
|
for (let i = len - 1; i > -1; i--) {
|
|
7430
7436
|
child = children[i], data = child.__;
|
|
7431
7437
|
if (!data.visible || hitMask && !data.mask) continue;
|
|
7432
|
-
hit = hitRadiusPoint$1(child.__world, data.hitRadius ? copyRadiusPoint$1(tempPoint$
|
|
7438
|
+
hit = hitRadiusPoint$1(child.__world, data.hitRadius ? copyRadiusPoint$1(tempPoint$2, point, data.hitRadius) : point);
|
|
7433
7439
|
if (child.isBranch) {
|
|
7434
7440
|
if (hit || child.__ignoreHitWorld) {
|
|
7435
7441
|
if (child.isBranchLeaf && data.__clipAfterFill && !child.__hitWorld(point, true)) continue;
|
|
@@ -11036,7 +11042,7 @@ var LeaferUI = function(exports) {
|
|
|
11036
11042
|
needUpdate = false;
|
|
11037
11043
|
}
|
|
11038
11044
|
}
|
|
11039
|
-
if (paint.mode === "brush") PaintImage.brush(leafPaint);
|
|
11045
|
+
if (paint.mode === "brush") PaintImage.brush(leafPaint, ui);
|
|
11040
11046
|
if (!leafPaint.data) {
|
|
11041
11047
|
PaintImage.createData(leafPaint, image, paint, boxBounds);
|
|
11042
11048
|
const {transform: transform} = leafPaint.data, {opacity: opacity} = paint;
|
|
@@ -11231,7 +11237,7 @@ var LeaferUI = function(exports) {
|
|
|
11231
11237
|
if (scaleX) scaleHelper(transform, scaleX, scaleY);
|
|
11232
11238
|
translate(transform, box.x + x, box.y + y);
|
|
11233
11239
|
}
|
|
11234
|
-
const {get: get$1, scale: scale$
|
|
11240
|
+
const {get: get$1, scale: scale$3, copy: copy$4} = MatrixHelper;
|
|
11235
11241
|
const {getFloorScale: getFloorScale} = MathHelper, {abs: abs$7} = Math;
|
|
11236
11242
|
function createPatternTask(paint, ui, canvas, renderOptions) {
|
|
11237
11243
|
if (!paint.patternTask) {
|
|
@@ -11266,11 +11272,15 @@ var LeaferUI = function(exports) {
|
|
|
11266
11272
|
scaleY *= getFloorScale(height + (yGap || 0));
|
|
11267
11273
|
imageMatrix = get$1();
|
|
11268
11274
|
if (transform) copy$4(imageMatrix, transform);
|
|
11269
|
-
scale$
|
|
11275
|
+
scale$3(imageMatrix, 1 / scaleX, 1 / scaleY);
|
|
11270
11276
|
}
|
|
11271
11277
|
const imageCanvas = image.getCanvas(width, height, opacity, undefined, xGap, yGap, ui.leafer && ui.leafer.config.smooth, data.interlace);
|
|
11272
|
-
|
|
11273
|
-
|
|
11278
|
+
if (brush) {
|
|
11279
|
+
paint.style = imageCanvas;
|
|
11280
|
+
PaintImage.cacheBrush(paint, ui, canvas, renderOptions);
|
|
11281
|
+
} else {
|
|
11282
|
+
paint.style = image.getPattern(imageCanvas, data.repeat || (Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
|
|
11283
|
+
}
|
|
11274
11284
|
paint.patternId = id;
|
|
11275
11285
|
}
|
|
11276
11286
|
}
|
|
@@ -12241,10 +12251,11 @@ var LeaferUI = function(exports) {
|
|
|
12241
12251
|
if (innerEditor) innerEditor.editConfig && Object.assign(mergeConfig, innerEditor.editConfig); else if (editTool) editTool.editConfig && Object.assign(mergeConfig, editTool.editConfig);
|
|
12242
12252
|
if (element && element.editConfig) {
|
|
12243
12253
|
let {editConfig: editConfig} = element;
|
|
12244
|
-
if (editConfig.hover || editConfig.hoverStyle) {
|
|
12254
|
+
if (editConfig.hover || editConfig.hoverStyle || editConfig.hoverPathType) {
|
|
12245
12255
|
editConfig = Object.assign({}, editConfig);
|
|
12246
12256
|
delete editConfig.hover;
|
|
12247
12257
|
delete editConfig.hoverStyle;
|
|
12258
|
+
delete editConfig.hoverPathType;
|
|
12248
12259
|
}
|
|
12249
12260
|
Object.assign(mergeConfig, editConfig);
|
|
12250
12261
|
}
|
|
@@ -12305,9 +12316,22 @@ var LeaferUI = function(exports) {
|
|
|
12305
12316
|
matrix$1.half = strokeWidth % 2;
|
|
12306
12317
|
canvas.setWorld(matrix$1, options.matrix);
|
|
12307
12318
|
canvas.beginPath();
|
|
12308
|
-
|
|
12319
|
+
switch (this.strokePathType) {
|
|
12320
|
+
case "box":
|
|
12321
|
+
const {boxBounds: boxBounds} = leaf.__layout;
|
|
12322
|
+
canvas.rect(boxBounds.x, boxBounds.y, boxBounds.width, boxBounds.height);
|
|
12323
|
+
break;
|
|
12324
|
+
|
|
12325
|
+
case "stroke":
|
|
12326
|
+
const {strokeBounds: strokeBounds} = leaf.__layout;
|
|
12327
|
+
canvas.rect(strokeBounds.x, strokeBounds.y, strokeBounds.width, strokeBounds.height);
|
|
12328
|
+
break;
|
|
12329
|
+
|
|
12330
|
+
case "path":
|
|
12309
12331
|
leaf.__drawPath(canvas);
|
|
12310
|
-
|
|
12332
|
+
break;
|
|
12333
|
+
|
|
12334
|
+
default:
|
|
12311
12335
|
if (leaf.__.__useArrow) leaf.__drawPath(canvas); else leaf.__.__pathForRender ? leaf.__drawRenderPath(canvas) : leaf.__drawPathByBox(canvas);
|
|
12312
12336
|
}
|
|
12313
12337
|
data.strokeWidth = strokeWidth / Math.max(aScaleX, aScaleY);
|
|
@@ -12422,10 +12446,11 @@ var LeaferUI = function(exports) {
|
|
|
12422
12446
|
if (this.running && !this.dragging && !editor.dragging) {
|
|
12423
12447
|
const {hoverTarget: hoverTarget, mergeConfig: mergeConfig} = editor, config = Object.assign({}, mergeConfig);
|
|
12424
12448
|
if (hoverTarget && hoverTarget.editConfig) Object.assign(config, hoverTarget.editConfig);
|
|
12425
|
-
const {stroke: stroke, strokeWidth: strokeWidth, hover: hover, hoverStyle: hoverStyle} = config;
|
|
12449
|
+
const {stroke: stroke, strokeWidth: strokeWidth, hover: hover, hoverStyle: hoverStyle, hoverPathType: hoverPathType} = config;
|
|
12426
12450
|
this.hoverStroker.setTarget(hover ? hoverTarget : null, Object.assign({
|
|
12427
12451
|
stroke: stroke,
|
|
12428
|
-
strokeWidth: strokeWidth
|
|
12452
|
+
strokeWidth: strokeWidth,
|
|
12453
|
+
strokePathType: hoverPathType
|
|
12429
12454
|
}, hoverStyle || {}));
|
|
12430
12455
|
} else {
|
|
12431
12456
|
this.hoverStroker.target = null;
|
|
@@ -12605,16 +12630,17 @@ var LeaferUI = function(exports) {
|
|
|
12605
12630
|
const {topLeft: topLeft$1, top: top$1, topRight: topRight$1, right: right$2, bottomRight: bottomRight, bottom: bottom$1, bottomLeft: bottomLeft, left: left$2} = exports.Direction9;
|
|
12606
12631
|
const {toPoint: toPoint} = AroundHelper, {within: within$3, sign: sign$1} = MathHelper, {abs: abs$4} = Math;
|
|
12607
12632
|
const EditDataHelper = {
|
|
12608
|
-
getScaleData(target, startBounds, direction, totalMoveOrScale, lockRatio, around, flipable, scaleMode) {
|
|
12633
|
+
getScaleData(target, startBounds, direction, totalMoveOrScale, lockRatio, around, flipable, scaleMode, boundsType) {
|
|
12609
12634
|
let align, origin = {}, scaleX = 1, scaleY = 1, lockScale;
|
|
12610
|
-
const {
|
|
12635
|
+
const {widthRange: widthRange, heightRange: heightRange, dragBounds: dragBounds, worldTransform: worldTransform, boxBounds: boxBounds} = target;
|
|
12611
12636
|
const {width: width, height: height} = startBounds;
|
|
12637
|
+
const innerBounds = target.getBounds(boundsType, "inner");
|
|
12612
12638
|
const originChangedScaleX = target.scaleX / startBounds.scaleX;
|
|
12613
12639
|
const originChangedScaleY = target.scaleY / startBounds.scaleY;
|
|
12614
12640
|
const signX = sign$1(originChangedScaleX);
|
|
12615
12641
|
const signY = sign$1(originChangedScaleY);
|
|
12616
|
-
const changedScaleX = scaleMode ? originChangedScaleX : signX *
|
|
12617
|
-
const changedScaleY = scaleMode ? originChangedScaleY : signY *
|
|
12642
|
+
const changedScaleX = scaleMode ? originChangedScaleX : signX * innerBounds.width / width;
|
|
12643
|
+
const changedScaleY = scaleMode ? originChangedScaleY : signY * innerBounds.height / height;
|
|
12618
12644
|
if (isNumber(totalMoveOrScale)) {
|
|
12619
12645
|
scaleX = scaleY = Math.sqrt(totalMoveOrScale);
|
|
12620
12646
|
} else {
|
|
@@ -12700,10 +12726,11 @@ var LeaferUI = function(exports) {
|
|
|
12700
12726
|
if (useScaleY) scaleY /= changedScaleY;
|
|
12701
12727
|
if (!flipable) {
|
|
12702
12728
|
const {worldTransform: worldTransform} = target;
|
|
12703
|
-
if (scaleX < 0) scaleX = 1 /
|
|
12704
|
-
if (scaleY < 0) scaleY = 1 /
|
|
12729
|
+
if (scaleX < 0) scaleX = 1 / innerBounds.width / worldTransform.scaleX;
|
|
12730
|
+
if (scaleY < 0) scaleY = 1 / innerBounds.height / worldTransform.scaleY;
|
|
12705
12731
|
}
|
|
12706
|
-
toPoint(around || align,
|
|
12732
|
+
toPoint(around || align, innerBounds, origin, true);
|
|
12733
|
+
this.checkOrigin(target, origin, boundsType);
|
|
12707
12734
|
if (dragBounds) {
|
|
12708
12735
|
const scaleData = {
|
|
12709
12736
|
x: scaleX,
|
|
@@ -12714,15 +12741,20 @@ var LeaferUI = function(exports) {
|
|
|
12714
12741
|
scaleY = scaleData.y;
|
|
12715
12742
|
}
|
|
12716
12743
|
if (useScaleX && widthRange) {
|
|
12717
|
-
const nowWidth =
|
|
12744
|
+
const nowWidth = innerBounds.width * target.scaleX;
|
|
12718
12745
|
scaleX = within$3(nowWidth * scaleX, widthRange) / nowWidth;
|
|
12719
12746
|
}
|
|
12720
12747
|
if (useScaleY && heightRange) {
|
|
12721
|
-
const nowHeight =
|
|
12748
|
+
const nowHeight = innerBounds.height * target.scaleY;
|
|
12722
12749
|
scaleY = within$3(nowHeight * scaleY, heightRange) / nowHeight;
|
|
12723
12750
|
}
|
|
12724
|
-
|
|
12725
|
-
if (
|
|
12751
|
+
let minWidth = 1 * abs$4(worldTransform.scaleX), minHeight = 1 * abs$4(worldTransform.scaleY);
|
|
12752
|
+
if (boundsType !== "box") {
|
|
12753
|
+
minWidth += innerBounds.width - boxBounds.width;
|
|
12754
|
+
minHeight += innerBounds.height - boxBounds.height;
|
|
12755
|
+
}
|
|
12756
|
+
if (useScaleX && abs$4(scaleX * innerBounds.width) < minWidth) scaleX = sign$1(scaleX) * minWidth / innerBounds.width;
|
|
12757
|
+
if (useScaleY && abs$4(scaleY * innerBounds.height) < minHeight) scaleY = sign$1(scaleY) * minHeight / innerBounds.height;
|
|
12726
12758
|
if (lockRatio && scaleX !== scaleY) {
|
|
12727
12759
|
lockScale = Math.min(abs$4(scaleX), abs$4(scaleY));
|
|
12728
12760
|
scaleX = sign$1(scaleX) * lockScale;
|
|
@@ -12739,7 +12771,7 @@ var LeaferUI = function(exports) {
|
|
|
12739
12771
|
around: around
|
|
12740
12772
|
};
|
|
12741
12773
|
},
|
|
12742
|
-
getRotateData(target, direction, current, last, around) {
|
|
12774
|
+
getRotateData(target, direction, current, last, around, boundsType) {
|
|
12743
12775
|
let align, origin = {};
|
|
12744
12776
|
switch (direction) {
|
|
12745
12777
|
case topLeft$1:
|
|
@@ -12761,13 +12793,14 @@ var LeaferUI = function(exports) {
|
|
|
12761
12793
|
default:
|
|
12762
12794
|
align = "center";
|
|
12763
12795
|
}
|
|
12764
|
-
toPoint(around || align, target.
|
|
12796
|
+
toPoint(around || align, target.getBounds(boundsType, "inner"), origin, true);
|
|
12797
|
+
this.checkOrigin(target, origin, boundsType);
|
|
12765
12798
|
return {
|
|
12766
12799
|
origin: origin,
|
|
12767
12800
|
rotation: PointHelper.getRotation(last, target.getWorldPointByBox(origin), current)
|
|
12768
12801
|
};
|
|
12769
12802
|
},
|
|
12770
|
-
getSkewData(
|
|
12803
|
+
getSkewData(target, direction, move, around, boundsType) {
|
|
12771
12804
|
let align, origin = {}, skewX = 0, skewY = 0;
|
|
12772
12805
|
let last;
|
|
12773
12806
|
switch (direction) {
|
|
@@ -12810,10 +12843,12 @@ var LeaferUI = function(exports) {
|
|
|
12810
12843
|
align = "left";
|
|
12811
12844
|
skewY = 1;
|
|
12812
12845
|
}
|
|
12813
|
-
const
|
|
12846
|
+
const innerBounds = target.getBounds(boundsType, "inner");
|
|
12847
|
+
const {width: width, height: height} = innerBounds;
|
|
12814
12848
|
last.x = last.x * width;
|
|
12815
12849
|
last.y = last.y * height;
|
|
12816
|
-
toPoint(around || align,
|
|
12850
|
+
toPoint(around || align, innerBounds, origin, true);
|
|
12851
|
+
this.checkOrigin(target, origin, boundsType);
|
|
12817
12852
|
const rotation = PointHelper.getRotation(last, origin, {
|
|
12818
12853
|
x: last.x + (skewX ? move.x : 0),
|
|
12819
12854
|
y: last.y + (skewY ? move.y : 0)
|
|
@@ -12825,6 +12860,13 @@ var LeaferUI = function(exports) {
|
|
|
12825
12860
|
skewY: skewY
|
|
12826
12861
|
};
|
|
12827
12862
|
},
|
|
12863
|
+
checkOrigin(target, origin, boundsType) {
|
|
12864
|
+
if (boundsType !== "box") {
|
|
12865
|
+
const {boxBounds: boxBounds} = target, innerBounds = target.getBounds(boundsType, "inner");
|
|
12866
|
+
origin.x += innerBounds.x - boxBounds.x;
|
|
12867
|
+
origin.y += innerBounds.y - boxBounds.y;
|
|
12868
|
+
}
|
|
12869
|
+
},
|
|
12828
12870
|
getAround(around, altKey) {
|
|
12829
12871
|
return altKey && !around ? "center" : around;
|
|
12830
12872
|
},
|
|
@@ -13088,8 +13130,8 @@ var LeaferUI = function(exports) {
|
|
|
13088
13130
|
updateMoveCursor(this);
|
|
13089
13131
|
}
|
|
13090
13132
|
update() {
|
|
13091
|
-
const {editor: editor} = this;
|
|
13092
|
-
const {x: x, y: y, scaleX: scaleX, scaleY: scaleY, rotation: rotation, skewX: skewX, skewY: skewY, width: width, height: height} = this.target.getLayoutBounds(
|
|
13133
|
+
const {editor: editor, mergeConfig: mergeConfig} = this;
|
|
13134
|
+
const {x: x, y: y, scaleX: scaleX, scaleY: scaleY, rotation: rotation, skewX: skewX, skewY: skewY, width: width, height: height} = this.target.getLayoutBounds(mergeConfig.editBoxType, editor, true);
|
|
13093
13135
|
this.visible = !this.target.locked;
|
|
13094
13136
|
this.set({
|
|
13095
13137
|
x: x,
|
|
@@ -13112,9 +13154,9 @@ var LeaferUI = function(exports) {
|
|
|
13112
13154
|
if (this.app) this.rect.syncEventer = this.app.interaction.bottomList = null;
|
|
13113
13155
|
}
|
|
13114
13156
|
updateBounds(bounds) {
|
|
13115
|
-
const {editor: editor,
|
|
13157
|
+
const {editor: editor, mergedConfig: mergedConfig, single: single, rect: rect, circle: circle, buttons: buttons, resizePoints: resizePoints, rotatePoints: rotatePoints, resizeLines: resizeLines} = this;
|
|
13116
13158
|
const {editMask: editMask} = editor;
|
|
13117
|
-
const {middlePoint: middlePoint, resizeable: resizeable, rotateable: rotateable, hideOnSmall: hideOnSmall, editBox: editBox, mask: mask, dimOthers: dimOthers, bright: bright, spread: spread, hideRotatePoints: hideRotatePoints, hideResizeLines: hideResizeLines} =
|
|
13159
|
+
const {middlePoint: middlePoint, resizeable: resizeable, rotateable: rotateable, hideOnSmall: hideOnSmall, editBox: editBox, mask: mask, dimOthers: dimOthers, bright: bright, spread: spread, hideRotatePoints: hideRotatePoints, hideResizeLines: hideResizeLines} = mergedConfig;
|
|
13118
13160
|
editMask.visible = mask ? true : 0;
|
|
13119
13161
|
if (!isUndefined(dimOthers) || !isUndefined(bright)) {
|
|
13120
13162
|
editor.setDimOthers(dimOthers);
|
|
@@ -13152,7 +13194,7 @@ var LeaferUI = function(exports) {
|
|
|
13152
13194
|
}
|
|
13153
13195
|
}
|
|
13154
13196
|
}
|
|
13155
|
-
circle.visible = showPoints && rotateable && !!(
|
|
13197
|
+
circle.visible = showPoints && rotateable && !!(mergedConfig.circle || mergedConfig.rotatePoint);
|
|
13156
13198
|
if (circle.visible) this.layoutCircle();
|
|
13157
13199
|
if (rect.path) rect.path = null;
|
|
13158
13200
|
rect.set(Object.assign(Object.assign({}, bounds), {
|
|
@@ -13260,7 +13302,8 @@ var LeaferUI = function(exports) {
|
|
|
13260
13302
|
this.dragPoint = null;
|
|
13261
13303
|
}
|
|
13262
13304
|
onTransformStart(e) {
|
|
13263
|
-
|
|
13305
|
+
const {hideOnMove: hideOnMove, editBoxType: editBoxType} = this.mergedConfig;
|
|
13306
|
+
if (this.moving || this.gesturing) this.editor.opacity = hideOnMove ? 0 : 1;
|
|
13264
13307
|
if (this.resizing) ResizeEvent.resizingKeys = this.editor.leafList.keys;
|
|
13265
13308
|
const {dragStartData: dragStartData, target: target} = this;
|
|
13266
13309
|
dragStartData.x = e.x;
|
|
@@ -13270,7 +13313,7 @@ var LeaferUI = function(exports) {
|
|
|
13270
13313
|
x: target.x,
|
|
13271
13314
|
y: target.y
|
|
13272
13315
|
};
|
|
13273
|
-
dragStartData.bounds = Object.assign({}, target.getLayoutBounds(
|
|
13316
|
+
dragStartData.bounds = Object.assign({}, target.getLayoutBounds(editBoxType, "local"));
|
|
13274
13317
|
dragStartData.rotation = target.rotation;
|
|
13275
13318
|
}
|
|
13276
13319
|
onTransformEnd(e) {
|
|
@@ -13501,6 +13544,7 @@ var LeaferUI = function(exports) {
|
|
|
13501
13544
|
},
|
|
13502
13545
|
selector: true,
|
|
13503
13546
|
editBox: true,
|
|
13547
|
+
editBoxType: "box",
|
|
13504
13548
|
hover: true,
|
|
13505
13549
|
select: "press",
|
|
13506
13550
|
openInner: "double",
|
|
@@ -13783,7 +13827,7 @@ var LeaferUI = function(exports) {
|
|
|
13783
13827
|
}
|
|
13784
13828
|
onScale(e) {
|
|
13785
13829
|
const {target: target, mergeConfig: mergeConfig, single: single, dragStartData: dragStartData} = this.editBox;
|
|
13786
|
-
let {around: around, lockRatio: lockRatio, flipable: flipable, editSize: editSize} = mergeConfig, totalMove;
|
|
13830
|
+
let {around: around, lockRatio: lockRatio, flipable: flipable, editSize: editSize, editBoxType: editBoxType} = mergeConfig, totalMove;
|
|
13787
13831
|
if (e instanceof exports.ZoomEvent) {
|
|
13788
13832
|
if (!around) around = target.getBoxPoint(e);
|
|
13789
13833
|
totalMove = e.totalScale;
|
|
@@ -13792,7 +13836,7 @@ var LeaferUI = function(exports) {
|
|
|
13792
13836
|
}
|
|
13793
13837
|
const {direction: direction} = e.current;
|
|
13794
13838
|
if (e.shiftKey || target.lockRatio) lockRatio = true;
|
|
13795
|
-
const data = EditDataHelper.getScaleData(target, dragStartData.bounds, direction, totalMove, lockRatio, EditDataHelper.getAround(around, e.altKey), flipable, !single || editSize === "scale");
|
|
13839
|
+
const data = EditDataHelper.getScaleData(target, dragStartData.bounds, direction, totalMove, lockRatio, EditDataHelper.getAround(around, e.altKey), flipable, !single || editSize === "scale", editBoxType);
|
|
13796
13840
|
const targetX = target.x, targetY = target.y;
|
|
13797
13841
|
if (e instanceof exports.DragEvent && this.editTool && this.editTool.onScaleWithDrag) {
|
|
13798
13842
|
data.drag = e;
|
|
@@ -13804,7 +13848,7 @@ var LeaferUI = function(exports) {
|
|
|
13804
13848
|
}
|
|
13805
13849
|
onRotate(e) {
|
|
13806
13850
|
const {target: target, mergeConfig: mergeConfig, dragStartData: dragStartData} = this.editBox;
|
|
13807
|
-
const {around: around, rotateAround: rotateAround, rotateGap: rotateGap, diagonalRotateKey: diagonalRotateKey} = mergeConfig;
|
|
13851
|
+
const {around: around, rotateAround: rotateAround, rotateGap: rotateGap, diagonalRotateKey: diagonalRotateKey, editBoxType: editBoxType} = mergeConfig;
|
|
13808
13852
|
const {direction: direction} = e.current;
|
|
13809
13853
|
let origin, rotation;
|
|
13810
13854
|
if (e instanceof exports.RotateEvent) {
|
|
@@ -13812,7 +13856,7 @@ var LeaferUI = function(exports) {
|
|
|
13812
13856
|
origin = rotateAround ? AroundHelper.getPoint(rotateAround, target.boxBounds) : target.getBoxPoint(e);
|
|
13813
13857
|
} else {
|
|
13814
13858
|
const isDiagonalRotate = diagonalRotateKey ? e.isHoldKeys(diagonalRotateKey) : e.shiftKey;
|
|
13815
|
-
const data = EditDataHelper.getRotateData(target, direction, e, dragStartData, isDiagonalRotate ? null : rotateAround || target.around || target.origin || around || "center");
|
|
13859
|
+
const data = EditDataHelper.getRotateData(target, direction, e, dragStartData, isDiagonalRotate ? null : rotateAround || target.around || target.origin || around || "center", editBoxType);
|
|
13816
13860
|
rotation = dragStartData.rotation + data.rotation - target.rotation;
|
|
13817
13861
|
origin = data.origin;
|
|
13818
13862
|
}
|
|
@@ -13824,8 +13868,8 @@ var LeaferUI = function(exports) {
|
|
|
13824
13868
|
}
|
|
13825
13869
|
onSkew(e) {
|
|
13826
13870
|
const {target: target, mergeConfig: mergeConfig} = this.editBox;
|
|
13827
|
-
const {around: around} = mergeConfig;
|
|
13828
|
-
const {origin: origin, skewX: skewX, skewY: skewY} = EditDataHelper.getSkewData(target
|
|
13871
|
+
const {around: around, editBoxType: editBoxType} = mergeConfig;
|
|
13872
|
+
const {origin: origin, skewX: skewX, skewY: skewY} = EditDataHelper.getSkewData(target, e.current.direction, e.getInnerMove(target), EditDataHelper.getAround(around, e.altKey), editBoxType);
|
|
13829
13873
|
if (!skewX && !skewY) return;
|
|
13830
13874
|
this.skewOf(origin, skewX, skewY);
|
|
13831
13875
|
}
|
|
@@ -13886,7 +13930,7 @@ var LeaferUI = function(exports) {
|
|
|
13886
13930
|
scaleOf(origin, scaleX, scaleY = scaleX, _resize) {
|
|
13887
13931
|
if (!this.checkTransform("resizeable")) return;
|
|
13888
13932
|
const {target: target, mergeConfig: mergeConfig, single: single, editor: editor} = this.editBox;
|
|
13889
|
-
const {beforeScale: beforeScale} = mergeConfig;
|
|
13933
|
+
const {beforeScale: beforeScale, editBoxType: editBoxType} = mergeConfig;
|
|
13890
13934
|
if (beforeScale) {
|
|
13891
13935
|
const check = beforeScale({
|
|
13892
13936
|
target: target,
|
|
@@ -13904,7 +13948,8 @@ var LeaferUI = function(exports) {
|
|
|
13904
13948
|
worldOrigin: worldOrigin,
|
|
13905
13949
|
scaleX: scaleX,
|
|
13906
13950
|
scaleY: scaleY,
|
|
13907
|
-
transform: transform
|
|
13951
|
+
transform: transform,
|
|
13952
|
+
editBoxType: editBoxType
|
|
13908
13953
|
};
|
|
13909
13954
|
this.emitEvent(new EditorScaleEvent(EditorScaleEvent.BEFORE_SCALE, data));
|
|
13910
13955
|
const event = new EditorScaleEvent(EditorScaleEvent.SCALE, data);
|
|
@@ -13932,7 +13977,7 @@ var LeaferUI = function(exports) {
|
|
|
13932
13977
|
rotateOf(origin, rotation) {
|
|
13933
13978
|
if (!this.checkTransform("rotateable")) return;
|
|
13934
13979
|
const {target: target, mergeConfig: mergeConfig, single: single, editor: editor} = this.editBox;
|
|
13935
|
-
const {beforeRotate: beforeRotate} = mergeConfig;
|
|
13980
|
+
const {beforeRotate: beforeRotate, editBoxType: editBoxType} = mergeConfig;
|
|
13936
13981
|
if (beforeRotate) {
|
|
13937
13982
|
const check = beforeRotate({
|
|
13938
13983
|
target: target,
|
|
@@ -13948,7 +13993,8 @@ var LeaferUI = function(exports) {
|
|
|
13948
13993
|
editor: editor,
|
|
13949
13994
|
worldOrigin: worldOrigin,
|
|
13950
13995
|
rotation: rotation,
|
|
13951
|
-
transform: transform
|
|
13996
|
+
transform: transform,
|
|
13997
|
+
editBoxType: editBoxType
|
|
13952
13998
|
};
|
|
13953
13999
|
this.emitEvent(new EditorRotateEvent(EditorRotateEvent.BEFORE_ROTATE, data));
|
|
13954
14000
|
const event = new EditorRotateEvent(EditorRotateEvent.ROTATE, data);
|
|
@@ -13958,7 +14004,7 @@ var LeaferUI = function(exports) {
|
|
|
13958
14004
|
skewOf(origin, skewX, skewY = 0, _resize) {
|
|
13959
14005
|
if (!this.checkTransform("skewable")) return;
|
|
13960
14006
|
const {target: target, mergeConfig: mergeConfig, single: single, editor: editor} = this.editBox;
|
|
13961
|
-
const {beforeSkew: beforeSkew} = mergeConfig;
|
|
14007
|
+
const {beforeSkew: beforeSkew, editBoxType: editBoxType} = mergeConfig;
|
|
13962
14008
|
if (beforeSkew) {
|
|
13963
14009
|
const check = beforeSkew({
|
|
13964
14010
|
target: target,
|
|
@@ -13976,7 +14022,8 @@ var LeaferUI = function(exports) {
|
|
|
13976
14022
|
worldOrigin: worldOrigin,
|
|
13977
14023
|
skewX: skewX,
|
|
13978
14024
|
skewY: skewY,
|
|
13979
|
-
transform: transform
|
|
14025
|
+
transform: transform,
|
|
14026
|
+
editBoxType: editBoxType
|
|
13980
14027
|
};
|
|
13981
14028
|
this.emitEvent(new EditorSkewEvent(EditorSkewEvent.BEFORE_SKEW, data));
|
|
13982
14029
|
const event = new EditorSkewEvent(EditorSkewEvent.SKEW, data);
|
|
@@ -14418,32 +14465,32 @@ var LeaferUI = function(exports) {
|
|
|
14418
14465
|
app.unlockLayout();
|
|
14419
14466
|
}
|
|
14420
14467
|
onScale(e) {
|
|
14421
|
-
const {scaleX: scaleX, scaleY: scaleY, transform: transform, worldOrigin: worldOrigin, editor: editor} = e;
|
|
14468
|
+
const {scaleX: scaleX, scaleY: scaleY, transform: transform, worldOrigin: worldOrigin, editor: editor, editBoxType: editBoxType} = e;
|
|
14422
14469
|
const {app: app, list: list} = editor;
|
|
14423
14470
|
app.lockLayout();
|
|
14424
14471
|
list.forEach(target => {
|
|
14425
14472
|
const resize = editor.getEditSize(target) !== "scale";
|
|
14426
|
-
if (transform) target.transformWorld(transform, resize); else target.scaleOfWorld(worldOrigin, scaleX, scaleY, resize);
|
|
14473
|
+
if (transform) target.transformWorld(transform, resize, false, editBoxType); else target.scaleOfWorld(worldOrigin, scaleX, scaleY, resize, false, editBoxType);
|
|
14427
14474
|
});
|
|
14428
14475
|
app.unlockLayout();
|
|
14429
14476
|
}
|
|
14430
14477
|
onRotate(e) {
|
|
14431
|
-
const {rotation: rotation, transform: transform, worldOrigin: worldOrigin, editor: editor} = e;
|
|
14478
|
+
const {rotation: rotation, transform: transform, worldOrigin: worldOrigin, editor: editor, editBoxType: editBoxType} = e;
|
|
14432
14479
|
const {app: app, list: list} = editor;
|
|
14433
14480
|
app.lockLayout();
|
|
14434
14481
|
list.forEach(target => {
|
|
14435
14482
|
const resize = editor.getEditSize(target) !== "scale";
|
|
14436
|
-
if (transform) target.transformWorld(transform, resize); else target.rotateOfWorld(worldOrigin, rotation);
|
|
14483
|
+
if (transform) target.transformWorld(transform, resize, false, editBoxType); else target.rotateOfWorld(worldOrigin, rotation);
|
|
14437
14484
|
});
|
|
14438
14485
|
app.unlockLayout();
|
|
14439
14486
|
}
|
|
14440
14487
|
onSkew(e) {
|
|
14441
|
-
const {skewX: skewX, skewY: skewY, transform: transform, worldOrigin: worldOrigin, editor: editor} = e;
|
|
14488
|
+
const {skewX: skewX, skewY: skewY, transform: transform, worldOrigin: worldOrigin, editor: editor, editBoxType: editBoxType} = e;
|
|
14442
14489
|
const {app: app, list: list} = editor;
|
|
14443
14490
|
app.lockLayout();
|
|
14444
14491
|
list.forEach(target => {
|
|
14445
14492
|
const resize = editor.getEditSize(target) !== "scale";
|
|
14446
|
-
if (transform) target.transformWorld(transform, resize); else target.skewOfWorld(worldOrigin, skewX, skewY, resize);
|
|
14493
|
+
if (transform) target.transformWorld(transform, resize, false, editBoxType); else target.skewOfWorld(worldOrigin, skewX, skewY, resize);
|
|
14447
14494
|
});
|
|
14448
14495
|
app.unlockLayout();
|
|
14449
14496
|
}
|
|
@@ -14724,15 +14771,26 @@ var LeaferUI = function(exports) {
|
|
|
14724
14771
|
children[i].transform(matrix, true);
|
|
14725
14772
|
}
|
|
14726
14773
|
}
|
|
14727
|
-
const leaf = exports.Leaf.prototype;
|
|
14728
|
-
leaf.scaleResize = function(scaleX, scaleY = scaleX, noResize) {
|
|
14774
|
+
const leaf = exports.Leaf.prototype, tempPoint$1 = {}, {scale: scale$2, toOuterPoint: toOuterPoint} = MatrixHelper;
|
|
14775
|
+
leaf.scaleResize = function(scaleX, scaleY = scaleX, noResize, boundsType) {
|
|
14729
14776
|
const data = this;
|
|
14730
14777
|
if (noResize || data.editConfig && data.editConfig.editSize === "scale") {
|
|
14731
14778
|
data.scaleX *= scaleX;
|
|
14732
14779
|
data.scaleY *= scaleY;
|
|
14733
14780
|
} else {
|
|
14734
|
-
|
|
14735
|
-
if (
|
|
14781
|
+
const local = this.__localMatrix;
|
|
14782
|
+
if (scaleX < 0) data.scaleX *= -1, scaleX = -scaleX, scale$2(local, -1, 1);
|
|
14783
|
+
if (scaleY < 0) data.scaleY *= -1, scaleY = -scaleY, scale$2(local, 1, -1);
|
|
14784
|
+
if (boundsType === "stroke") {
|
|
14785
|
+
const {boxBounds: boxBounds, strokeBounds: strokeBounds} = this.__layout, {x: x, y: y, width: width, height: height} = strokeBounds;
|
|
14786
|
+
tempPoint$1.x = (x - boxBounds.x) * (scaleX - 1);
|
|
14787
|
+
tempPoint$1.y = (y - boxBounds.y) * (scaleY - 1);
|
|
14788
|
+
toOuterPoint(local, tempPoint$1, tempPoint$1, true);
|
|
14789
|
+
this.x += tempPoint$1.x;
|
|
14790
|
+
this.y += tempPoint$1.y;
|
|
14791
|
+
scaleX = (width * scaleX - (width - boxBounds.width)) / boxBounds.width;
|
|
14792
|
+
scaleY = (height * scaleY - (height - boxBounds.height)) / boxBounds.height;
|
|
14793
|
+
}
|
|
14736
14794
|
this.__scaleResize(scaleX, scaleY);
|
|
14737
14795
|
}
|
|
14738
14796
|
};
|
|
@@ -19918,7 +19976,7 @@ var LeaferUI = function(exports) {
|
|
|
19918
19976
|
exports.surfaceType = surfaceType;
|
|
19919
19977
|
exports.tempBounds = tempBounds$3;
|
|
19920
19978
|
exports.tempMatrix = tempMatrix$2;
|
|
19921
|
-
exports.tempPoint = tempPoint$
|
|
19979
|
+
exports.tempPoint = tempPoint$5;
|
|
19922
19980
|
exports.tryToNumber = tryToNumber;
|
|
19923
19981
|
exports.useCanvas = useCanvas;
|
|
19924
19982
|
exports.useModule = useModule;
|