@leafer-in/editor 2.1.2 → 2.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/editor.cjs +83 -46
- package/dist/editor.esm.js +83 -46
- package/dist/editor.esm.min.js +1 -1
- package/dist/editor.esm.min.js.map +1 -1
- package/dist/editor.js +83 -46
- package/dist/editor.min.cjs +1 -1
- package/dist/editor.min.cjs.map +1 -1
- package/dist/editor.min.js +1 -1
- package/dist/editor.min.js.map +1 -1
- package/package.json +6 -6
- package/src/config.ts +1 -0
- package/src/decorator/data.ts +2 -1
- package/src/display/EditBox.ts +8 -7
- package/src/display/EditSelect.ts +2 -2
- package/src/display/Stroker.ts +16 -7
- package/src/helper/EditDataHelper.ts +41 -17
- package/src/tool/EditTool.ts +7 -7
- package/src/tool/TransformTool.ts +12 -12
- package/types/index.d.ts +6 -5
package/dist/editor.cjs
CHANGED
|
@@ -94,10 +94,11 @@ function mergeConfigAttr() {
|
|
|
94
94
|
if (innerEditor) innerEditor.editConfig && Object.assign(mergeConfig, innerEditor.editConfig); else if (editTool) editTool.editConfig && Object.assign(mergeConfig, editTool.editConfig);
|
|
95
95
|
if (element && element.editConfig) {
|
|
96
96
|
let {editConfig: editConfig} = element;
|
|
97
|
-
if (editConfig.hover || editConfig.hoverStyle) {
|
|
97
|
+
if (editConfig.hover || editConfig.hoverStyle || editConfig.hoverPathType) {
|
|
98
98
|
editConfig = Object.assign({}, editConfig);
|
|
99
99
|
delete editConfig.hover;
|
|
100
100
|
delete editConfig.hoverStyle;
|
|
101
|
+
delete editConfig.hoverPathType;
|
|
101
102
|
}
|
|
102
103
|
Object.assign(mergeConfig, editConfig);
|
|
103
104
|
}
|
|
@@ -165,9 +166,22 @@ class Stroker extends draw.UI {
|
|
|
165
166
|
matrix.half = strokeWidth % 2;
|
|
166
167
|
canvas.setWorld(matrix, options.matrix);
|
|
167
168
|
canvas.beginPath();
|
|
168
|
-
|
|
169
|
+
switch (this.strokePathType) {
|
|
170
|
+
case "box":
|
|
171
|
+
const {boxBounds: boxBounds} = leaf.__layout;
|
|
172
|
+
canvas.rect(boxBounds.x, boxBounds.y, boxBounds.width, boxBounds.height);
|
|
173
|
+
break;
|
|
174
|
+
|
|
175
|
+
case "stroke":
|
|
176
|
+
const {strokeBounds: strokeBounds} = leaf.__layout;
|
|
177
|
+
canvas.rect(strokeBounds.x, strokeBounds.y, strokeBounds.width, strokeBounds.height);
|
|
178
|
+
break;
|
|
179
|
+
|
|
180
|
+
case "path":
|
|
169
181
|
leaf.__drawPath(canvas);
|
|
170
|
-
|
|
182
|
+
break;
|
|
183
|
+
|
|
184
|
+
default:
|
|
171
185
|
if (leaf.__.__useArrow) leaf.__drawPath(canvas); else leaf.__.__pathForRender ? leaf.__drawRenderPath(canvas) : leaf.__drawPathByBox(canvas);
|
|
172
186
|
}
|
|
173
187
|
data.strokeWidth = strokeWidth / Math.max(aScaleX, aScaleY);
|
|
@@ -290,10 +304,11 @@ class EditSelect extends draw.Group {
|
|
|
290
304
|
if (this.running && !this.dragging && !editor.dragging) {
|
|
291
305
|
const {hoverTarget: hoverTarget, mergeConfig: mergeConfig} = editor, config = Object.assign({}, mergeConfig);
|
|
292
306
|
if (hoverTarget && hoverTarget.editConfig) Object.assign(config, hoverTarget.editConfig);
|
|
293
|
-
const {stroke: stroke, strokeWidth: strokeWidth, hover: hover, hoverStyle: hoverStyle} = config;
|
|
307
|
+
const {stroke: stroke, strokeWidth: strokeWidth, hover: hover, hoverStyle: hoverStyle, hoverPathType: hoverPathType} = config;
|
|
294
308
|
this.hoverStroker.setTarget(hover ? hoverTarget : null, Object.assign({
|
|
295
309
|
stroke: stroke,
|
|
296
|
-
strokeWidth: strokeWidth
|
|
310
|
+
strokeWidth: strokeWidth,
|
|
311
|
+
strokePathType: hoverPathType
|
|
297
312
|
}, hoverStyle || {}));
|
|
298
313
|
} else {
|
|
299
314
|
this.hoverStroker.target = null;
|
|
@@ -476,16 +491,17 @@ const {topLeft: topLeft, top: top, topRight: topRight, right: right$1, bottomRig
|
|
|
476
491
|
const {toPoint: toPoint} = draw.AroundHelper, {within: within, sign: sign} = draw.MathHelper, {abs: abs} = Math;
|
|
477
492
|
|
|
478
493
|
const EditDataHelper = {
|
|
479
|
-
getScaleData(target, startBounds, direction, totalMoveOrScale, lockRatio, around, flipable, scaleMode) {
|
|
494
|
+
getScaleData(target, startBounds, direction, totalMoveOrScale, lockRatio, around, flipable, scaleMode, boundsType) {
|
|
480
495
|
let align, origin = {}, scaleX = 1, scaleY = 1, lockScale;
|
|
481
|
-
const {
|
|
496
|
+
const {widthRange: widthRange, heightRange: heightRange, dragBounds: dragBounds, worldTransform: worldTransform, boxBounds: boxBounds} = target;
|
|
482
497
|
const {width: width, height: height} = startBounds;
|
|
498
|
+
const innerBounds = target.getBounds(boundsType, "inner");
|
|
483
499
|
const originChangedScaleX = target.scaleX / startBounds.scaleX;
|
|
484
500
|
const originChangedScaleY = target.scaleY / startBounds.scaleY;
|
|
485
501
|
const signX = sign(originChangedScaleX);
|
|
486
502
|
const signY = sign(originChangedScaleY);
|
|
487
|
-
const changedScaleX = scaleMode ? originChangedScaleX : signX *
|
|
488
|
-
const changedScaleY = scaleMode ? originChangedScaleY : signY *
|
|
503
|
+
const changedScaleX = scaleMode ? originChangedScaleX : signX * innerBounds.width / width;
|
|
504
|
+
const changedScaleY = scaleMode ? originChangedScaleY : signY * innerBounds.height / height;
|
|
489
505
|
if (draw.isNumber(totalMoveOrScale)) {
|
|
490
506
|
scaleX = scaleY = Math.sqrt(totalMoveOrScale);
|
|
491
507
|
} else {
|
|
@@ -571,10 +587,11 @@ const EditDataHelper = {
|
|
|
571
587
|
if (useScaleY) scaleY /= changedScaleY;
|
|
572
588
|
if (!flipable) {
|
|
573
589
|
const {worldTransform: worldTransform} = target;
|
|
574
|
-
if (scaleX < 0) scaleX = 1 /
|
|
575
|
-
if (scaleY < 0) scaleY = 1 /
|
|
590
|
+
if (scaleX < 0) scaleX = 1 / innerBounds.width / worldTransform.scaleX;
|
|
591
|
+
if (scaleY < 0) scaleY = 1 / innerBounds.height / worldTransform.scaleY;
|
|
576
592
|
}
|
|
577
|
-
toPoint(around || align,
|
|
593
|
+
toPoint(around || align, innerBounds, origin, true);
|
|
594
|
+
this.checkOrigin(target, origin, boundsType);
|
|
578
595
|
if (dragBounds) {
|
|
579
596
|
const scaleData = {
|
|
580
597
|
x: scaleX,
|
|
@@ -585,15 +602,20 @@ const EditDataHelper = {
|
|
|
585
602
|
scaleY = scaleData.y;
|
|
586
603
|
}
|
|
587
604
|
if (useScaleX && widthRange) {
|
|
588
|
-
const nowWidth =
|
|
605
|
+
const nowWidth = innerBounds.width * target.scaleX;
|
|
589
606
|
scaleX = within(nowWidth * scaleX, widthRange) / nowWidth;
|
|
590
607
|
}
|
|
591
608
|
if (useScaleY && heightRange) {
|
|
592
|
-
const nowHeight =
|
|
609
|
+
const nowHeight = innerBounds.height * target.scaleY;
|
|
593
610
|
scaleY = within(nowHeight * scaleY, heightRange) / nowHeight;
|
|
594
611
|
}
|
|
595
|
-
|
|
596
|
-
if (
|
|
612
|
+
let minWidth = 1 * abs(worldTransform.scaleX), minHeight = 1 * abs(worldTransform.scaleY);
|
|
613
|
+
if (boundsType !== "box") {
|
|
614
|
+
minWidth += innerBounds.width - boxBounds.width;
|
|
615
|
+
minHeight += innerBounds.height - boxBounds.height;
|
|
616
|
+
}
|
|
617
|
+
if (useScaleX && abs(scaleX * innerBounds.width) < minWidth) scaleX = sign(scaleX) * minWidth / innerBounds.width;
|
|
618
|
+
if (useScaleY && abs(scaleY * innerBounds.height) < minHeight) scaleY = sign(scaleY) * minHeight / innerBounds.height;
|
|
597
619
|
if (lockRatio && scaleX !== scaleY) {
|
|
598
620
|
lockScale = Math.min(abs(scaleX), abs(scaleY));
|
|
599
621
|
scaleX = sign(scaleX) * lockScale;
|
|
@@ -610,7 +632,7 @@ const EditDataHelper = {
|
|
|
610
632
|
around: around
|
|
611
633
|
};
|
|
612
634
|
},
|
|
613
|
-
getRotateData(target, direction, current, last, around) {
|
|
635
|
+
getRotateData(target, direction, current, last, around, boundsType) {
|
|
614
636
|
let align, origin = {};
|
|
615
637
|
switch (direction) {
|
|
616
638
|
case topLeft:
|
|
@@ -632,13 +654,14 @@ const EditDataHelper = {
|
|
|
632
654
|
default:
|
|
633
655
|
align = "center";
|
|
634
656
|
}
|
|
635
|
-
toPoint(around || align, target.
|
|
657
|
+
toPoint(around || align, target.getBounds(boundsType, "inner"), origin, true);
|
|
658
|
+
this.checkOrigin(target, origin, boundsType);
|
|
636
659
|
return {
|
|
637
660
|
origin: origin,
|
|
638
661
|
rotation: draw.PointHelper.getRotation(last, target.getWorldPointByBox(origin), current)
|
|
639
662
|
};
|
|
640
663
|
},
|
|
641
|
-
getSkewData(
|
|
664
|
+
getSkewData(target, direction, move, around, boundsType) {
|
|
642
665
|
let align, origin = {}, skewX = 0, skewY = 0;
|
|
643
666
|
let last;
|
|
644
667
|
switch (direction) {
|
|
@@ -681,10 +704,12 @@ const EditDataHelper = {
|
|
|
681
704
|
align = "left";
|
|
682
705
|
skewY = 1;
|
|
683
706
|
}
|
|
684
|
-
const
|
|
707
|
+
const innerBounds = target.getBounds(boundsType, "inner");
|
|
708
|
+
const {width: width, height: height} = innerBounds;
|
|
685
709
|
last.x = last.x * width;
|
|
686
710
|
last.y = last.y * height;
|
|
687
|
-
toPoint(around || align,
|
|
711
|
+
toPoint(around || align, innerBounds, origin, true);
|
|
712
|
+
this.checkOrigin(target, origin, boundsType);
|
|
688
713
|
const rotation = draw.PointHelper.getRotation(last, origin, {
|
|
689
714
|
x: last.x + (skewX ? move.x : 0),
|
|
690
715
|
y: last.y + (skewY ? move.y : 0)
|
|
@@ -696,6 +721,13 @@ const EditDataHelper = {
|
|
|
696
721
|
skewY: skewY
|
|
697
722
|
};
|
|
698
723
|
},
|
|
724
|
+
checkOrigin(target, origin, boundsType) {
|
|
725
|
+
if (boundsType !== "box") {
|
|
726
|
+
const {boxBounds: boxBounds} = target, innerBounds = target.getBounds(boundsType, "inner");
|
|
727
|
+
origin.x += innerBounds.x - boxBounds.x;
|
|
728
|
+
origin.y += innerBounds.y - boxBounds.y;
|
|
729
|
+
}
|
|
730
|
+
},
|
|
699
731
|
getAround(around, altKey) {
|
|
700
732
|
return altKey && !around ? "center" : around;
|
|
701
733
|
},
|
|
@@ -966,8 +998,8 @@ class EditBox extends draw.Group {
|
|
|
966
998
|
updateMoveCursor(this);
|
|
967
999
|
}
|
|
968
1000
|
update() {
|
|
969
|
-
const {editor: editor} = this;
|
|
970
|
-
const {x: x, y: y, scaleX: scaleX, scaleY: scaleY, rotation: rotation, skewX: skewX, skewY: skewY, width: width, height: height} = this.target.getLayoutBounds(
|
|
1001
|
+
const {editor: editor, mergeConfig: mergeConfig} = this;
|
|
1002
|
+
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);
|
|
971
1003
|
this.visible = !this.target.locked;
|
|
972
1004
|
this.set({
|
|
973
1005
|
x: x,
|
|
@@ -990,9 +1022,9 @@ class EditBox extends draw.Group {
|
|
|
990
1022
|
if (this.app) this.rect.syncEventer = this.app.interaction.bottomList = null;
|
|
991
1023
|
}
|
|
992
1024
|
updateBounds(bounds) {
|
|
993
|
-
const {editor: editor,
|
|
1025
|
+
const {editor: editor, mergedConfig: mergedConfig, single: single, rect: rect, circle: circle, buttons: buttons, resizePoints: resizePoints, rotatePoints: rotatePoints, resizeLines: resizeLines} = this;
|
|
994
1026
|
const {editMask: editMask} = editor;
|
|
995
|
-
const {middlePoint: middlePoint, resizeable: resizeable, rotateable: rotateable, hideOnSmall: hideOnSmall, editBox: editBox, mask: mask, dimOthers: dimOthers, bright: bright, spread: spread, hideRotatePoints: hideRotatePoints, hideResizeLines: hideResizeLines} =
|
|
1027
|
+
const {middlePoint: middlePoint, resizeable: resizeable, rotateable: rotateable, hideOnSmall: hideOnSmall, editBox: editBox, mask: mask, dimOthers: dimOthers, bright: bright, spread: spread, hideRotatePoints: hideRotatePoints, hideResizeLines: hideResizeLines} = mergedConfig;
|
|
996
1028
|
editMask.visible = mask ? true : 0;
|
|
997
1029
|
if (!draw.isUndefined(dimOthers) || !draw.isUndefined(bright)) {
|
|
998
1030
|
editor.setDimOthers(dimOthers);
|
|
@@ -1030,7 +1062,7 @@ class EditBox extends draw.Group {
|
|
|
1030
1062
|
}
|
|
1031
1063
|
}
|
|
1032
1064
|
}
|
|
1033
|
-
circle.visible = showPoints && rotateable && !!(
|
|
1065
|
+
circle.visible = showPoints && rotateable && !!(mergedConfig.circle || mergedConfig.rotatePoint);
|
|
1034
1066
|
if (circle.visible) this.layoutCircle();
|
|
1035
1067
|
if (rect.path) rect.path = null;
|
|
1036
1068
|
rect.set(Object.assign(Object.assign({}, bounds), {
|
|
@@ -1138,7 +1170,8 @@ class EditBox extends draw.Group {
|
|
|
1138
1170
|
this.dragPoint = null;
|
|
1139
1171
|
}
|
|
1140
1172
|
onTransformStart(e) {
|
|
1141
|
-
|
|
1173
|
+
const {hideOnMove: hideOnMove, editBoxType: editBoxType} = this.mergedConfig;
|
|
1174
|
+
if (this.moving || this.gesturing) this.editor.opacity = hideOnMove ? 0 : 1;
|
|
1142
1175
|
if (this.resizing) draw.ResizeEvent.resizingKeys = this.editor.leafList.keys;
|
|
1143
1176
|
const {dragStartData: dragStartData, target: target} = this;
|
|
1144
1177
|
dragStartData.x = e.x;
|
|
@@ -1148,7 +1181,7 @@ class EditBox extends draw.Group {
|
|
|
1148
1181
|
x: target.x,
|
|
1149
1182
|
y: target.y
|
|
1150
1183
|
};
|
|
1151
|
-
dragStartData.bounds = Object.assign({}, target.getLayoutBounds(
|
|
1184
|
+
dragStartData.bounds = Object.assign({}, target.getLayoutBounds(editBoxType, "local"));
|
|
1152
1185
|
dragStartData.rotation = target.rotation;
|
|
1153
1186
|
}
|
|
1154
1187
|
onTransformEnd(e) {
|
|
@@ -1386,6 +1419,7 @@ const config = {
|
|
|
1386
1419
|
},
|
|
1387
1420
|
selector: true,
|
|
1388
1421
|
editBox: true,
|
|
1422
|
+
editBoxType: "box",
|
|
1389
1423
|
hover: true,
|
|
1390
1424
|
select: "press",
|
|
1391
1425
|
openInner: "double",
|
|
@@ -1710,7 +1744,7 @@ class TransformTool {
|
|
|
1710
1744
|
}
|
|
1711
1745
|
onScale(e) {
|
|
1712
1746
|
const {target: target, mergeConfig: mergeConfig, single: single, dragStartData: dragStartData} = this.editBox;
|
|
1713
|
-
let {around: around, lockRatio: lockRatio, flipable: flipable, editSize: editSize} = mergeConfig, totalMove;
|
|
1747
|
+
let {around: around, lockRatio: lockRatio, flipable: flipable, editSize: editSize, editBoxType: editBoxType} = mergeConfig, totalMove;
|
|
1714
1748
|
if (e instanceof core.ZoomEvent) {
|
|
1715
1749
|
if (!around) around = target.getBoxPoint(e);
|
|
1716
1750
|
totalMove = e.totalScale;
|
|
@@ -1719,7 +1753,7 @@ class TransformTool {
|
|
|
1719
1753
|
}
|
|
1720
1754
|
const {direction: direction} = e.current;
|
|
1721
1755
|
if (e.shiftKey || target.lockRatio) lockRatio = true;
|
|
1722
|
-
const data = EditDataHelper.getScaleData(target, dragStartData.bounds, direction, totalMove, lockRatio, EditDataHelper.getAround(around, e.altKey), flipable, !single || editSize === "scale");
|
|
1756
|
+
const data = EditDataHelper.getScaleData(target, dragStartData.bounds, direction, totalMove, lockRatio, EditDataHelper.getAround(around, e.altKey), flipable, !single || editSize === "scale", editBoxType);
|
|
1723
1757
|
const targetX = target.x, targetY = target.y;
|
|
1724
1758
|
if (e instanceof core.DragEvent && this.editTool && this.editTool.onScaleWithDrag) {
|
|
1725
1759
|
data.drag = e;
|
|
@@ -1731,7 +1765,7 @@ class TransformTool {
|
|
|
1731
1765
|
}
|
|
1732
1766
|
onRotate(e) {
|
|
1733
1767
|
const {target: target, mergeConfig: mergeConfig, dragStartData: dragStartData} = this.editBox;
|
|
1734
|
-
const {around: around, rotateAround: rotateAround, rotateGap: rotateGap, diagonalRotateKey: diagonalRotateKey} = mergeConfig;
|
|
1768
|
+
const {around: around, rotateAround: rotateAround, rotateGap: rotateGap, diagonalRotateKey: diagonalRotateKey, editBoxType: editBoxType} = mergeConfig;
|
|
1735
1769
|
const {direction: direction} = e.current;
|
|
1736
1770
|
let origin, rotation;
|
|
1737
1771
|
if (e instanceof core.RotateEvent) {
|
|
@@ -1739,7 +1773,7 @@ class TransformTool {
|
|
|
1739
1773
|
origin = rotateAround ? draw.AroundHelper.getPoint(rotateAround, target.boxBounds) : target.getBoxPoint(e);
|
|
1740
1774
|
} else {
|
|
1741
1775
|
const isDiagonalRotate = diagonalRotateKey ? e.isHoldKeys(diagonalRotateKey) : e.shiftKey;
|
|
1742
|
-
const data = EditDataHelper.getRotateData(target, direction, e, dragStartData, isDiagonalRotate ? null : rotateAround || target.around || target.origin || around || "center");
|
|
1776
|
+
const data = EditDataHelper.getRotateData(target, direction, e, dragStartData, isDiagonalRotate ? null : rotateAround || target.around || target.origin || around || "center", editBoxType);
|
|
1743
1777
|
rotation = dragStartData.rotation + data.rotation - target.rotation;
|
|
1744
1778
|
origin = data.origin;
|
|
1745
1779
|
}
|
|
@@ -1751,8 +1785,8 @@ class TransformTool {
|
|
|
1751
1785
|
}
|
|
1752
1786
|
onSkew(e) {
|
|
1753
1787
|
const {target: target, mergeConfig: mergeConfig} = this.editBox;
|
|
1754
|
-
const {around: around} = mergeConfig;
|
|
1755
|
-
const {origin: origin, skewX: skewX, skewY: skewY} = EditDataHelper.getSkewData(target
|
|
1788
|
+
const {around: around, editBoxType: editBoxType} = mergeConfig;
|
|
1789
|
+
const {origin: origin, skewX: skewX, skewY: skewY} = EditDataHelper.getSkewData(target, e.current.direction, e.getInnerMove(target), EditDataHelper.getAround(around, e.altKey), editBoxType);
|
|
1756
1790
|
if (!skewX && !skewY) return;
|
|
1757
1791
|
this.skewOf(origin, skewX, skewY);
|
|
1758
1792
|
}
|
|
@@ -1813,7 +1847,7 @@ class TransformTool {
|
|
|
1813
1847
|
scaleOf(origin, scaleX, scaleY = scaleX, _resize) {
|
|
1814
1848
|
if (!this.checkTransform("resizeable")) return;
|
|
1815
1849
|
const {target: target, mergeConfig: mergeConfig, single: single, editor: editor} = this.editBox;
|
|
1816
|
-
const {beforeScale: beforeScale} = mergeConfig;
|
|
1850
|
+
const {beforeScale: beforeScale, editBoxType: editBoxType} = mergeConfig;
|
|
1817
1851
|
if (beforeScale) {
|
|
1818
1852
|
const check = beforeScale({
|
|
1819
1853
|
target: target,
|
|
@@ -1831,7 +1865,8 @@ class TransformTool {
|
|
|
1831
1865
|
worldOrigin: worldOrigin,
|
|
1832
1866
|
scaleX: scaleX,
|
|
1833
1867
|
scaleY: scaleY,
|
|
1834
|
-
transform: transform
|
|
1868
|
+
transform: transform,
|
|
1869
|
+
editBoxType: editBoxType
|
|
1835
1870
|
};
|
|
1836
1871
|
this.emitEvent(new EditorScaleEvent(EditorScaleEvent.BEFORE_SCALE, data));
|
|
1837
1872
|
const event = new EditorScaleEvent(EditorScaleEvent.SCALE, data);
|
|
@@ -1859,7 +1894,7 @@ class TransformTool {
|
|
|
1859
1894
|
rotateOf(origin, rotation) {
|
|
1860
1895
|
if (!this.checkTransform("rotateable")) return;
|
|
1861
1896
|
const {target: target, mergeConfig: mergeConfig, single: single, editor: editor} = this.editBox;
|
|
1862
|
-
const {beforeRotate: beforeRotate} = mergeConfig;
|
|
1897
|
+
const {beforeRotate: beforeRotate, editBoxType: editBoxType} = mergeConfig;
|
|
1863
1898
|
if (beforeRotate) {
|
|
1864
1899
|
const check = beforeRotate({
|
|
1865
1900
|
target: target,
|
|
@@ -1875,7 +1910,8 @@ class TransformTool {
|
|
|
1875
1910
|
editor: editor,
|
|
1876
1911
|
worldOrigin: worldOrigin,
|
|
1877
1912
|
rotation: rotation,
|
|
1878
|
-
transform: transform
|
|
1913
|
+
transform: transform,
|
|
1914
|
+
editBoxType: editBoxType
|
|
1879
1915
|
};
|
|
1880
1916
|
this.emitEvent(new EditorRotateEvent(EditorRotateEvent.BEFORE_ROTATE, data));
|
|
1881
1917
|
const event = new EditorRotateEvent(EditorRotateEvent.ROTATE, data);
|
|
@@ -1885,7 +1921,7 @@ class TransformTool {
|
|
|
1885
1921
|
skewOf(origin, skewX, skewY = 0, _resize) {
|
|
1886
1922
|
if (!this.checkTransform("skewable")) return;
|
|
1887
1923
|
const {target: target, mergeConfig: mergeConfig, single: single, editor: editor} = this.editBox;
|
|
1888
|
-
const {beforeSkew: beforeSkew} = mergeConfig;
|
|
1924
|
+
const {beforeSkew: beforeSkew, editBoxType: editBoxType} = mergeConfig;
|
|
1889
1925
|
if (beforeSkew) {
|
|
1890
1926
|
const check = beforeSkew({
|
|
1891
1927
|
target: target,
|
|
@@ -1903,7 +1939,8 @@ class TransformTool {
|
|
|
1903
1939
|
worldOrigin: worldOrigin,
|
|
1904
1940
|
skewX: skewX,
|
|
1905
1941
|
skewY: skewY,
|
|
1906
|
-
transform: transform
|
|
1942
|
+
transform: transform,
|
|
1943
|
+
editBoxType: editBoxType
|
|
1907
1944
|
};
|
|
1908
1945
|
this.emitEvent(new EditorSkewEvent(EditorSkewEvent.BEFORE_SKEW, data));
|
|
1909
1946
|
const event = new EditorSkewEvent(EditorSkewEvent.SKEW, data);
|
|
@@ -2352,32 +2389,32 @@ exports.EditTool = class EditTool extends InnerEditor {
|
|
|
2352
2389
|
app.unlockLayout();
|
|
2353
2390
|
}
|
|
2354
2391
|
onScale(e) {
|
|
2355
|
-
const {scaleX: scaleX, scaleY: scaleY, transform: transform, worldOrigin: worldOrigin, editor: editor} = e;
|
|
2392
|
+
const {scaleX: scaleX, scaleY: scaleY, transform: transform, worldOrigin: worldOrigin, editor: editor, editBoxType: editBoxType} = e;
|
|
2356
2393
|
const {app: app, list: list} = editor;
|
|
2357
2394
|
app.lockLayout();
|
|
2358
2395
|
list.forEach(target => {
|
|
2359
2396
|
const resize = editor.getEditSize(target) !== "scale";
|
|
2360
|
-
if (transform) target.transformWorld(transform, resize); else target.scaleOfWorld(worldOrigin, scaleX, scaleY, resize);
|
|
2397
|
+
if (transform) target.transformWorld(transform, resize, false, editBoxType); else target.scaleOfWorld(worldOrigin, scaleX, scaleY, resize, false, editBoxType);
|
|
2361
2398
|
});
|
|
2362
2399
|
app.unlockLayout();
|
|
2363
2400
|
}
|
|
2364
2401
|
onRotate(e) {
|
|
2365
|
-
const {rotation: rotation, transform: transform, worldOrigin: worldOrigin, editor: editor} = e;
|
|
2402
|
+
const {rotation: rotation, transform: transform, worldOrigin: worldOrigin, editor: editor, editBoxType: editBoxType} = e;
|
|
2366
2403
|
const {app: app, list: list} = editor;
|
|
2367
2404
|
app.lockLayout();
|
|
2368
2405
|
list.forEach(target => {
|
|
2369
2406
|
const resize = editor.getEditSize(target) !== "scale";
|
|
2370
|
-
if (transform) target.transformWorld(transform, resize); else target.rotateOfWorld(worldOrigin, rotation);
|
|
2407
|
+
if (transform) target.transformWorld(transform, resize, false, editBoxType); else target.rotateOfWorld(worldOrigin, rotation);
|
|
2371
2408
|
});
|
|
2372
2409
|
app.unlockLayout();
|
|
2373
2410
|
}
|
|
2374
2411
|
onSkew(e) {
|
|
2375
|
-
const {skewX: skewX, skewY: skewY, transform: transform, worldOrigin: worldOrigin, editor: editor} = e;
|
|
2412
|
+
const {skewX: skewX, skewY: skewY, transform: transform, worldOrigin: worldOrigin, editor: editor, editBoxType: editBoxType} = e;
|
|
2376
2413
|
const {app: app, list: list} = editor;
|
|
2377
2414
|
app.lockLayout();
|
|
2378
2415
|
list.forEach(target => {
|
|
2379
2416
|
const resize = editor.getEditSize(target) !== "scale";
|
|
2380
|
-
if (transform) target.transformWorld(transform, resize); else target.skewOfWorld(worldOrigin, skewX, skewY, resize);
|
|
2417
|
+
if (transform) target.transformWorld(transform, resize, false, editBoxType); else target.skewOfWorld(worldOrigin, skewX, skewY, resize);
|
|
2381
2418
|
});
|
|
2382
2419
|
app.unlockLayout();
|
|
2383
2420
|
}
|