@leafer/worker 2.1.3 → 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 +160 -111
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +160 -111
- 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,7 +2850,8 @@ 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
|
+
if (char === "m") current.name = PathCommandMap["l"]; else if (char === "M") current.name = PathCommandMap["L"];
|
|
2854
|
+
if (!needConvert && convertCommand[char]) needConvert = true;
|
|
2854
2855
|
} else {
|
|
2855
2856
|
if (char === "-" || char === "+") {
|
|
2856
2857
|
if (lastChar === "e" || lastChar === "E") {
|
|
@@ -2926,8 +2927,8 @@ var LeaferUI = function(exports) {
|
|
|
2926
2927
|
|
|
2927
2928
|
case S$1:
|
|
2928
2929
|
smooth = lastCommand === C$8 || lastCommand === S$1;
|
|
2929
|
-
x1 = smooth ? x * 2 - controlX :
|
|
2930
|
-
y1 = smooth ? y * 2 - controlY :
|
|
2930
|
+
x1 = smooth ? x * 2 - controlX : x;
|
|
2931
|
+
y1 = smooth ? y * 2 - controlY : y;
|
|
2931
2932
|
controlX = old[i + 1];
|
|
2932
2933
|
controlY = old[i + 2];
|
|
2933
2934
|
x = old[i + 3];
|
|
@@ -2961,8 +2962,8 @@ var LeaferUI = function(exports) {
|
|
|
2961
2962
|
|
|
2962
2963
|
case T:
|
|
2963
2964
|
smooth = lastCommand === Q$6 || lastCommand === T;
|
|
2964
|
-
controlX = smooth ? x * 2 - controlX :
|
|
2965
|
-
controlY = smooth ? y * 2 - controlY :
|
|
2965
|
+
controlX = smooth ? x * 2 - controlX : x;
|
|
2966
|
+
controlY = smooth ? y * 2 - controlY : y;
|
|
2966
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]);
|
|
2967
2968
|
x = old[i + 1];
|
|
2968
2969
|
y = old[i + 2];
|
|
@@ -4474,7 +4475,7 @@ var LeaferUI = function(exports) {
|
|
|
4474
4475
|
EventCreator.register(target);
|
|
4475
4476
|
};
|
|
4476
4477
|
}
|
|
4477
|
-
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;
|
|
4478
4479
|
const matrix$3 = {}, {round: round$3} = Math;
|
|
4479
4480
|
const LeafHelper = {
|
|
4480
4481
|
updateAllMatrix(leaf, checkAutoLayout, waitAutoLayout) {
|
|
@@ -4555,7 +4556,7 @@ var LeaferUI = function(exports) {
|
|
|
4555
4556
|
x: x,
|
|
4556
4557
|
y: y
|
|
4557
4558
|
};
|
|
4558
|
-
isInnerPoint ? toOuterPoint$
|
|
4559
|
+
isInnerPoint ? toOuterPoint$2(t.localTransform, local, local, true) : t.parent && toInnerPoint$1(t.parent.scrollWorldTransform, local, local, true);
|
|
4559
4560
|
L$5.moveLocal(t, local.x, local.y, transition);
|
|
4560
4561
|
},
|
|
4561
4562
|
moveLocal(t, x, y = 0, transition) {
|
|
@@ -4568,10 +4569,10 @@ var LeaferUI = function(exports) {
|
|
|
4568
4569
|
y: y
|
|
4569
4570
|
}, transition) : (t.x = x, t.y = y);
|
|
4570
4571
|
},
|
|
4571
|
-
zoomOfWorld(t, origin, scaleX, scaleY, resize, transition) {
|
|
4572
|
-
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);
|
|
4573
4574
|
},
|
|
4574
|
-
zoomOfLocal(t, origin, scaleX, scaleY = scaleX, resize, transition) {
|
|
4575
|
+
zoomOfLocal(t, origin, scaleX, scaleY = scaleX, resize, transition, boundsType) {
|
|
4575
4576
|
const o = t.__localMatrix;
|
|
4576
4577
|
if (!isNumber(scaleY)) {
|
|
4577
4578
|
if (scaleY) transition = scaleY;
|
|
@@ -4580,7 +4581,7 @@ var LeaferUI = function(exports) {
|
|
|
4580
4581
|
copy$8(matrix$3, o);
|
|
4581
4582
|
scaleOfOuter$2(matrix$3, origin, scaleX, scaleY);
|
|
4582
4583
|
if (L$5.hasHighPosition(t)) {
|
|
4583
|
-
L$5.setTransform(t, matrix$3, resize, transition);
|
|
4584
|
+
L$5.setTransform(t, matrix$3, resize, transition, boundsType);
|
|
4584
4585
|
} else {
|
|
4585
4586
|
const x = t.x + matrix$3.e - o.e, y = t.y + matrix$3.f - o.f;
|
|
4586
4587
|
if (transition && !resize) t.animate({
|
|
@@ -4588,7 +4589,7 @@ var LeaferUI = function(exports) {
|
|
|
4588
4589
|
y: y,
|
|
4589
4590
|
scaleX: t.scaleX * scaleX,
|
|
4590
4591
|
scaleY: t.scaleY * scaleY
|
|
4591
|
-
}, 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);
|
|
4592
4593
|
}
|
|
4593
4594
|
},
|
|
4594
4595
|
rotateOfWorld(t, origin, angle, transition) {
|
|
@@ -4612,18 +4613,18 @@ var LeaferUI = function(exports) {
|
|
|
4612
4613
|
skewOfOuter(matrix$3, origin, skewX, skewY);
|
|
4613
4614
|
L$5.setTransform(t, matrix$3, resize, transition);
|
|
4614
4615
|
},
|
|
4615
|
-
transformWorld(t, transform, resize, transition) {
|
|
4616
|
+
transformWorld(t, transform, resize, transition, boundsType) {
|
|
4616
4617
|
copy$8(matrix$3, t.worldTransform);
|
|
4617
4618
|
multiplyParent$3(matrix$3, transform);
|
|
4618
4619
|
if (t.parent) divideParent(matrix$3, t.parent.scrollWorldTransform);
|
|
4619
|
-
L$5.setTransform(t, matrix$3, resize, transition);
|
|
4620
|
+
L$5.setTransform(t, matrix$3, resize, transition, boundsType);
|
|
4620
4621
|
},
|
|
4621
|
-
transform(t, transform, resize, transition) {
|
|
4622
|
+
transform(t, transform, resize, transition, boundsType) {
|
|
4622
4623
|
copy$8(matrix$3, t.localTransform);
|
|
4623
4624
|
multiplyParent$3(matrix$3, transform);
|
|
4624
|
-
L$5.setTransform(t, matrix$3, resize, transition);
|
|
4625
|
+
L$5.setTransform(t, matrix$3, resize, transition, boundsType);
|
|
4625
4626
|
},
|
|
4626
|
-
setTransform(t, transform, resize, transition) {
|
|
4627
|
+
setTransform(t, transform, resize, transition, boundsType) {
|
|
4627
4628
|
const data = t.__, originPoint = data.origin && L$5.getInnerOrigin(t, data.origin);
|
|
4628
4629
|
const layout = getLayout(transform, originPoint, data.around && L$5.getInnerOrigin(t, data.around));
|
|
4629
4630
|
if (L$5.hasOffset(t)) {
|
|
@@ -4639,7 +4640,7 @@ var LeaferUI = function(exports) {
|
|
|
4639
4640
|
PointHelper.move(layout, originPoint.x - changedPoint.x, originPoint.y - changedPoint.y);
|
|
4640
4641
|
}
|
|
4641
4642
|
t.set(layout);
|
|
4642
|
-
t.scaleResize(scaleX, scaleY, false);
|
|
4643
|
+
t.scaleResize(scaleX, scaleY, false, boundsType);
|
|
4643
4644
|
} else t.set(layout, transition);
|
|
4644
4645
|
},
|
|
4645
4646
|
getFlipTransform(t, axis) {
|
|
@@ -4841,11 +4842,11 @@ var LeaferUI = function(exports) {
|
|
|
4841
4842
|
w.height *= scaleY;
|
|
4842
4843
|
w.scaleX *= scaleX;
|
|
4843
4844
|
w.scaleY *= scaleY;
|
|
4844
|
-
if (branch.isBranch) scale$
|
|
4845
|
+
if (branch.isBranch) scale$4(branch, x, y, scaleX, scaleY, a, b);
|
|
4845
4846
|
}
|
|
4846
4847
|
}
|
|
4847
4848
|
};
|
|
4848
|
-
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;
|
|
4849
4850
|
const WaitHelper = {
|
|
4850
4851
|
run(wait) {
|
|
4851
4852
|
if (wait && wait.length) {
|
|
@@ -5638,7 +5639,7 @@ var LeaferUI = function(exports) {
|
|
|
5638
5639
|
}
|
|
5639
5640
|
};
|
|
5640
5641
|
const {setLayout: setLayout, multiplyParent: multiplyParent$2, translateInner: translateInner, defaultWorld: defaultWorld} = MatrixHelper;
|
|
5641
|
-
const {toPoint: toPoint$4, tempPoint: tempPoint$
|
|
5642
|
+
const {toPoint: toPoint$4, tempPoint: tempPoint$3} = AroundHelper;
|
|
5642
5643
|
const LeafMatrix = {
|
|
5643
5644
|
__updateWorldMatrix() {
|
|
5644
5645
|
const {parent: parent, __layout: __layout, __world: __world, __scrollWorld: __scrollWorld, __: __} = this;
|
|
@@ -5658,8 +5659,8 @@ var LeaferUI = function(exports) {
|
|
|
5658
5659
|
local.e = data.x + data.offsetX;
|
|
5659
5660
|
local.f = data.y + data.offsetY;
|
|
5660
5661
|
if (data.around || data.origin) {
|
|
5661
|
-
toPoint$4(data.around || data.origin, layout.boxBounds, tempPoint$
|
|
5662
|
-
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);
|
|
5663
5664
|
}
|
|
5664
5665
|
}
|
|
5665
5666
|
this.__layout.matrixChanged = undefined;
|
|
@@ -5880,7 +5881,7 @@ var LeaferUI = function(exports) {
|
|
|
5880
5881
|
};
|
|
5881
5882
|
const {LEAF: LEAF, create: create} = IncrementId;
|
|
5882
5883
|
const {stintSet: stintSet$6} = DataHelper;
|
|
5883
|
-
const {toInnerPoint: toInnerPoint, toOuterPoint: toOuterPoint, multiplyParent: multiplyParent$1} = MatrixHelper;
|
|
5884
|
+
const {toInnerPoint: toInnerPoint, toOuterPoint: toOuterPoint$1, multiplyParent: multiplyParent$1} = MatrixHelper;
|
|
5884
5885
|
const {toOuterOf: toOuterOf$1} = BoundsHelper;
|
|
5885
5886
|
const {copy: copy$5, move: move$8} = PointHelper;
|
|
5886
5887
|
const {getScaleFixedData: getScaleFixedData$1} = MathHelper;
|
|
@@ -6214,7 +6215,7 @@ var LeaferUI = function(exports) {
|
|
|
6214
6215
|
toInnerPoint(this.worldTransform, world, to, distance);
|
|
6215
6216
|
}
|
|
6216
6217
|
innerToWorld(inner, to, distance, relative) {
|
|
6217
|
-
toOuterPoint(this.worldTransform, inner, to, distance);
|
|
6218
|
+
toOuterPoint$1(this.worldTransform, inner, to, distance);
|
|
6218
6219
|
if (relative) relative.worldToInner(to ? to : inner, null, distance);
|
|
6219
6220
|
}
|
|
6220
6221
|
getBoxPoint(world, relative, distance, change) {
|
|
@@ -6269,11 +6270,11 @@ var LeaferUI = function(exports) {
|
|
|
6269
6270
|
const layer = this.leafer ? this.leafer.zoomLayer : this;
|
|
6270
6271
|
return layer.getWorldPoint(page, relative, distance, change);
|
|
6271
6272
|
}
|
|
6272
|
-
setTransform(matrix, resize, transition) {
|
|
6273
|
-
setTransform(this, matrix, resize, transition);
|
|
6273
|
+
setTransform(matrix, resize, transition, boundsType) {
|
|
6274
|
+
setTransform(this, matrix, resize, transition, boundsType);
|
|
6274
6275
|
}
|
|
6275
|
-
transform(matrix, resize, transition) {
|
|
6276
|
-
transform(this, matrix, resize, transition);
|
|
6276
|
+
transform(matrix, resize, transition, boundsType) {
|
|
6277
|
+
transform(this, matrix, resize, transition, boundsType);
|
|
6277
6278
|
}
|
|
6278
6279
|
move(x, y, transition) {
|
|
6279
6280
|
moveLocal(this, x, y, transition);
|
|
@@ -6281,8 +6282,8 @@ var LeaferUI = function(exports) {
|
|
|
6281
6282
|
moveInner(x, y, transition) {
|
|
6282
6283
|
moveWorld(this, x, y, true, transition);
|
|
6283
6284
|
}
|
|
6284
|
-
scaleOf(origin, scaleX, scaleY, resize, transition) {
|
|
6285
|
-
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);
|
|
6286
6287
|
}
|
|
6287
6288
|
rotateOf(origin, rotation, transition) {
|
|
6288
6289
|
rotateOfLocal(this, getLocalOrigin(this, origin), rotation, transition);
|
|
@@ -6290,14 +6291,14 @@ var LeaferUI = function(exports) {
|
|
|
6290
6291
|
skewOf(origin, skewX, skewY, resize, transition) {
|
|
6291
6292
|
skewOfLocal(this, getLocalOrigin(this, origin), skewX, skewY, resize, transition);
|
|
6292
6293
|
}
|
|
6293
|
-
transformWorld(worldTransform, resize, transition) {
|
|
6294
|
-
transformWorld(this, worldTransform, resize, transition);
|
|
6294
|
+
transformWorld(worldTransform, resize, transition, boundsType) {
|
|
6295
|
+
transformWorld(this, worldTransform, resize, transition, boundsType);
|
|
6295
6296
|
}
|
|
6296
6297
|
moveWorld(x, y, transition) {
|
|
6297
6298
|
moveWorld(this, x, y, false, transition);
|
|
6298
6299
|
}
|
|
6299
|
-
scaleOfWorld(worldOrigin, scaleX, scaleY, resize, transition) {
|
|
6300
|
-
zoomOfWorld(this, worldOrigin, scaleX, scaleY, resize, transition);
|
|
6300
|
+
scaleOfWorld(worldOrigin, scaleX, scaleY, resize, transition, boundsType) {
|
|
6301
|
+
zoomOfWorld(this, worldOrigin, scaleX, scaleY, resize, transition, boundsType);
|
|
6301
6302
|
}
|
|
6302
6303
|
rotateOfWorld(worldOrigin, rotation) {
|
|
6303
6304
|
rotateOfWorld(this, worldOrigin, rotation);
|
|
@@ -6308,7 +6309,7 @@ var LeaferUI = function(exports) {
|
|
|
6308
6309
|
flip(axis, transition) {
|
|
6309
6310
|
transform(this, getFlipTransform(this, axis), false, transition);
|
|
6310
6311
|
}
|
|
6311
|
-
scaleResize(scaleX, scaleY = scaleX, _noResize) {
|
|
6312
|
+
scaleResize(scaleX, scaleY = scaleX, _noResize, _boundsType) {
|
|
6312
6313
|
this.scaleX *= scaleX;
|
|
6313
6314
|
this.scaleY *= scaleY;
|
|
6314
6315
|
}
|
|
@@ -6673,7 +6674,7 @@ var LeaferUI = function(exports) {
|
|
|
6673
6674
|
this.levelMap = null;
|
|
6674
6675
|
}
|
|
6675
6676
|
}
|
|
6676
|
-
const version = "2.1.
|
|
6677
|
+
const version = "2.1.4";
|
|
6677
6678
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6678
6679
|
get allowBackgroundColor() {
|
|
6679
6680
|
return true;
|
|
@@ -7302,7 +7303,7 @@ var LeaferUI = function(exports) {
|
|
|
7302
7303
|
}
|
|
7303
7304
|
}
|
|
7304
7305
|
Renderer.clipSpread = 10;
|
|
7305
|
-
const tempPoint$
|
|
7306
|
+
const tempPoint$2 = {};
|
|
7306
7307
|
const {copyRadiusPoint: copyRadiusPoint$1} = PointHelper;
|
|
7307
7308
|
const {hitRadiusPoint: hitRadiusPoint$1} = BoundsHelper;
|
|
7308
7309
|
class Picker {
|
|
@@ -7434,7 +7435,7 @@ var LeaferUI = function(exports) {
|
|
|
7434
7435
|
for (let i = len - 1; i > -1; i--) {
|
|
7435
7436
|
child = children[i], data = child.__;
|
|
7436
7437
|
if (!data.visible || hitMask && !data.mask) continue;
|
|
7437
|
-
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);
|
|
7438
7439
|
if (child.isBranch) {
|
|
7439
7440
|
if (hit || child.__ignoreHitWorld) {
|
|
7440
7441
|
if (child.isBranchLeaf && data.__clipAfterFill && !child.__hitWorld(point, true)) continue;
|
|
@@ -11236,7 +11237,7 @@ var LeaferUI = function(exports) {
|
|
|
11236
11237
|
if (scaleX) scaleHelper(transform, scaleX, scaleY);
|
|
11237
11238
|
translate(transform, box.x + x, box.y + y);
|
|
11238
11239
|
}
|
|
11239
|
-
const {get: get$1, scale: scale$
|
|
11240
|
+
const {get: get$1, scale: scale$3, copy: copy$4} = MatrixHelper;
|
|
11240
11241
|
const {getFloorScale: getFloorScale} = MathHelper, {abs: abs$7} = Math;
|
|
11241
11242
|
function createPatternTask(paint, ui, canvas, renderOptions) {
|
|
11242
11243
|
if (!paint.patternTask) {
|
|
@@ -11271,7 +11272,7 @@ var LeaferUI = function(exports) {
|
|
|
11271
11272
|
scaleY *= getFloorScale(height + (yGap || 0));
|
|
11272
11273
|
imageMatrix = get$1();
|
|
11273
11274
|
if (transform) copy$4(imageMatrix, transform);
|
|
11274
|
-
scale$
|
|
11275
|
+
scale$3(imageMatrix, 1 / scaleX, 1 / scaleY);
|
|
11275
11276
|
}
|
|
11276
11277
|
const imageCanvas = image.getCanvas(width, height, opacity, undefined, xGap, yGap, ui.leafer && ui.leafer.config.smooth, data.interlace);
|
|
11277
11278
|
if (brush) {
|
|
@@ -12250,10 +12251,11 @@ var LeaferUI = function(exports) {
|
|
|
12250
12251
|
if (innerEditor) innerEditor.editConfig && Object.assign(mergeConfig, innerEditor.editConfig); else if (editTool) editTool.editConfig && Object.assign(mergeConfig, editTool.editConfig);
|
|
12251
12252
|
if (element && element.editConfig) {
|
|
12252
12253
|
let {editConfig: editConfig} = element;
|
|
12253
|
-
if (editConfig.hover || editConfig.hoverStyle) {
|
|
12254
|
+
if (editConfig.hover || editConfig.hoverStyle || editConfig.hoverPathType) {
|
|
12254
12255
|
editConfig = Object.assign({}, editConfig);
|
|
12255
12256
|
delete editConfig.hover;
|
|
12256
12257
|
delete editConfig.hoverStyle;
|
|
12258
|
+
delete editConfig.hoverPathType;
|
|
12257
12259
|
}
|
|
12258
12260
|
Object.assign(mergeConfig, editConfig);
|
|
12259
12261
|
}
|
|
@@ -12314,9 +12316,22 @@ var LeaferUI = function(exports) {
|
|
|
12314
12316
|
matrix$1.half = strokeWidth % 2;
|
|
12315
12317
|
canvas.setWorld(matrix$1, options.matrix);
|
|
12316
12318
|
canvas.beginPath();
|
|
12317
|
-
|
|
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":
|
|
12318
12331
|
leaf.__drawPath(canvas);
|
|
12319
|
-
|
|
12332
|
+
break;
|
|
12333
|
+
|
|
12334
|
+
default:
|
|
12320
12335
|
if (leaf.__.__useArrow) leaf.__drawPath(canvas); else leaf.__.__pathForRender ? leaf.__drawRenderPath(canvas) : leaf.__drawPathByBox(canvas);
|
|
12321
12336
|
}
|
|
12322
12337
|
data.strokeWidth = strokeWidth / Math.max(aScaleX, aScaleY);
|
|
@@ -12431,10 +12446,11 @@ var LeaferUI = function(exports) {
|
|
|
12431
12446
|
if (this.running && !this.dragging && !editor.dragging) {
|
|
12432
12447
|
const {hoverTarget: hoverTarget, mergeConfig: mergeConfig} = editor, config = Object.assign({}, mergeConfig);
|
|
12433
12448
|
if (hoverTarget && hoverTarget.editConfig) Object.assign(config, hoverTarget.editConfig);
|
|
12434
|
-
const {stroke: stroke, strokeWidth: strokeWidth, hover: hover, hoverStyle: hoverStyle} = config;
|
|
12449
|
+
const {stroke: stroke, strokeWidth: strokeWidth, hover: hover, hoverStyle: hoverStyle, hoverPathType: hoverPathType} = config;
|
|
12435
12450
|
this.hoverStroker.setTarget(hover ? hoverTarget : null, Object.assign({
|
|
12436
12451
|
stroke: stroke,
|
|
12437
|
-
strokeWidth: strokeWidth
|
|
12452
|
+
strokeWidth: strokeWidth,
|
|
12453
|
+
strokePathType: hoverPathType
|
|
12438
12454
|
}, hoverStyle || {}));
|
|
12439
12455
|
} else {
|
|
12440
12456
|
this.hoverStroker.target = null;
|
|
@@ -12614,16 +12630,17 @@ var LeaferUI = function(exports) {
|
|
|
12614
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;
|
|
12615
12631
|
const {toPoint: toPoint} = AroundHelper, {within: within$3, sign: sign$1} = MathHelper, {abs: abs$4} = Math;
|
|
12616
12632
|
const EditDataHelper = {
|
|
12617
|
-
getScaleData(target, startBounds, direction, totalMoveOrScale, lockRatio, around, flipable, scaleMode) {
|
|
12633
|
+
getScaleData(target, startBounds, direction, totalMoveOrScale, lockRatio, around, flipable, scaleMode, boundsType) {
|
|
12618
12634
|
let align, origin = {}, scaleX = 1, scaleY = 1, lockScale;
|
|
12619
|
-
const {
|
|
12635
|
+
const {widthRange: widthRange, heightRange: heightRange, dragBounds: dragBounds, worldTransform: worldTransform, boxBounds: boxBounds} = target;
|
|
12620
12636
|
const {width: width, height: height} = startBounds;
|
|
12637
|
+
const innerBounds = target.getBounds(boundsType, "inner");
|
|
12621
12638
|
const originChangedScaleX = target.scaleX / startBounds.scaleX;
|
|
12622
12639
|
const originChangedScaleY = target.scaleY / startBounds.scaleY;
|
|
12623
12640
|
const signX = sign$1(originChangedScaleX);
|
|
12624
12641
|
const signY = sign$1(originChangedScaleY);
|
|
12625
|
-
const changedScaleX = scaleMode ? originChangedScaleX : signX *
|
|
12626
|
-
const changedScaleY = scaleMode ? originChangedScaleY : signY *
|
|
12642
|
+
const changedScaleX = scaleMode ? originChangedScaleX : signX * innerBounds.width / width;
|
|
12643
|
+
const changedScaleY = scaleMode ? originChangedScaleY : signY * innerBounds.height / height;
|
|
12627
12644
|
if (isNumber(totalMoveOrScale)) {
|
|
12628
12645
|
scaleX = scaleY = Math.sqrt(totalMoveOrScale);
|
|
12629
12646
|
} else {
|
|
@@ -12709,10 +12726,11 @@ var LeaferUI = function(exports) {
|
|
|
12709
12726
|
if (useScaleY) scaleY /= changedScaleY;
|
|
12710
12727
|
if (!flipable) {
|
|
12711
12728
|
const {worldTransform: worldTransform} = target;
|
|
12712
|
-
if (scaleX < 0) scaleX = 1 /
|
|
12713
|
-
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;
|
|
12714
12731
|
}
|
|
12715
|
-
toPoint(around || align,
|
|
12732
|
+
toPoint(around || align, innerBounds, origin, true);
|
|
12733
|
+
this.checkOrigin(target, origin, boundsType);
|
|
12716
12734
|
if (dragBounds) {
|
|
12717
12735
|
const scaleData = {
|
|
12718
12736
|
x: scaleX,
|
|
@@ -12723,15 +12741,20 @@ var LeaferUI = function(exports) {
|
|
|
12723
12741
|
scaleY = scaleData.y;
|
|
12724
12742
|
}
|
|
12725
12743
|
if (useScaleX && widthRange) {
|
|
12726
|
-
const nowWidth =
|
|
12744
|
+
const nowWidth = innerBounds.width * target.scaleX;
|
|
12727
12745
|
scaleX = within$3(nowWidth * scaleX, widthRange) / nowWidth;
|
|
12728
12746
|
}
|
|
12729
12747
|
if (useScaleY && heightRange) {
|
|
12730
|
-
const nowHeight =
|
|
12748
|
+
const nowHeight = innerBounds.height * target.scaleY;
|
|
12731
12749
|
scaleY = within$3(nowHeight * scaleY, heightRange) / nowHeight;
|
|
12732
12750
|
}
|
|
12733
|
-
|
|
12734
|
-
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;
|
|
12735
12758
|
if (lockRatio && scaleX !== scaleY) {
|
|
12736
12759
|
lockScale = Math.min(abs$4(scaleX), abs$4(scaleY));
|
|
12737
12760
|
scaleX = sign$1(scaleX) * lockScale;
|
|
@@ -12748,7 +12771,7 @@ var LeaferUI = function(exports) {
|
|
|
12748
12771
|
around: around
|
|
12749
12772
|
};
|
|
12750
12773
|
},
|
|
12751
|
-
getRotateData(target, direction, current, last, around) {
|
|
12774
|
+
getRotateData(target, direction, current, last, around, boundsType) {
|
|
12752
12775
|
let align, origin = {};
|
|
12753
12776
|
switch (direction) {
|
|
12754
12777
|
case topLeft$1:
|
|
@@ -12770,13 +12793,14 @@ var LeaferUI = function(exports) {
|
|
|
12770
12793
|
default:
|
|
12771
12794
|
align = "center";
|
|
12772
12795
|
}
|
|
12773
|
-
toPoint(around || align, target.
|
|
12796
|
+
toPoint(around || align, target.getBounds(boundsType, "inner"), origin, true);
|
|
12797
|
+
this.checkOrigin(target, origin, boundsType);
|
|
12774
12798
|
return {
|
|
12775
12799
|
origin: origin,
|
|
12776
12800
|
rotation: PointHelper.getRotation(last, target.getWorldPointByBox(origin), current)
|
|
12777
12801
|
};
|
|
12778
12802
|
},
|
|
12779
|
-
getSkewData(
|
|
12803
|
+
getSkewData(target, direction, move, around, boundsType) {
|
|
12780
12804
|
let align, origin = {}, skewX = 0, skewY = 0;
|
|
12781
12805
|
let last;
|
|
12782
12806
|
switch (direction) {
|
|
@@ -12819,10 +12843,12 @@ var LeaferUI = function(exports) {
|
|
|
12819
12843
|
align = "left";
|
|
12820
12844
|
skewY = 1;
|
|
12821
12845
|
}
|
|
12822
|
-
const
|
|
12846
|
+
const innerBounds = target.getBounds(boundsType, "inner");
|
|
12847
|
+
const {width: width, height: height} = innerBounds;
|
|
12823
12848
|
last.x = last.x * width;
|
|
12824
12849
|
last.y = last.y * height;
|
|
12825
|
-
toPoint(around || align,
|
|
12850
|
+
toPoint(around || align, innerBounds, origin, true);
|
|
12851
|
+
this.checkOrigin(target, origin, boundsType);
|
|
12826
12852
|
const rotation = PointHelper.getRotation(last, origin, {
|
|
12827
12853
|
x: last.x + (skewX ? move.x : 0),
|
|
12828
12854
|
y: last.y + (skewY ? move.y : 0)
|
|
@@ -12834,6 +12860,13 @@ var LeaferUI = function(exports) {
|
|
|
12834
12860
|
skewY: skewY
|
|
12835
12861
|
};
|
|
12836
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
|
+
},
|
|
12837
12870
|
getAround(around, altKey) {
|
|
12838
12871
|
return altKey && !around ? "center" : around;
|
|
12839
12872
|
},
|
|
@@ -13097,8 +13130,8 @@ var LeaferUI = function(exports) {
|
|
|
13097
13130
|
updateMoveCursor(this);
|
|
13098
13131
|
}
|
|
13099
13132
|
update() {
|
|
13100
|
-
const {editor: editor} = this;
|
|
13101
|
-
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);
|
|
13102
13135
|
this.visible = !this.target.locked;
|
|
13103
13136
|
this.set({
|
|
13104
13137
|
x: x,
|
|
@@ -13121,9 +13154,9 @@ var LeaferUI = function(exports) {
|
|
|
13121
13154
|
if (this.app) this.rect.syncEventer = this.app.interaction.bottomList = null;
|
|
13122
13155
|
}
|
|
13123
13156
|
updateBounds(bounds) {
|
|
13124
|
-
const {editor: editor,
|
|
13157
|
+
const {editor: editor, mergedConfig: mergedConfig, single: single, rect: rect, circle: circle, buttons: buttons, resizePoints: resizePoints, rotatePoints: rotatePoints, resizeLines: resizeLines} = this;
|
|
13125
13158
|
const {editMask: editMask} = editor;
|
|
13126
|
-
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;
|
|
13127
13160
|
editMask.visible = mask ? true : 0;
|
|
13128
13161
|
if (!isUndefined(dimOthers) || !isUndefined(bright)) {
|
|
13129
13162
|
editor.setDimOthers(dimOthers);
|
|
@@ -13161,7 +13194,7 @@ var LeaferUI = function(exports) {
|
|
|
13161
13194
|
}
|
|
13162
13195
|
}
|
|
13163
13196
|
}
|
|
13164
|
-
circle.visible = showPoints && rotateable && !!(
|
|
13197
|
+
circle.visible = showPoints && rotateable && !!(mergedConfig.circle || mergedConfig.rotatePoint);
|
|
13165
13198
|
if (circle.visible) this.layoutCircle();
|
|
13166
13199
|
if (rect.path) rect.path = null;
|
|
13167
13200
|
rect.set(Object.assign(Object.assign({}, bounds), {
|
|
@@ -13269,7 +13302,8 @@ var LeaferUI = function(exports) {
|
|
|
13269
13302
|
this.dragPoint = null;
|
|
13270
13303
|
}
|
|
13271
13304
|
onTransformStart(e) {
|
|
13272
|
-
|
|
13305
|
+
const {hideOnMove: hideOnMove, editBoxType: editBoxType} = this.mergedConfig;
|
|
13306
|
+
if (this.moving || this.gesturing) this.editor.opacity = hideOnMove ? 0 : 1;
|
|
13273
13307
|
if (this.resizing) ResizeEvent.resizingKeys = this.editor.leafList.keys;
|
|
13274
13308
|
const {dragStartData: dragStartData, target: target} = this;
|
|
13275
13309
|
dragStartData.x = e.x;
|
|
@@ -13279,7 +13313,7 @@ var LeaferUI = function(exports) {
|
|
|
13279
13313
|
x: target.x,
|
|
13280
13314
|
y: target.y
|
|
13281
13315
|
};
|
|
13282
|
-
dragStartData.bounds = Object.assign({}, target.getLayoutBounds(
|
|
13316
|
+
dragStartData.bounds = Object.assign({}, target.getLayoutBounds(editBoxType, "local"));
|
|
13283
13317
|
dragStartData.rotation = target.rotation;
|
|
13284
13318
|
}
|
|
13285
13319
|
onTransformEnd(e) {
|
|
@@ -13510,6 +13544,7 @@ var LeaferUI = function(exports) {
|
|
|
13510
13544
|
},
|
|
13511
13545
|
selector: true,
|
|
13512
13546
|
editBox: true,
|
|
13547
|
+
editBoxType: "box",
|
|
13513
13548
|
hover: true,
|
|
13514
13549
|
select: "press",
|
|
13515
13550
|
openInner: "double",
|
|
@@ -13792,7 +13827,7 @@ var LeaferUI = function(exports) {
|
|
|
13792
13827
|
}
|
|
13793
13828
|
onScale(e) {
|
|
13794
13829
|
const {target: target, mergeConfig: mergeConfig, single: single, dragStartData: dragStartData} = this.editBox;
|
|
13795
|
-
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;
|
|
13796
13831
|
if (e instanceof exports.ZoomEvent) {
|
|
13797
13832
|
if (!around) around = target.getBoxPoint(e);
|
|
13798
13833
|
totalMove = e.totalScale;
|
|
@@ -13801,7 +13836,7 @@ var LeaferUI = function(exports) {
|
|
|
13801
13836
|
}
|
|
13802
13837
|
const {direction: direction} = e.current;
|
|
13803
13838
|
if (e.shiftKey || target.lockRatio) lockRatio = true;
|
|
13804
|
-
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);
|
|
13805
13840
|
const targetX = target.x, targetY = target.y;
|
|
13806
13841
|
if (e instanceof exports.DragEvent && this.editTool && this.editTool.onScaleWithDrag) {
|
|
13807
13842
|
data.drag = e;
|
|
@@ -13813,7 +13848,7 @@ var LeaferUI = function(exports) {
|
|
|
13813
13848
|
}
|
|
13814
13849
|
onRotate(e) {
|
|
13815
13850
|
const {target: target, mergeConfig: mergeConfig, dragStartData: dragStartData} = this.editBox;
|
|
13816
|
-
const {around: around, rotateAround: rotateAround, rotateGap: rotateGap, diagonalRotateKey: diagonalRotateKey} = mergeConfig;
|
|
13851
|
+
const {around: around, rotateAround: rotateAround, rotateGap: rotateGap, diagonalRotateKey: diagonalRotateKey, editBoxType: editBoxType} = mergeConfig;
|
|
13817
13852
|
const {direction: direction} = e.current;
|
|
13818
13853
|
let origin, rotation;
|
|
13819
13854
|
if (e instanceof exports.RotateEvent) {
|
|
@@ -13821,7 +13856,7 @@ var LeaferUI = function(exports) {
|
|
|
13821
13856
|
origin = rotateAround ? AroundHelper.getPoint(rotateAround, target.boxBounds) : target.getBoxPoint(e);
|
|
13822
13857
|
} else {
|
|
13823
13858
|
const isDiagonalRotate = diagonalRotateKey ? e.isHoldKeys(diagonalRotateKey) : e.shiftKey;
|
|
13824
|
-
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);
|
|
13825
13860
|
rotation = dragStartData.rotation + data.rotation - target.rotation;
|
|
13826
13861
|
origin = data.origin;
|
|
13827
13862
|
}
|
|
@@ -13833,8 +13868,8 @@ var LeaferUI = function(exports) {
|
|
|
13833
13868
|
}
|
|
13834
13869
|
onSkew(e) {
|
|
13835
13870
|
const {target: target, mergeConfig: mergeConfig} = this.editBox;
|
|
13836
|
-
const {around: around} = mergeConfig;
|
|
13837
|
-
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);
|
|
13838
13873
|
if (!skewX && !skewY) return;
|
|
13839
13874
|
this.skewOf(origin, skewX, skewY);
|
|
13840
13875
|
}
|
|
@@ -13895,7 +13930,7 @@ var LeaferUI = function(exports) {
|
|
|
13895
13930
|
scaleOf(origin, scaleX, scaleY = scaleX, _resize) {
|
|
13896
13931
|
if (!this.checkTransform("resizeable")) return;
|
|
13897
13932
|
const {target: target, mergeConfig: mergeConfig, single: single, editor: editor} = this.editBox;
|
|
13898
|
-
const {beforeScale: beforeScale} = mergeConfig;
|
|
13933
|
+
const {beforeScale: beforeScale, editBoxType: editBoxType} = mergeConfig;
|
|
13899
13934
|
if (beforeScale) {
|
|
13900
13935
|
const check = beforeScale({
|
|
13901
13936
|
target: target,
|
|
@@ -13913,7 +13948,8 @@ var LeaferUI = function(exports) {
|
|
|
13913
13948
|
worldOrigin: worldOrigin,
|
|
13914
13949
|
scaleX: scaleX,
|
|
13915
13950
|
scaleY: scaleY,
|
|
13916
|
-
transform: transform
|
|
13951
|
+
transform: transform,
|
|
13952
|
+
editBoxType: editBoxType
|
|
13917
13953
|
};
|
|
13918
13954
|
this.emitEvent(new EditorScaleEvent(EditorScaleEvent.BEFORE_SCALE, data));
|
|
13919
13955
|
const event = new EditorScaleEvent(EditorScaleEvent.SCALE, data);
|
|
@@ -13941,7 +13977,7 @@ var LeaferUI = function(exports) {
|
|
|
13941
13977
|
rotateOf(origin, rotation) {
|
|
13942
13978
|
if (!this.checkTransform("rotateable")) return;
|
|
13943
13979
|
const {target: target, mergeConfig: mergeConfig, single: single, editor: editor} = this.editBox;
|
|
13944
|
-
const {beforeRotate: beforeRotate} = mergeConfig;
|
|
13980
|
+
const {beforeRotate: beforeRotate, editBoxType: editBoxType} = mergeConfig;
|
|
13945
13981
|
if (beforeRotate) {
|
|
13946
13982
|
const check = beforeRotate({
|
|
13947
13983
|
target: target,
|
|
@@ -13957,7 +13993,8 @@ var LeaferUI = function(exports) {
|
|
|
13957
13993
|
editor: editor,
|
|
13958
13994
|
worldOrigin: worldOrigin,
|
|
13959
13995
|
rotation: rotation,
|
|
13960
|
-
transform: transform
|
|
13996
|
+
transform: transform,
|
|
13997
|
+
editBoxType: editBoxType
|
|
13961
13998
|
};
|
|
13962
13999
|
this.emitEvent(new EditorRotateEvent(EditorRotateEvent.BEFORE_ROTATE, data));
|
|
13963
14000
|
const event = new EditorRotateEvent(EditorRotateEvent.ROTATE, data);
|
|
@@ -13967,7 +14004,7 @@ var LeaferUI = function(exports) {
|
|
|
13967
14004
|
skewOf(origin, skewX, skewY = 0, _resize) {
|
|
13968
14005
|
if (!this.checkTransform("skewable")) return;
|
|
13969
14006
|
const {target: target, mergeConfig: mergeConfig, single: single, editor: editor} = this.editBox;
|
|
13970
|
-
const {beforeSkew: beforeSkew} = mergeConfig;
|
|
14007
|
+
const {beforeSkew: beforeSkew, editBoxType: editBoxType} = mergeConfig;
|
|
13971
14008
|
if (beforeSkew) {
|
|
13972
14009
|
const check = beforeSkew({
|
|
13973
14010
|
target: target,
|
|
@@ -13985,7 +14022,8 @@ var LeaferUI = function(exports) {
|
|
|
13985
14022
|
worldOrigin: worldOrigin,
|
|
13986
14023
|
skewX: skewX,
|
|
13987
14024
|
skewY: skewY,
|
|
13988
|
-
transform: transform
|
|
14025
|
+
transform: transform,
|
|
14026
|
+
editBoxType: editBoxType
|
|
13989
14027
|
};
|
|
13990
14028
|
this.emitEvent(new EditorSkewEvent(EditorSkewEvent.BEFORE_SKEW, data));
|
|
13991
14029
|
const event = new EditorSkewEvent(EditorSkewEvent.SKEW, data);
|
|
@@ -14427,32 +14465,32 @@ var LeaferUI = function(exports) {
|
|
|
14427
14465
|
app.unlockLayout();
|
|
14428
14466
|
}
|
|
14429
14467
|
onScale(e) {
|
|
14430
|
-
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;
|
|
14431
14469
|
const {app: app, list: list} = editor;
|
|
14432
14470
|
app.lockLayout();
|
|
14433
14471
|
list.forEach(target => {
|
|
14434
14472
|
const resize = editor.getEditSize(target) !== "scale";
|
|
14435
|
-
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);
|
|
14436
14474
|
});
|
|
14437
14475
|
app.unlockLayout();
|
|
14438
14476
|
}
|
|
14439
14477
|
onRotate(e) {
|
|
14440
|
-
const {rotation: rotation, transform: transform, worldOrigin: worldOrigin, editor: editor} = e;
|
|
14478
|
+
const {rotation: rotation, transform: transform, worldOrigin: worldOrigin, editor: editor, editBoxType: editBoxType} = e;
|
|
14441
14479
|
const {app: app, list: list} = editor;
|
|
14442
14480
|
app.lockLayout();
|
|
14443
14481
|
list.forEach(target => {
|
|
14444
14482
|
const resize = editor.getEditSize(target) !== "scale";
|
|
14445
|
-
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);
|
|
14446
14484
|
});
|
|
14447
14485
|
app.unlockLayout();
|
|
14448
14486
|
}
|
|
14449
14487
|
onSkew(e) {
|
|
14450
|
-
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;
|
|
14451
14489
|
const {app: app, list: list} = editor;
|
|
14452
14490
|
app.lockLayout();
|
|
14453
14491
|
list.forEach(target => {
|
|
14454
14492
|
const resize = editor.getEditSize(target) !== "scale";
|
|
14455
|
-
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);
|
|
14456
14494
|
});
|
|
14457
14495
|
app.unlockLayout();
|
|
14458
14496
|
}
|
|
@@ -14733,15 +14771,26 @@ var LeaferUI = function(exports) {
|
|
|
14733
14771
|
children[i].transform(matrix, true);
|
|
14734
14772
|
}
|
|
14735
14773
|
}
|
|
14736
|
-
const leaf = exports.Leaf.prototype;
|
|
14737
|
-
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) {
|
|
14738
14776
|
const data = this;
|
|
14739
14777
|
if (noResize || data.editConfig && data.editConfig.editSize === "scale") {
|
|
14740
14778
|
data.scaleX *= scaleX;
|
|
14741
14779
|
data.scaleY *= scaleY;
|
|
14742
14780
|
} else {
|
|
14743
|
-
|
|
14744
|
-
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
|
+
}
|
|
14745
14794
|
this.__scaleResize(scaleX, scaleY);
|
|
14746
14795
|
}
|
|
14747
14796
|
};
|
|
@@ -19927,7 +19976,7 @@ var LeaferUI = function(exports) {
|
|
|
19927
19976
|
exports.surfaceType = surfaceType;
|
|
19928
19977
|
exports.tempBounds = tempBounds$3;
|
|
19929
19978
|
exports.tempMatrix = tempMatrix$2;
|
|
19930
|
-
exports.tempPoint = tempPoint$
|
|
19979
|
+
exports.tempPoint = tempPoint$5;
|
|
19931
19980
|
exports.tryToNumber = tryToNumber;
|
|
19932
19981
|
exports.useCanvas = useCanvas;
|
|
19933
19982
|
exports.useModule = useModule;
|