@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.module.js
CHANGED
|
@@ -472,7 +472,7 @@ const {sin: sin$6, cos: cos$6, acos: acos, sqrt: sqrt$5} = Math;
|
|
|
472
472
|
|
|
473
473
|
const {float: float$6} = MathHelper;
|
|
474
474
|
|
|
475
|
-
const tempPoint$
|
|
475
|
+
const tempPoint$6 = {};
|
|
476
476
|
|
|
477
477
|
function getWorld() {
|
|
478
478
|
return Object.assign(Object.assign(Object.assign({}, getMatrixData()), getBoundsData()), {
|
|
@@ -531,8 +531,8 @@ const MatrixHelper = {
|
|
|
531
531
|
to.f = t.f * pixelRatio;
|
|
532
532
|
},
|
|
533
533
|
scaleOfOuter(t, origin, scaleX, scaleY) {
|
|
534
|
-
M$c.toInnerPoint(t, origin, tempPoint$
|
|
535
|
-
M$c.scaleOfInner(t, tempPoint$
|
|
534
|
+
M$c.toInnerPoint(t, origin, tempPoint$6);
|
|
535
|
+
M$c.scaleOfInner(t, tempPoint$6, scaleX, scaleY);
|
|
536
536
|
},
|
|
537
537
|
scaleOfInner(t, origin, scaleX, scaleY = scaleX) {
|
|
538
538
|
M$c.translateInner(t, origin.x, origin.y);
|
|
@@ -550,8 +550,8 @@ const MatrixHelper = {
|
|
|
550
550
|
t.d = c * sinR + d * cosR;
|
|
551
551
|
},
|
|
552
552
|
rotateOfOuter(t, origin, rotation) {
|
|
553
|
-
M$c.toInnerPoint(t, origin, tempPoint$
|
|
554
|
-
M$c.rotateOfInner(t, tempPoint$
|
|
553
|
+
M$c.toInnerPoint(t, origin, tempPoint$6);
|
|
554
|
+
M$c.rotateOfInner(t, tempPoint$6, rotation);
|
|
555
555
|
},
|
|
556
556
|
rotateOfInner(t, origin, rotation) {
|
|
557
557
|
M$c.translateInner(t, origin.x, origin.y);
|
|
@@ -572,8 +572,8 @@ const MatrixHelper = {
|
|
|
572
572
|
}
|
|
573
573
|
},
|
|
574
574
|
skewOfOuter(t, origin, skewX, skewY) {
|
|
575
|
-
M$c.toInnerPoint(t, origin, tempPoint$
|
|
576
|
-
M$c.skewOfInner(t, tempPoint$
|
|
575
|
+
M$c.toInnerPoint(t, origin, tempPoint$6);
|
|
576
|
+
M$c.skewOfInner(t, tempPoint$6, skewX, skewY);
|
|
577
577
|
},
|
|
578
578
|
skewOfInner(t, origin, skewX, skewY = 0) {
|
|
579
579
|
M$c.translateInner(t, origin.x, origin.y);
|
|
@@ -772,7 +772,7 @@ const M$c = MatrixHelper;
|
|
|
772
772
|
|
|
773
773
|
const {float: float$5} = MathHelper;
|
|
774
774
|
|
|
775
|
-
const {toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$
|
|
775
|
+
const {toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$4} = MatrixHelper;
|
|
776
776
|
|
|
777
777
|
const {sin: sin$5, cos: cos$5, abs: abs$b, sqrt: sqrt$4, atan2: atan2$2, min: min$3, round: round$5} = Math;
|
|
778
778
|
|
|
@@ -830,7 +830,7 @@ const PointHelper = {
|
|
|
830
830
|
tempToOuterOf(t, matrix) {
|
|
831
831
|
const {tempPoint: temp} = P$7;
|
|
832
832
|
copy$c(temp, t);
|
|
833
|
-
toOuterPoint$
|
|
833
|
+
toOuterPoint$4(matrix, temp, temp);
|
|
834
834
|
return temp;
|
|
835
835
|
},
|
|
836
836
|
tempToInnerRadiusPointOf(t, matrix) {
|
|
@@ -854,7 +854,7 @@ const PointHelper = {
|
|
|
854
854
|
toInnerPoint$2(matrix, t, to);
|
|
855
855
|
},
|
|
856
856
|
toOuterOf(t, matrix, to) {
|
|
857
|
-
toOuterPoint$
|
|
857
|
+
toOuterPoint$4(matrix, t, to);
|
|
858
858
|
},
|
|
859
859
|
getCenter(t, to) {
|
|
860
860
|
return {
|
|
@@ -995,7 +995,7 @@ class Point {
|
|
|
995
995
|
}
|
|
996
996
|
}
|
|
997
997
|
|
|
998
|
-
const tempPoint$
|
|
998
|
+
const tempPoint$5 = new Point;
|
|
999
999
|
|
|
1000
1000
|
class Matrix {
|
|
1001
1001
|
constructor(a, b, c, d, e, f) {
|
|
@@ -1264,7 +1264,7 @@ const AlignHelper = {
|
|
|
1264
1264
|
|
|
1265
1265
|
const {tempPointBounds: tempPointBounds$1, setPoint: setPoint$5, addPoint: addPoint$3, toBounds: toBounds$3} = TwoPointBoundsHelper;
|
|
1266
1266
|
|
|
1267
|
-
const {toOuterPoint: toOuterPoint$
|
|
1267
|
+
const {toOuterPoint: toOuterPoint$3} = MatrixHelper;
|
|
1268
1268
|
|
|
1269
1269
|
const {float: float$4, fourNumber: fourNumber$1} = MathHelper;
|
|
1270
1270
|
|
|
@@ -1378,16 +1378,16 @@ const BoundsHelper = {
|
|
|
1378
1378
|
} else {
|
|
1379
1379
|
point$2.x = t.x;
|
|
1380
1380
|
point$2.y = t.y;
|
|
1381
|
-
toOuterPoint$
|
|
1381
|
+
toOuterPoint$3(matrix, point$2, toPoint$5);
|
|
1382
1382
|
setPoint$5(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
|
|
1383
1383
|
point$2.x = t.x + t.width;
|
|
1384
|
-
toOuterPoint$
|
|
1384
|
+
toOuterPoint$3(matrix, point$2, toPoint$5);
|
|
1385
1385
|
addPoint$3(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
|
|
1386
1386
|
point$2.y = t.y + t.height;
|
|
1387
|
-
toOuterPoint$
|
|
1387
|
+
toOuterPoint$3(matrix, point$2, toPoint$5);
|
|
1388
1388
|
addPoint$3(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
|
|
1389
1389
|
point$2.x = t.x;
|
|
1390
|
-
toOuterPoint$
|
|
1390
|
+
toOuterPoint$3(matrix, point$2, toPoint$5);
|
|
1391
1391
|
addPoint$3(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
|
|
1392
1392
|
toBounds$3(tempPointBounds$1, to);
|
|
1393
1393
|
}
|
|
@@ -2708,7 +2708,7 @@ const {set: set$1, toNumberPoints: toNumberPoints$1} = PointHelper;
|
|
|
2708
2708
|
|
|
2709
2709
|
const {M: M$b, L: L$b, C: C$9, Q: Q$7, Z: Z$9} = PathCommandMap;
|
|
2710
2710
|
|
|
2711
|
-
const tempPoint$
|
|
2711
|
+
const tempPoint$4 = {};
|
|
2712
2712
|
|
|
2713
2713
|
const BezierHelper = {
|
|
2714
2714
|
points(data, originPoints, curve, close) {
|
|
@@ -2879,8 +2879,8 @@ const BezierHelper = {
|
|
|
2879
2879
|
addMode ? addPoint$2(pointBounds, fromX, fromY) : setPoint$4(pointBounds, fromX, fromY);
|
|
2880
2880
|
addPoint$2(pointBounds, toX, toY);
|
|
2881
2881
|
for (let i = 0, len = tList.length; i < len; i++) {
|
|
2882
|
-
getPointAndSet(tList[i], fromX, fromY, x1, y1, x2, y2, toX, toY, tempPoint$
|
|
2883
|
-
addPoint$2(pointBounds, tempPoint$
|
|
2882
|
+
getPointAndSet(tList[i], fromX, fromY, x1, y1, x2, y2, toX, toY, tempPoint$4);
|
|
2883
|
+
addPoint$2(pointBounds, tempPoint$4.x, tempPoint$4.y);
|
|
2884
2884
|
}
|
|
2885
2885
|
},
|
|
2886
2886
|
getPointAndSet(t, fromX, fromY, x1, y1, x2, y2, toX, toY, setPoint) {
|
|
@@ -3048,7 +3048,8 @@ const PathConvert = {
|
|
|
3048
3048
|
current.length = PathCommandLengthMap[char];
|
|
3049
3049
|
current.index = 0;
|
|
3050
3050
|
pushData(data, current.name);
|
|
3051
|
-
if (char === "m") current.name = PathCommandMap["l"]; else if (char === "M") current.name = PathCommandMap["L"];
|
|
3051
|
+
if (char === "m") current.name = PathCommandMap["l"]; else if (char === "M") current.name = PathCommandMap["L"];
|
|
3052
|
+
if (!needConvert && convertCommand[char]) needConvert = true;
|
|
3052
3053
|
} else {
|
|
3053
3054
|
if (char === "-" || char === "+") {
|
|
3054
3055
|
if (lastChar === "e" || lastChar === "E") {
|
|
@@ -3124,8 +3125,8 @@ const PathConvert = {
|
|
|
3124
3125
|
|
|
3125
3126
|
case S$1:
|
|
3126
3127
|
smooth = lastCommand === C$8 || lastCommand === S$1;
|
|
3127
|
-
x1 = smooth ? x * 2 - controlX :
|
|
3128
|
-
y1 = smooth ? y * 2 - controlY :
|
|
3128
|
+
x1 = smooth ? x * 2 - controlX : x;
|
|
3129
|
+
y1 = smooth ? y * 2 - controlY : y;
|
|
3129
3130
|
controlX = old[i + 1];
|
|
3130
3131
|
controlY = old[i + 2];
|
|
3131
3132
|
x = old[i + 3];
|
|
@@ -3159,8 +3160,8 @@ const PathConvert = {
|
|
|
3159
3160
|
|
|
3160
3161
|
case T:
|
|
3161
3162
|
smooth = lastCommand === Q$6 || lastCommand === T;
|
|
3162
|
-
controlX = smooth ? x * 2 - controlX :
|
|
3163
|
-
controlY = smooth ? y * 2 - controlY :
|
|
3163
|
+
controlX = smooth ? x * 2 - controlX : x;
|
|
3164
|
+
controlY = smooth ? y * 2 - controlY : y;
|
|
3164
3165
|
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]);
|
|
3165
3166
|
x = old[i + 1];
|
|
3166
3167
|
y = old[i + 2];
|
|
@@ -4769,7 +4770,7 @@ function registerUIEvent() {
|
|
|
4769
4770
|
};
|
|
4770
4771
|
}
|
|
4771
4772
|
|
|
4772
|
-
const {copy: copy$8, toInnerPoint: toInnerPoint$1, toOuterPoint: toOuterPoint$
|
|
4773
|
+
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;
|
|
4773
4774
|
|
|
4774
4775
|
const matrix$3 = {}, {round: round$3} = Math;
|
|
4775
4776
|
|
|
@@ -4852,7 +4853,7 @@ const LeafHelper = {
|
|
|
4852
4853
|
x: x,
|
|
4853
4854
|
y: y
|
|
4854
4855
|
};
|
|
4855
|
-
isInnerPoint ? toOuterPoint$
|
|
4856
|
+
isInnerPoint ? toOuterPoint$2(t.localTransform, local, local, true) : t.parent && toInnerPoint$1(t.parent.scrollWorldTransform, local, local, true);
|
|
4856
4857
|
L$5.moveLocal(t, local.x, local.y, transition);
|
|
4857
4858
|
},
|
|
4858
4859
|
moveLocal(t, x, y = 0, transition) {
|
|
@@ -4865,10 +4866,10 @@ const LeafHelper = {
|
|
|
4865
4866
|
y: y
|
|
4866
4867
|
}, transition) : (t.x = x, t.y = y);
|
|
4867
4868
|
},
|
|
4868
|
-
zoomOfWorld(t, origin, scaleX, scaleY, resize, transition) {
|
|
4869
|
-
L$5.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY, resize, transition);
|
|
4869
|
+
zoomOfWorld(t, origin, scaleX, scaleY, resize, transition, boundsType) {
|
|
4870
|
+
L$5.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY, resize, transition, boundsType);
|
|
4870
4871
|
},
|
|
4871
|
-
zoomOfLocal(t, origin, scaleX, scaleY = scaleX, resize, transition) {
|
|
4872
|
+
zoomOfLocal(t, origin, scaleX, scaleY = scaleX, resize, transition, boundsType) {
|
|
4872
4873
|
const o = t.__localMatrix;
|
|
4873
4874
|
if (!isNumber(scaleY)) {
|
|
4874
4875
|
if (scaleY) transition = scaleY;
|
|
@@ -4877,7 +4878,7 @@ const LeafHelper = {
|
|
|
4877
4878
|
copy$8(matrix$3, o);
|
|
4878
4879
|
scaleOfOuter$2(matrix$3, origin, scaleX, scaleY);
|
|
4879
4880
|
if (L$5.hasHighPosition(t)) {
|
|
4880
|
-
L$5.setTransform(t, matrix$3, resize, transition);
|
|
4881
|
+
L$5.setTransform(t, matrix$3, resize, transition, boundsType);
|
|
4881
4882
|
} else {
|
|
4882
4883
|
const x = t.x + matrix$3.e - o.e, y = t.y + matrix$3.f - o.f;
|
|
4883
4884
|
if (transition && !resize) t.animate({
|
|
@@ -4885,7 +4886,7 @@ const LeafHelper = {
|
|
|
4885
4886
|
y: y,
|
|
4886
4887
|
scaleX: t.scaleX * scaleX,
|
|
4887
4888
|
scaleY: t.scaleY * scaleY
|
|
4888
|
-
}, transition); else t.x = x, t.y = y, t.scaleResize(scaleX, scaleY, resize !== true);
|
|
4889
|
+
}, transition); else t.x = x, t.y = y, t.scaleResize(scaleX, scaleY, resize !== true, boundsType);
|
|
4889
4890
|
}
|
|
4890
4891
|
},
|
|
4891
4892
|
rotateOfWorld(t, origin, angle, transition) {
|
|
@@ -4909,18 +4910,18 @@ const LeafHelper = {
|
|
|
4909
4910
|
skewOfOuter(matrix$3, origin, skewX, skewY);
|
|
4910
4911
|
L$5.setTransform(t, matrix$3, resize, transition);
|
|
4911
4912
|
},
|
|
4912
|
-
transformWorld(t, transform, resize, transition) {
|
|
4913
|
+
transformWorld(t, transform, resize, transition, boundsType) {
|
|
4913
4914
|
copy$8(matrix$3, t.worldTransform);
|
|
4914
4915
|
multiplyParent$3(matrix$3, transform);
|
|
4915
4916
|
if (t.parent) divideParent(matrix$3, t.parent.scrollWorldTransform);
|
|
4916
|
-
L$5.setTransform(t, matrix$3, resize, transition);
|
|
4917
|
+
L$5.setTransform(t, matrix$3, resize, transition, boundsType);
|
|
4917
4918
|
},
|
|
4918
|
-
transform(t, transform, resize, transition) {
|
|
4919
|
+
transform(t, transform, resize, transition, boundsType) {
|
|
4919
4920
|
copy$8(matrix$3, t.localTransform);
|
|
4920
4921
|
multiplyParent$3(matrix$3, transform);
|
|
4921
|
-
L$5.setTransform(t, matrix$3, resize, transition);
|
|
4922
|
+
L$5.setTransform(t, matrix$3, resize, transition, boundsType);
|
|
4922
4923
|
},
|
|
4923
|
-
setTransform(t, transform, resize, transition) {
|
|
4924
|
+
setTransform(t, transform, resize, transition, boundsType) {
|
|
4924
4925
|
const data = t.__, originPoint = data.origin && L$5.getInnerOrigin(t, data.origin);
|
|
4925
4926
|
const layout = getLayout(transform, originPoint, data.around && L$5.getInnerOrigin(t, data.around));
|
|
4926
4927
|
if (L$5.hasOffset(t)) {
|
|
@@ -4936,7 +4937,7 @@ const LeafHelper = {
|
|
|
4936
4937
|
PointHelper.move(layout, originPoint.x - changedPoint.x, originPoint.y - changedPoint.y);
|
|
4937
4938
|
}
|
|
4938
4939
|
t.set(layout);
|
|
4939
|
-
t.scaleResize(scaleX, scaleY, false);
|
|
4940
|
+
t.scaleResize(scaleX, scaleY, false, boundsType);
|
|
4940
4941
|
} else t.set(layout, transition);
|
|
4941
4942
|
},
|
|
4942
4943
|
getFlipTransform(t, axis) {
|
|
@@ -5146,12 +5147,12 @@ const BranchHelper = {
|
|
|
5146
5147
|
w.height *= scaleY;
|
|
5147
5148
|
w.scaleX *= scaleX;
|
|
5148
5149
|
w.scaleY *= scaleY;
|
|
5149
|
-
if (branch.isBranch) scale$
|
|
5150
|
+
if (branch.isBranch) scale$4(branch, x, y, scaleX, scaleY, a, b);
|
|
5150
5151
|
}
|
|
5151
5152
|
}
|
|
5152
5153
|
};
|
|
5153
5154
|
|
|
5154
|
-
const {pushAllChildBranch: pushAllChildBranch$1, pushAllBranchStack: pushAllBranchStack, updateBoundsByBranchStack: updateBoundsByBranchStack, move: move$9, scale: scale$
|
|
5155
|
+
const {pushAllChildBranch: pushAllChildBranch$1, pushAllBranchStack: pushAllBranchStack, updateBoundsByBranchStack: updateBoundsByBranchStack, move: move$9, scale: scale$4} = BranchHelper;
|
|
5155
5156
|
|
|
5156
5157
|
const WaitHelper = {
|
|
5157
5158
|
run(wait) {
|
|
@@ -6027,7 +6028,7 @@ const LeafDataProxy = {
|
|
|
6027
6028
|
|
|
6028
6029
|
const {setLayout: setLayout, multiplyParent: multiplyParent$2, translateInner: translateInner, defaultWorld: defaultWorld} = MatrixHelper;
|
|
6029
6030
|
|
|
6030
|
-
const {toPoint: toPoint$4, tempPoint: tempPoint$
|
|
6031
|
+
const {toPoint: toPoint$4, tempPoint: tempPoint$3} = AroundHelper;
|
|
6031
6032
|
|
|
6032
6033
|
const LeafMatrix = {
|
|
6033
6034
|
__updateWorldMatrix() {
|
|
@@ -6048,8 +6049,8 @@ const LeafMatrix = {
|
|
|
6048
6049
|
local.e = data.x + data.offsetX;
|
|
6049
6050
|
local.f = data.y + data.offsetY;
|
|
6050
6051
|
if (data.around || data.origin) {
|
|
6051
|
-
toPoint$4(data.around || data.origin, layout.boxBounds, tempPoint$
|
|
6052
|
-
translateInner(local, -tempPoint$
|
|
6052
|
+
toPoint$4(data.around || data.origin, layout.boxBounds, tempPoint$3);
|
|
6053
|
+
translateInner(local, -tempPoint$3.x, -tempPoint$3.y, !data.around);
|
|
6053
6054
|
}
|
|
6054
6055
|
}
|
|
6055
6056
|
this.__layout.matrixChanged = undefined;
|
|
@@ -6281,7 +6282,7 @@ const {LEAF: LEAF, create: create} = IncrementId;
|
|
|
6281
6282
|
|
|
6282
6283
|
const {stintSet: stintSet$6} = DataHelper;
|
|
6283
6284
|
|
|
6284
|
-
const {toInnerPoint: toInnerPoint, toOuterPoint: toOuterPoint, multiplyParent: multiplyParent$1} = MatrixHelper;
|
|
6285
|
+
const {toInnerPoint: toInnerPoint, toOuterPoint: toOuterPoint$1, multiplyParent: multiplyParent$1} = MatrixHelper;
|
|
6285
6286
|
|
|
6286
6287
|
const {toOuterOf: toOuterOf$1} = BoundsHelper;
|
|
6287
6288
|
|
|
@@ -6620,7 +6621,7 @@ let Leaf = class Leaf {
|
|
|
6620
6621
|
toInnerPoint(this.worldTransform, world, to, distance);
|
|
6621
6622
|
}
|
|
6622
6623
|
innerToWorld(inner, to, distance, relative) {
|
|
6623
|
-
toOuterPoint(this.worldTransform, inner, to, distance);
|
|
6624
|
+
toOuterPoint$1(this.worldTransform, inner, to, distance);
|
|
6624
6625
|
if (relative) relative.worldToInner(to ? to : inner, null, distance);
|
|
6625
6626
|
}
|
|
6626
6627
|
getBoxPoint(world, relative, distance, change) {
|
|
@@ -6675,11 +6676,11 @@ let Leaf = class Leaf {
|
|
|
6675
6676
|
const layer = this.leafer ? this.leafer.zoomLayer : this;
|
|
6676
6677
|
return layer.getWorldPoint(page, relative, distance, change);
|
|
6677
6678
|
}
|
|
6678
|
-
setTransform(matrix, resize, transition) {
|
|
6679
|
-
setTransform(this, matrix, resize, transition);
|
|
6679
|
+
setTransform(matrix, resize, transition, boundsType) {
|
|
6680
|
+
setTransform(this, matrix, resize, transition, boundsType);
|
|
6680
6681
|
}
|
|
6681
|
-
transform(matrix, resize, transition) {
|
|
6682
|
-
transform(this, matrix, resize, transition);
|
|
6682
|
+
transform(matrix, resize, transition, boundsType) {
|
|
6683
|
+
transform(this, matrix, resize, transition, boundsType);
|
|
6683
6684
|
}
|
|
6684
6685
|
move(x, y, transition) {
|
|
6685
6686
|
moveLocal(this, x, y, transition);
|
|
@@ -6687,8 +6688,8 @@ let Leaf = class Leaf {
|
|
|
6687
6688
|
moveInner(x, y, transition) {
|
|
6688
6689
|
moveWorld(this, x, y, true, transition);
|
|
6689
6690
|
}
|
|
6690
|
-
scaleOf(origin, scaleX, scaleY, resize, transition) {
|
|
6691
|
-
zoomOfLocal(this, getLocalOrigin(this, origin), scaleX, scaleY, resize, transition);
|
|
6691
|
+
scaleOf(origin, scaleX, scaleY, resize, transition, boundsType) {
|
|
6692
|
+
zoomOfLocal(this, getLocalOrigin(this, origin), scaleX, scaleY, resize, transition, boundsType);
|
|
6692
6693
|
}
|
|
6693
6694
|
rotateOf(origin, rotation, transition) {
|
|
6694
6695
|
rotateOfLocal(this, getLocalOrigin(this, origin), rotation, transition);
|
|
@@ -6696,14 +6697,14 @@ let Leaf = class Leaf {
|
|
|
6696
6697
|
skewOf(origin, skewX, skewY, resize, transition) {
|
|
6697
6698
|
skewOfLocal(this, getLocalOrigin(this, origin), skewX, skewY, resize, transition);
|
|
6698
6699
|
}
|
|
6699
|
-
transformWorld(worldTransform, resize, transition) {
|
|
6700
|
-
transformWorld(this, worldTransform, resize, transition);
|
|
6700
|
+
transformWorld(worldTransform, resize, transition, boundsType) {
|
|
6701
|
+
transformWorld(this, worldTransform, resize, transition, boundsType);
|
|
6701
6702
|
}
|
|
6702
6703
|
moveWorld(x, y, transition) {
|
|
6703
6704
|
moveWorld(this, x, y, false, transition);
|
|
6704
6705
|
}
|
|
6705
|
-
scaleOfWorld(worldOrigin, scaleX, scaleY, resize, transition) {
|
|
6706
|
-
zoomOfWorld(this, worldOrigin, scaleX, scaleY, resize, transition);
|
|
6706
|
+
scaleOfWorld(worldOrigin, scaleX, scaleY, resize, transition, boundsType) {
|
|
6707
|
+
zoomOfWorld(this, worldOrigin, scaleX, scaleY, resize, transition, boundsType);
|
|
6707
6708
|
}
|
|
6708
6709
|
rotateOfWorld(worldOrigin, rotation) {
|
|
6709
6710
|
rotateOfWorld(this, worldOrigin, rotation);
|
|
@@ -6714,7 +6715,7 @@ let Leaf = class Leaf {
|
|
|
6714
6715
|
flip(axis, transition) {
|
|
6715
6716
|
transform(this, getFlipTransform(this, axis), false, transition);
|
|
6716
6717
|
}
|
|
6717
|
-
scaleResize(scaleX, scaleY = scaleX, _noResize) {
|
|
6718
|
+
scaleResize(scaleX, scaleY = scaleX, _noResize, _boundsType) {
|
|
6718
6719
|
this.scaleX *= scaleX;
|
|
6719
6720
|
this.scaleY *= scaleY;
|
|
6720
6721
|
}
|
|
@@ -7089,7 +7090,7 @@ class LeafLevelList {
|
|
|
7089
7090
|
}
|
|
7090
7091
|
}
|
|
7091
7092
|
|
|
7092
|
-
const version = "2.1.
|
|
7093
|
+
const version = "2.1.4";
|
|
7093
7094
|
|
|
7094
7095
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
7095
7096
|
get allowBackgroundColor() {
|
|
@@ -7746,7 +7747,7 @@ class Renderer {
|
|
|
7746
7747
|
|
|
7747
7748
|
Renderer.clipSpread = 10;
|
|
7748
7749
|
|
|
7749
|
-
const tempPoint$
|
|
7750
|
+
const tempPoint$2 = {};
|
|
7750
7751
|
|
|
7751
7752
|
const {copyRadiusPoint: copyRadiusPoint$1} = PointHelper;
|
|
7752
7753
|
|
|
@@ -7881,7 +7882,7 @@ class Picker {
|
|
|
7881
7882
|
for (let i = len - 1; i > -1; i--) {
|
|
7882
7883
|
child = children[i], data = child.__;
|
|
7883
7884
|
if (!data.visible || hitMask && !data.mask) continue;
|
|
7884
|
-
hit = hitRadiusPoint$1(child.__world, data.hitRadius ? copyRadiusPoint$1(tempPoint$
|
|
7885
|
+
hit = hitRadiusPoint$1(child.__world, data.hitRadius ? copyRadiusPoint$1(tempPoint$2, point, data.hitRadius) : point);
|
|
7885
7886
|
if (child.isBranch) {
|
|
7886
7887
|
if (hit || child.__ignoreHitWorld) {
|
|
7887
7888
|
if (child.isBranchLeaf && data.__clipAfterFill && !child.__hitWorld(point, true)) continue;
|
|
@@ -12105,7 +12106,7 @@ function layout$3(transform, box, x, y, scaleX, scaleY, rotation, skew) {
|
|
|
12105
12106
|
translate(transform, box.x + x, box.y + y);
|
|
12106
12107
|
}
|
|
12107
12108
|
|
|
12108
|
-
const {get: get$1, scale: scale$
|
|
12109
|
+
const {get: get$1, scale: scale$3, copy: copy$4} = MatrixHelper;
|
|
12109
12110
|
|
|
12110
12111
|
const {getFloorScale: getFloorScale} = MathHelper, {abs: abs$7} = Math;
|
|
12111
12112
|
|
|
@@ -12143,7 +12144,7 @@ function createPattern(paint, ui, canvas, renderOptions) {
|
|
|
12143
12144
|
scaleY *= getFloorScale(height + (yGap || 0));
|
|
12144
12145
|
imageMatrix = get$1();
|
|
12145
12146
|
if (transform) copy$4(imageMatrix, transform);
|
|
12146
|
-
scale$
|
|
12147
|
+
scale$3(imageMatrix, 1 / scaleX, 1 / scaleY);
|
|
12147
12148
|
}
|
|
12148
12149
|
const imageCanvas = image.getCanvas(width, height, opacity, undefined, xGap, yGap, ui.leafer && ui.leafer.config.smooth, data.interlace);
|
|
12149
12150
|
if (brush) {
|
|
@@ -13236,10 +13237,11 @@ function mergeConfigAttr() {
|
|
|
13236
13237
|
if (innerEditor) innerEditor.editConfig && Object.assign(mergeConfig, innerEditor.editConfig); else if (editTool) editTool.editConfig && Object.assign(mergeConfig, editTool.editConfig);
|
|
13237
13238
|
if (element && element.editConfig) {
|
|
13238
13239
|
let {editConfig: editConfig} = element;
|
|
13239
|
-
if (editConfig.hover || editConfig.hoverStyle) {
|
|
13240
|
+
if (editConfig.hover || editConfig.hoverStyle || editConfig.hoverPathType) {
|
|
13240
13241
|
editConfig = Object.assign({}, editConfig);
|
|
13241
13242
|
delete editConfig.hover;
|
|
13242
13243
|
delete editConfig.hoverStyle;
|
|
13244
|
+
delete editConfig.hoverPathType;
|
|
13243
13245
|
}
|
|
13244
13246
|
Object.assign(mergeConfig, editConfig);
|
|
13245
13247
|
}
|
|
@@ -13307,9 +13309,22 @@ class Stroker extends UI {
|
|
|
13307
13309
|
matrix$1.half = strokeWidth % 2;
|
|
13308
13310
|
canvas.setWorld(matrix$1, options.matrix);
|
|
13309
13311
|
canvas.beginPath();
|
|
13310
|
-
|
|
13312
|
+
switch (this.strokePathType) {
|
|
13313
|
+
case "box":
|
|
13314
|
+
const {boxBounds: boxBounds} = leaf.__layout;
|
|
13315
|
+
canvas.rect(boxBounds.x, boxBounds.y, boxBounds.width, boxBounds.height);
|
|
13316
|
+
break;
|
|
13317
|
+
|
|
13318
|
+
case "stroke":
|
|
13319
|
+
const {strokeBounds: strokeBounds} = leaf.__layout;
|
|
13320
|
+
canvas.rect(strokeBounds.x, strokeBounds.y, strokeBounds.width, strokeBounds.height);
|
|
13321
|
+
break;
|
|
13322
|
+
|
|
13323
|
+
case "path":
|
|
13311
13324
|
leaf.__drawPath(canvas);
|
|
13312
|
-
|
|
13325
|
+
break;
|
|
13326
|
+
|
|
13327
|
+
default:
|
|
13313
13328
|
if (leaf.__.__useArrow) leaf.__drawPath(canvas); else leaf.__.__pathForRender ? leaf.__drawRenderPath(canvas) : leaf.__drawPathByBox(canvas);
|
|
13314
13329
|
}
|
|
13315
13330
|
data.strokeWidth = strokeWidth / Math.max(aScaleX, aScaleY);
|
|
@@ -13432,10 +13447,11 @@ class EditSelect extends Group {
|
|
|
13432
13447
|
if (this.running && !this.dragging && !editor.dragging) {
|
|
13433
13448
|
const {hoverTarget: hoverTarget, mergeConfig: mergeConfig} = editor, config = Object.assign({}, mergeConfig);
|
|
13434
13449
|
if (hoverTarget && hoverTarget.editConfig) Object.assign(config, hoverTarget.editConfig);
|
|
13435
|
-
const {stroke: stroke, strokeWidth: strokeWidth, hover: hover, hoverStyle: hoverStyle} = config;
|
|
13450
|
+
const {stroke: stroke, strokeWidth: strokeWidth, hover: hover, hoverStyle: hoverStyle, hoverPathType: hoverPathType} = config;
|
|
13436
13451
|
this.hoverStroker.setTarget(hover ? hoverTarget : null, Object.assign({
|
|
13437
13452
|
stroke: stroke,
|
|
13438
|
-
strokeWidth: strokeWidth
|
|
13453
|
+
strokeWidth: strokeWidth,
|
|
13454
|
+
strokePathType: hoverPathType
|
|
13439
13455
|
}, hoverStyle || {}));
|
|
13440
13456
|
} else {
|
|
13441
13457
|
this.hoverStroker.target = null;
|
|
@@ -13618,16 +13634,17 @@ const {topLeft: topLeft$1, top: top$1, topRight: topRight$1, right: right$2, bot
|
|
|
13618
13634
|
const {toPoint: toPoint} = AroundHelper, {within: within$3, sign: sign$1} = MathHelper, {abs: abs$4} = Math;
|
|
13619
13635
|
|
|
13620
13636
|
const EditDataHelper = {
|
|
13621
|
-
getScaleData(target, startBounds, direction, totalMoveOrScale, lockRatio, around, flipable, scaleMode) {
|
|
13637
|
+
getScaleData(target, startBounds, direction, totalMoveOrScale, lockRatio, around, flipable, scaleMode, boundsType) {
|
|
13622
13638
|
let align, origin = {}, scaleX = 1, scaleY = 1, lockScale;
|
|
13623
|
-
const {
|
|
13639
|
+
const {widthRange: widthRange, heightRange: heightRange, dragBounds: dragBounds, worldTransform: worldTransform, boxBounds: boxBounds} = target;
|
|
13624
13640
|
const {width: width, height: height} = startBounds;
|
|
13641
|
+
const innerBounds = target.getBounds(boundsType, "inner");
|
|
13625
13642
|
const originChangedScaleX = target.scaleX / startBounds.scaleX;
|
|
13626
13643
|
const originChangedScaleY = target.scaleY / startBounds.scaleY;
|
|
13627
13644
|
const signX = sign$1(originChangedScaleX);
|
|
13628
13645
|
const signY = sign$1(originChangedScaleY);
|
|
13629
|
-
const changedScaleX = scaleMode ? originChangedScaleX : signX *
|
|
13630
|
-
const changedScaleY = scaleMode ? originChangedScaleY : signY *
|
|
13646
|
+
const changedScaleX = scaleMode ? originChangedScaleX : signX * innerBounds.width / width;
|
|
13647
|
+
const changedScaleY = scaleMode ? originChangedScaleY : signY * innerBounds.height / height;
|
|
13631
13648
|
if (isNumber(totalMoveOrScale)) {
|
|
13632
13649
|
scaleX = scaleY = Math.sqrt(totalMoveOrScale);
|
|
13633
13650
|
} else {
|
|
@@ -13713,10 +13730,11 @@ const EditDataHelper = {
|
|
|
13713
13730
|
if (useScaleY) scaleY /= changedScaleY;
|
|
13714
13731
|
if (!flipable) {
|
|
13715
13732
|
const {worldTransform: worldTransform} = target;
|
|
13716
|
-
if (scaleX < 0) scaleX = 1 /
|
|
13717
|
-
if (scaleY < 0) scaleY = 1 /
|
|
13733
|
+
if (scaleX < 0) scaleX = 1 / innerBounds.width / worldTransform.scaleX;
|
|
13734
|
+
if (scaleY < 0) scaleY = 1 / innerBounds.height / worldTransform.scaleY;
|
|
13718
13735
|
}
|
|
13719
|
-
toPoint(around || align,
|
|
13736
|
+
toPoint(around || align, innerBounds, origin, true);
|
|
13737
|
+
this.checkOrigin(target, origin, boundsType);
|
|
13720
13738
|
if (dragBounds) {
|
|
13721
13739
|
const scaleData = {
|
|
13722
13740
|
x: scaleX,
|
|
@@ -13727,15 +13745,20 @@ const EditDataHelper = {
|
|
|
13727
13745
|
scaleY = scaleData.y;
|
|
13728
13746
|
}
|
|
13729
13747
|
if (useScaleX && widthRange) {
|
|
13730
|
-
const nowWidth =
|
|
13748
|
+
const nowWidth = innerBounds.width * target.scaleX;
|
|
13731
13749
|
scaleX = within$3(nowWidth * scaleX, widthRange) / nowWidth;
|
|
13732
13750
|
}
|
|
13733
13751
|
if (useScaleY && heightRange) {
|
|
13734
|
-
const nowHeight =
|
|
13752
|
+
const nowHeight = innerBounds.height * target.scaleY;
|
|
13735
13753
|
scaleY = within$3(nowHeight * scaleY, heightRange) / nowHeight;
|
|
13736
13754
|
}
|
|
13737
|
-
|
|
13738
|
-
if (
|
|
13755
|
+
let minWidth = 1 * abs$4(worldTransform.scaleX), minHeight = 1 * abs$4(worldTransform.scaleY);
|
|
13756
|
+
if (boundsType !== "box") {
|
|
13757
|
+
minWidth += innerBounds.width - boxBounds.width;
|
|
13758
|
+
minHeight += innerBounds.height - boxBounds.height;
|
|
13759
|
+
}
|
|
13760
|
+
if (useScaleX && abs$4(scaleX * innerBounds.width) < minWidth) scaleX = sign$1(scaleX) * minWidth / innerBounds.width;
|
|
13761
|
+
if (useScaleY && abs$4(scaleY * innerBounds.height) < minHeight) scaleY = sign$1(scaleY) * minHeight / innerBounds.height;
|
|
13739
13762
|
if (lockRatio && scaleX !== scaleY) {
|
|
13740
13763
|
lockScale = Math.min(abs$4(scaleX), abs$4(scaleY));
|
|
13741
13764
|
scaleX = sign$1(scaleX) * lockScale;
|
|
@@ -13752,7 +13775,7 @@ const EditDataHelper = {
|
|
|
13752
13775
|
around: around
|
|
13753
13776
|
};
|
|
13754
13777
|
},
|
|
13755
|
-
getRotateData(target, direction, current, last, around) {
|
|
13778
|
+
getRotateData(target, direction, current, last, around, boundsType) {
|
|
13756
13779
|
let align, origin = {};
|
|
13757
13780
|
switch (direction) {
|
|
13758
13781
|
case topLeft$1:
|
|
@@ -13774,13 +13797,14 @@ const EditDataHelper = {
|
|
|
13774
13797
|
default:
|
|
13775
13798
|
align = "center";
|
|
13776
13799
|
}
|
|
13777
|
-
toPoint(around || align, target.
|
|
13800
|
+
toPoint(around || align, target.getBounds(boundsType, "inner"), origin, true);
|
|
13801
|
+
this.checkOrigin(target, origin, boundsType);
|
|
13778
13802
|
return {
|
|
13779
13803
|
origin: origin,
|
|
13780
13804
|
rotation: PointHelper.getRotation(last, target.getWorldPointByBox(origin), current)
|
|
13781
13805
|
};
|
|
13782
13806
|
},
|
|
13783
|
-
getSkewData(
|
|
13807
|
+
getSkewData(target, direction, move, around, boundsType) {
|
|
13784
13808
|
let align, origin = {}, skewX = 0, skewY = 0;
|
|
13785
13809
|
let last;
|
|
13786
13810
|
switch (direction) {
|
|
@@ -13823,10 +13847,12 @@ const EditDataHelper = {
|
|
|
13823
13847
|
align = "left";
|
|
13824
13848
|
skewY = 1;
|
|
13825
13849
|
}
|
|
13826
|
-
const
|
|
13850
|
+
const innerBounds = target.getBounds(boundsType, "inner");
|
|
13851
|
+
const {width: width, height: height} = innerBounds;
|
|
13827
13852
|
last.x = last.x * width;
|
|
13828
13853
|
last.y = last.y * height;
|
|
13829
|
-
toPoint(around || align,
|
|
13854
|
+
toPoint(around || align, innerBounds, origin, true);
|
|
13855
|
+
this.checkOrigin(target, origin, boundsType);
|
|
13830
13856
|
const rotation = PointHelper.getRotation(last, origin, {
|
|
13831
13857
|
x: last.x + (skewX ? move.x : 0),
|
|
13832
13858
|
y: last.y + (skewY ? move.y : 0)
|
|
@@ -13838,6 +13864,13 @@ const EditDataHelper = {
|
|
|
13838
13864
|
skewY: skewY
|
|
13839
13865
|
};
|
|
13840
13866
|
},
|
|
13867
|
+
checkOrigin(target, origin, boundsType) {
|
|
13868
|
+
if (boundsType !== "box") {
|
|
13869
|
+
const {boxBounds: boxBounds} = target, innerBounds = target.getBounds(boundsType, "inner");
|
|
13870
|
+
origin.x += innerBounds.x - boxBounds.x;
|
|
13871
|
+
origin.y += innerBounds.y - boxBounds.y;
|
|
13872
|
+
}
|
|
13873
|
+
},
|
|
13841
13874
|
getAround(around, altKey) {
|
|
13842
13875
|
return altKey && !around ? "center" : around;
|
|
13843
13876
|
},
|
|
@@ -14108,8 +14141,8 @@ class EditBox extends Group {
|
|
|
14108
14141
|
updateMoveCursor(this);
|
|
14109
14142
|
}
|
|
14110
14143
|
update() {
|
|
14111
|
-
const {editor: editor} = this;
|
|
14112
|
-
const {x: x, y: y, scaleX: scaleX, scaleY: scaleY, rotation: rotation, skewX: skewX, skewY: skewY, width: width, height: height} = this.target.getLayoutBounds(
|
|
14144
|
+
const {editor: editor, mergeConfig: mergeConfig} = this;
|
|
14145
|
+
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);
|
|
14113
14146
|
this.visible = !this.target.locked;
|
|
14114
14147
|
this.set({
|
|
14115
14148
|
x: x,
|
|
@@ -14132,9 +14165,9 @@ class EditBox extends Group {
|
|
|
14132
14165
|
if (this.app) this.rect.syncEventer = this.app.interaction.bottomList = null;
|
|
14133
14166
|
}
|
|
14134
14167
|
updateBounds(bounds) {
|
|
14135
|
-
const {editor: editor,
|
|
14168
|
+
const {editor: editor, mergedConfig: mergedConfig, single: single, rect: rect, circle: circle, buttons: buttons, resizePoints: resizePoints, rotatePoints: rotatePoints, resizeLines: resizeLines} = this;
|
|
14136
14169
|
const {editMask: editMask} = editor;
|
|
14137
|
-
const {middlePoint: middlePoint, resizeable: resizeable, rotateable: rotateable, hideOnSmall: hideOnSmall, editBox: editBox, mask: mask, dimOthers: dimOthers, bright: bright, spread: spread, hideRotatePoints: hideRotatePoints, hideResizeLines: hideResizeLines} =
|
|
14170
|
+
const {middlePoint: middlePoint, resizeable: resizeable, rotateable: rotateable, hideOnSmall: hideOnSmall, editBox: editBox, mask: mask, dimOthers: dimOthers, bright: bright, spread: spread, hideRotatePoints: hideRotatePoints, hideResizeLines: hideResizeLines} = mergedConfig;
|
|
14138
14171
|
editMask.visible = mask ? true : 0;
|
|
14139
14172
|
if (!isUndefined(dimOthers) || !isUndefined(bright)) {
|
|
14140
14173
|
editor.setDimOthers(dimOthers);
|
|
@@ -14172,7 +14205,7 @@ class EditBox extends Group {
|
|
|
14172
14205
|
}
|
|
14173
14206
|
}
|
|
14174
14207
|
}
|
|
14175
|
-
circle.visible = showPoints && rotateable && !!(
|
|
14208
|
+
circle.visible = showPoints && rotateable && !!(mergedConfig.circle || mergedConfig.rotatePoint);
|
|
14176
14209
|
if (circle.visible) this.layoutCircle();
|
|
14177
14210
|
if (rect.path) rect.path = null;
|
|
14178
14211
|
rect.set(Object.assign(Object.assign({}, bounds), {
|
|
@@ -14280,7 +14313,8 @@ class EditBox extends Group {
|
|
|
14280
14313
|
this.dragPoint = null;
|
|
14281
14314
|
}
|
|
14282
14315
|
onTransformStart(e) {
|
|
14283
|
-
|
|
14316
|
+
const {hideOnMove: hideOnMove, editBoxType: editBoxType} = this.mergedConfig;
|
|
14317
|
+
if (this.moving || this.gesturing) this.editor.opacity = hideOnMove ? 0 : 1;
|
|
14284
14318
|
if (this.resizing) ResizeEvent.resizingKeys = this.editor.leafList.keys;
|
|
14285
14319
|
const {dragStartData: dragStartData, target: target} = this;
|
|
14286
14320
|
dragStartData.x = e.x;
|
|
@@ -14290,7 +14324,7 @@ class EditBox extends Group {
|
|
|
14290
14324
|
x: target.x,
|
|
14291
14325
|
y: target.y
|
|
14292
14326
|
};
|
|
14293
|
-
dragStartData.bounds = Object.assign({}, target.getLayoutBounds(
|
|
14327
|
+
dragStartData.bounds = Object.assign({}, target.getLayoutBounds(editBoxType, "local"));
|
|
14294
14328
|
dragStartData.rotation = target.rotation;
|
|
14295
14329
|
}
|
|
14296
14330
|
onTransformEnd(e) {
|
|
@@ -14528,6 +14562,7 @@ const config$1 = {
|
|
|
14528
14562
|
},
|
|
14529
14563
|
selector: true,
|
|
14530
14564
|
editBox: true,
|
|
14565
|
+
editBoxType: "box",
|
|
14531
14566
|
hover: true,
|
|
14532
14567
|
select: "press",
|
|
14533
14568
|
openInner: "double",
|
|
@@ -14852,7 +14887,7 @@ class TransformTool {
|
|
|
14852
14887
|
}
|
|
14853
14888
|
onScale(e) {
|
|
14854
14889
|
const {target: target, mergeConfig: mergeConfig, single: single, dragStartData: dragStartData} = this.editBox;
|
|
14855
|
-
let {around: around, lockRatio: lockRatio, flipable: flipable, editSize: editSize} = mergeConfig, totalMove;
|
|
14890
|
+
let {around: around, lockRatio: lockRatio, flipable: flipable, editSize: editSize, editBoxType: editBoxType} = mergeConfig, totalMove;
|
|
14856
14891
|
if (e instanceof ZoomEvent) {
|
|
14857
14892
|
if (!around) around = target.getBoxPoint(e);
|
|
14858
14893
|
totalMove = e.totalScale;
|
|
@@ -14861,7 +14896,7 @@ class TransformTool {
|
|
|
14861
14896
|
}
|
|
14862
14897
|
const {direction: direction} = e.current;
|
|
14863
14898
|
if (e.shiftKey || target.lockRatio) lockRatio = true;
|
|
14864
|
-
const data = EditDataHelper.getScaleData(target, dragStartData.bounds, direction, totalMove, lockRatio, EditDataHelper.getAround(around, e.altKey), flipable, !single || editSize === "scale");
|
|
14899
|
+
const data = EditDataHelper.getScaleData(target, dragStartData.bounds, direction, totalMove, lockRatio, EditDataHelper.getAround(around, e.altKey), flipable, !single || editSize === "scale", editBoxType);
|
|
14865
14900
|
const targetX = target.x, targetY = target.y;
|
|
14866
14901
|
if (e instanceof DragEvent && this.editTool && this.editTool.onScaleWithDrag) {
|
|
14867
14902
|
data.drag = e;
|
|
@@ -14873,7 +14908,7 @@ class TransformTool {
|
|
|
14873
14908
|
}
|
|
14874
14909
|
onRotate(e) {
|
|
14875
14910
|
const {target: target, mergeConfig: mergeConfig, dragStartData: dragStartData} = this.editBox;
|
|
14876
|
-
const {around: around, rotateAround: rotateAround, rotateGap: rotateGap, diagonalRotateKey: diagonalRotateKey} = mergeConfig;
|
|
14911
|
+
const {around: around, rotateAround: rotateAround, rotateGap: rotateGap, diagonalRotateKey: diagonalRotateKey, editBoxType: editBoxType} = mergeConfig;
|
|
14877
14912
|
const {direction: direction} = e.current;
|
|
14878
14913
|
let origin, rotation;
|
|
14879
14914
|
if (e instanceof RotateEvent) {
|
|
@@ -14881,7 +14916,7 @@ class TransformTool {
|
|
|
14881
14916
|
origin = rotateAround ? AroundHelper.getPoint(rotateAround, target.boxBounds) : target.getBoxPoint(e);
|
|
14882
14917
|
} else {
|
|
14883
14918
|
const isDiagonalRotate = diagonalRotateKey ? e.isHoldKeys(diagonalRotateKey) : e.shiftKey;
|
|
14884
|
-
const data = EditDataHelper.getRotateData(target, direction, e, dragStartData, isDiagonalRotate ? null : rotateAround || target.around || target.origin || around || "center");
|
|
14919
|
+
const data = EditDataHelper.getRotateData(target, direction, e, dragStartData, isDiagonalRotate ? null : rotateAround || target.around || target.origin || around || "center", editBoxType);
|
|
14885
14920
|
rotation = dragStartData.rotation + data.rotation - target.rotation;
|
|
14886
14921
|
origin = data.origin;
|
|
14887
14922
|
}
|
|
@@ -14893,8 +14928,8 @@ class TransformTool {
|
|
|
14893
14928
|
}
|
|
14894
14929
|
onSkew(e) {
|
|
14895
14930
|
const {target: target, mergeConfig: mergeConfig} = this.editBox;
|
|
14896
|
-
const {around: around} = mergeConfig;
|
|
14897
|
-
const {origin: origin, skewX: skewX, skewY: skewY} = EditDataHelper.getSkewData(target
|
|
14931
|
+
const {around: around, editBoxType: editBoxType} = mergeConfig;
|
|
14932
|
+
const {origin: origin, skewX: skewX, skewY: skewY} = EditDataHelper.getSkewData(target, e.current.direction, e.getInnerMove(target), EditDataHelper.getAround(around, e.altKey), editBoxType);
|
|
14898
14933
|
if (!skewX && !skewY) return;
|
|
14899
14934
|
this.skewOf(origin, skewX, skewY);
|
|
14900
14935
|
}
|
|
@@ -14955,7 +14990,7 @@ class TransformTool {
|
|
|
14955
14990
|
scaleOf(origin, scaleX, scaleY = scaleX, _resize) {
|
|
14956
14991
|
if (!this.checkTransform("resizeable")) return;
|
|
14957
14992
|
const {target: target, mergeConfig: mergeConfig, single: single, editor: editor} = this.editBox;
|
|
14958
|
-
const {beforeScale: beforeScale} = mergeConfig;
|
|
14993
|
+
const {beforeScale: beforeScale, editBoxType: editBoxType} = mergeConfig;
|
|
14959
14994
|
if (beforeScale) {
|
|
14960
14995
|
const check = beforeScale({
|
|
14961
14996
|
target: target,
|
|
@@ -14973,7 +15008,8 @@ class TransformTool {
|
|
|
14973
15008
|
worldOrigin: worldOrigin,
|
|
14974
15009
|
scaleX: scaleX,
|
|
14975
15010
|
scaleY: scaleY,
|
|
14976
|
-
transform: transform
|
|
15011
|
+
transform: transform,
|
|
15012
|
+
editBoxType: editBoxType
|
|
14977
15013
|
};
|
|
14978
15014
|
this.emitEvent(new EditorScaleEvent(EditorScaleEvent.BEFORE_SCALE, data));
|
|
14979
15015
|
const event = new EditorScaleEvent(EditorScaleEvent.SCALE, data);
|
|
@@ -15001,7 +15037,7 @@ class TransformTool {
|
|
|
15001
15037
|
rotateOf(origin, rotation) {
|
|
15002
15038
|
if (!this.checkTransform("rotateable")) return;
|
|
15003
15039
|
const {target: target, mergeConfig: mergeConfig, single: single, editor: editor} = this.editBox;
|
|
15004
|
-
const {beforeRotate: beforeRotate} = mergeConfig;
|
|
15040
|
+
const {beforeRotate: beforeRotate, editBoxType: editBoxType} = mergeConfig;
|
|
15005
15041
|
if (beforeRotate) {
|
|
15006
15042
|
const check = beforeRotate({
|
|
15007
15043
|
target: target,
|
|
@@ -15017,7 +15053,8 @@ class TransformTool {
|
|
|
15017
15053
|
editor: editor,
|
|
15018
15054
|
worldOrigin: worldOrigin,
|
|
15019
15055
|
rotation: rotation,
|
|
15020
|
-
transform: transform
|
|
15056
|
+
transform: transform,
|
|
15057
|
+
editBoxType: editBoxType
|
|
15021
15058
|
};
|
|
15022
15059
|
this.emitEvent(new EditorRotateEvent(EditorRotateEvent.BEFORE_ROTATE, data));
|
|
15023
15060
|
const event = new EditorRotateEvent(EditorRotateEvent.ROTATE, data);
|
|
@@ -15027,7 +15064,7 @@ class TransformTool {
|
|
|
15027
15064
|
skewOf(origin, skewX, skewY = 0, _resize) {
|
|
15028
15065
|
if (!this.checkTransform("skewable")) return;
|
|
15029
15066
|
const {target: target, mergeConfig: mergeConfig, single: single, editor: editor} = this.editBox;
|
|
15030
|
-
const {beforeSkew: beforeSkew} = mergeConfig;
|
|
15067
|
+
const {beforeSkew: beforeSkew, editBoxType: editBoxType} = mergeConfig;
|
|
15031
15068
|
if (beforeSkew) {
|
|
15032
15069
|
const check = beforeSkew({
|
|
15033
15070
|
target: target,
|
|
@@ -15045,7 +15082,8 @@ class TransformTool {
|
|
|
15045
15082
|
worldOrigin: worldOrigin,
|
|
15046
15083
|
skewX: skewX,
|
|
15047
15084
|
skewY: skewY,
|
|
15048
|
-
transform: transform
|
|
15085
|
+
transform: transform,
|
|
15086
|
+
editBoxType: editBoxType
|
|
15049
15087
|
};
|
|
15050
15088
|
this.emitEvent(new EditorSkewEvent(EditorSkewEvent.BEFORE_SKEW, data));
|
|
15051
15089
|
const event = new EditorSkewEvent(EditorSkewEvent.SKEW, data);
|
|
@@ -15494,32 +15532,32 @@ let EditTool = class EditTool extends InnerEditor {
|
|
|
15494
15532
|
app.unlockLayout();
|
|
15495
15533
|
}
|
|
15496
15534
|
onScale(e) {
|
|
15497
|
-
const {scaleX: scaleX, scaleY: scaleY, transform: transform, worldOrigin: worldOrigin, editor: editor} = e;
|
|
15535
|
+
const {scaleX: scaleX, scaleY: scaleY, transform: transform, worldOrigin: worldOrigin, editor: editor, editBoxType: editBoxType} = e;
|
|
15498
15536
|
const {app: app, list: list} = editor;
|
|
15499
15537
|
app.lockLayout();
|
|
15500
15538
|
list.forEach(target => {
|
|
15501
15539
|
const resize = editor.getEditSize(target) !== "scale";
|
|
15502
|
-
if (transform) target.transformWorld(transform, resize); else target.scaleOfWorld(worldOrigin, scaleX, scaleY, resize);
|
|
15540
|
+
if (transform) target.transformWorld(transform, resize, false, editBoxType); else target.scaleOfWorld(worldOrigin, scaleX, scaleY, resize, false, editBoxType);
|
|
15503
15541
|
});
|
|
15504
15542
|
app.unlockLayout();
|
|
15505
15543
|
}
|
|
15506
15544
|
onRotate(e) {
|
|
15507
|
-
const {rotation: rotation, transform: transform, worldOrigin: worldOrigin, editor: editor} = e;
|
|
15545
|
+
const {rotation: rotation, transform: transform, worldOrigin: worldOrigin, editor: editor, editBoxType: editBoxType} = e;
|
|
15508
15546
|
const {app: app, list: list} = editor;
|
|
15509
15547
|
app.lockLayout();
|
|
15510
15548
|
list.forEach(target => {
|
|
15511
15549
|
const resize = editor.getEditSize(target) !== "scale";
|
|
15512
|
-
if (transform) target.transformWorld(transform, resize); else target.rotateOfWorld(worldOrigin, rotation);
|
|
15550
|
+
if (transform) target.transformWorld(transform, resize, false, editBoxType); else target.rotateOfWorld(worldOrigin, rotation);
|
|
15513
15551
|
});
|
|
15514
15552
|
app.unlockLayout();
|
|
15515
15553
|
}
|
|
15516
15554
|
onSkew(e) {
|
|
15517
|
-
const {skewX: skewX, skewY: skewY, transform: transform, worldOrigin: worldOrigin, editor: editor} = e;
|
|
15555
|
+
const {skewX: skewX, skewY: skewY, transform: transform, worldOrigin: worldOrigin, editor: editor, editBoxType: editBoxType} = e;
|
|
15518
15556
|
const {app: app, list: list} = editor;
|
|
15519
15557
|
app.lockLayout();
|
|
15520
15558
|
list.forEach(target => {
|
|
15521
15559
|
const resize = editor.getEditSize(target) !== "scale";
|
|
15522
|
-
if (transform) target.transformWorld(transform, resize); else target.skewOfWorld(worldOrigin, skewX, skewY, resize);
|
|
15560
|
+
if (transform) target.transformWorld(transform, resize, false, editBoxType); else target.skewOfWorld(worldOrigin, skewX, skewY, resize);
|
|
15523
15561
|
});
|
|
15524
15562
|
app.unlockLayout();
|
|
15525
15563
|
}
|
|
@@ -15816,16 +15854,27 @@ function scaleResizeGroup(group, scaleX, scaleY) {
|
|
|
15816
15854
|
}
|
|
15817
15855
|
}
|
|
15818
15856
|
|
|
15819
|
-
const leaf = Leaf.prototype;
|
|
15857
|
+
const leaf = Leaf.prototype, tempPoint$1 = {}, {scale: scale$2, toOuterPoint: toOuterPoint} = MatrixHelper;
|
|
15820
15858
|
|
|
15821
|
-
leaf.scaleResize = function(scaleX, scaleY = scaleX, noResize) {
|
|
15859
|
+
leaf.scaleResize = function(scaleX, scaleY = scaleX, noResize, boundsType) {
|
|
15822
15860
|
const data = this;
|
|
15823
15861
|
if (noResize || data.editConfig && data.editConfig.editSize === "scale") {
|
|
15824
15862
|
data.scaleX *= scaleX;
|
|
15825
15863
|
data.scaleY *= scaleY;
|
|
15826
15864
|
} else {
|
|
15827
|
-
|
|
15828
|
-
if (
|
|
15865
|
+
const local = this.__localMatrix;
|
|
15866
|
+
if (scaleX < 0) data.scaleX *= -1, scaleX = -scaleX, scale$2(local, -1, 1);
|
|
15867
|
+
if (scaleY < 0) data.scaleY *= -1, scaleY = -scaleY, scale$2(local, 1, -1);
|
|
15868
|
+
if (boundsType === "stroke") {
|
|
15869
|
+
const {boxBounds: boxBounds, strokeBounds: strokeBounds} = this.__layout, {x: x, y: y, width: width, height: height} = strokeBounds;
|
|
15870
|
+
tempPoint$1.x = (x - boxBounds.x) * (scaleX - 1);
|
|
15871
|
+
tempPoint$1.y = (y - boxBounds.y) * (scaleY - 1);
|
|
15872
|
+
toOuterPoint(local, tempPoint$1, tempPoint$1, true);
|
|
15873
|
+
this.x += tempPoint$1.x;
|
|
15874
|
+
this.y += tempPoint$1.y;
|
|
15875
|
+
scaleX = (width * scaleX - (width - boxBounds.width)) / boxBounds.width;
|
|
15876
|
+
scaleY = (height * scaleY - (height - boxBounds.height)) / boxBounds.height;
|
|
15877
|
+
}
|
|
15829
15878
|
this.__scaleResize(scaleX, scaleY);
|
|
15830
15879
|
}
|
|
15831
15880
|
};
|
|
@@ -21255,4 +21304,4 @@ function isSame(a, b) {
|
|
|
21255
21304
|
|
|
21256
21305
|
Plugin.add("corner");
|
|
21257
21306
|
|
|
21258
|
-
export { AlignHelper, Animate, AnimateEasing, AnimateEvent, AnimateList, Answer, App, AroundHelper, Arrow, ArrowData, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, DragEvent, Dragger, DropEvent, EditBox, EditDataHelper, EditPoint, EditSelect, EditSelectHelper, EditTool, EditToolCreator, Editor, EditorEvent, EditorGroupEvent, EditorHelper, EditorMoveEvent, EditorRotateEvent, EditorScaleEvent, EditorSkewEvent, Effect, Ellipse, EllipseBox, EllipseBoxData, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Finder, Flow, FourNumberHelper, Frame, FrameData, Group, GroupData, HTMLText, HTMLTextData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image, ImageBox, ImageBoxData, ImageData, ImageEvent, ImageManager, IncrementId, InnerEditor, InnerEditorEvent, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferFilm, LeaferImage, LeaferTypeCreator, LeaferVideo, Line, LineData, LineEditTool, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, MyDragEvent, MyImage, MyPointerEvent, MyTouchEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathArrowModule, PathBounds, PathBox, PathBoxData, PathCommandDataHelper, PathCommandMap, PathCommandNodeHelper, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathMatrixHelper, PathNodeHandleType, PathNumberCommandLengthMap, PathNumberCommandMap, PathScaler, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonBox, PolygonBoxData, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Robot, RobotData, RotateEvent, Run, ScrollBar, Scroller, SelectArea, Selector, Star, StarBox, StarBoxData, StarData, State, StringNumberMap, Stroker, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TextEditor, TouchEvent, TransformTool, Transformer, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, UnitConvertHelper, WaitHelper, WatchEvent, Watcher, WheelEventHelper, ZoomEvent, addViewport, addViewportConfig, affectRenderBoundsType, affectStrokeBoundsType, arrowType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createAttr, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, dimType, doBoundsType, doStrokeType, effectType, emptyData, eraserType, extraPropertyEventMap, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isArray, isData, isEmptyData, isFinite$1 as isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, motionPathType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerEditTool, registerInnerEditor, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleResize, scaleResizeFontSize, scaleResizeGroup, scaleResizePath, scaleResizePoints, scaleType, scrollType, sortType, stateStyleType, stateType, strokeType, surfaceType, tempBounds$3 as tempBounds, tempMatrix$2 as tempMatrix, tempPoint$
|
|
21307
|
+
export { AlignHelper, Animate, AnimateEasing, AnimateEvent, AnimateList, Answer, App, AroundHelper, Arrow, ArrowData, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, DragEvent, Dragger, DropEvent, EditBox, EditDataHelper, EditPoint, EditSelect, EditSelectHelper, EditTool, EditToolCreator, Editor, EditorEvent, EditorGroupEvent, EditorHelper, EditorMoveEvent, EditorRotateEvent, EditorScaleEvent, EditorSkewEvent, Effect, Ellipse, EllipseBox, EllipseBoxData, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Finder, Flow, FourNumberHelper, Frame, FrameData, Group, GroupData, HTMLText, HTMLTextData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image, ImageBox, ImageBoxData, ImageData, ImageEvent, ImageManager, IncrementId, InnerEditor, InnerEditorEvent, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferFilm, LeaferImage, LeaferTypeCreator, LeaferVideo, Line, LineData, LineEditTool, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, MyDragEvent, MyImage, MyPointerEvent, MyTouchEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathArrowModule, PathBounds, PathBox, PathBoxData, PathCommandDataHelper, PathCommandMap, PathCommandNodeHelper, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathMatrixHelper, PathNodeHandleType, PathNumberCommandLengthMap, PathNumberCommandMap, PathScaler, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonBox, PolygonBoxData, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Robot, RobotData, RotateEvent, Run, ScrollBar, Scroller, SelectArea, Selector, Star, StarBox, StarBoxData, StarData, State, StringNumberMap, Stroker, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TextEditor, TouchEvent, TransformTool, Transformer, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, UnitConvertHelper, WaitHelper, WatchEvent, Watcher, WheelEventHelper, ZoomEvent, addViewport, addViewportConfig, affectRenderBoundsType, affectStrokeBoundsType, arrowType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createAttr, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, dimType, doBoundsType, doStrokeType, effectType, emptyData, eraserType, extraPropertyEventMap, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isArray, isData, isEmptyData, isFinite$1 as isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, motionPathType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerEditTool, registerInnerEditor, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleResize, scaleResizeFontSize, scaleResizeGroup, scaleResizePath, scaleResizePoints, scaleType, scrollType, sortType, stateStyleType, stateType, strokeType, surfaceType, tempBounds$3 as tempBounds, tempMatrix$2 as tempMatrix, tempPoint$5 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
|