@leafer-in/editor 2.1.10 → 2.1.11
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 +48 -59
- package/dist/editor.esm.js +48 -59
- package/dist/editor.esm.min.js +1 -1
- package/dist/editor.esm.min.js.map +1 -1
- package/dist/editor.js +48 -59
- 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/display/EditBox.ts +10 -6
- package/src/helper/EditDataHelper.ts +16 -38
- package/src/index.ts +6 -4
- package/src/tool/EditTool.ts +7 -7
- package/src/tool/EditToolCreator.ts +5 -0
- package/src/tool/TransformTool.ts +12 -12
- package/types/index.d.ts +7 -5
package/dist/editor.cjs
CHANGED
|
@@ -491,17 +491,16 @@ const {topLeft: topLeft, top: top, topRight: topRight, right: right$1, bottomRig
|
|
|
491
491
|
const {toPoint: toPoint} = draw.AroundHelper, {within: within, sign: sign} = draw.MathHelper, {abs: abs} = Math;
|
|
492
492
|
|
|
493
493
|
const EditDataHelper = {
|
|
494
|
-
getScaleData(target, startBounds, direction, totalMoveOrScale, lockRatio, around, flipable, scaleMode
|
|
494
|
+
getScaleData(target, startBounds, direction, totalMoveOrScale, lockRatio, around, flipable, scaleMode) {
|
|
495
495
|
let align, origin = {}, scaleX = 1, scaleY = 1, lockScale;
|
|
496
496
|
const {widthRange: widthRange, heightRange: heightRange, dragBounds: dragBounds, worldTransform: worldTransform, boxBounds: boxBounds} = target;
|
|
497
497
|
const {width: width, height: height} = startBounds, worldScaleX = abs(worldTransform.scaleX), worldScaleY = abs(worldTransform.scaleY);
|
|
498
|
-
const innerBounds = target.getBounds(boundsType, "inner");
|
|
499
498
|
const originChangedScaleX = target.scaleX / startBounds.scaleX;
|
|
500
499
|
const originChangedScaleY = target.scaleY / startBounds.scaleY;
|
|
501
500
|
const signX = sign(originChangedScaleX);
|
|
502
501
|
const signY = sign(originChangedScaleY);
|
|
503
|
-
const changedScaleX = scaleMode ? originChangedScaleX : signX *
|
|
504
|
-
const changedScaleY = scaleMode ? originChangedScaleY : signY *
|
|
502
|
+
const changedScaleX = scaleMode ? originChangedScaleX : signX * boxBounds.width / width;
|
|
503
|
+
const changedScaleY = scaleMode ? originChangedScaleY : signY * boxBounds.height / height;
|
|
505
504
|
if (draw.isNumber(totalMoveOrScale)) {
|
|
506
505
|
scaleX = scaleY = Math.sqrt(totalMoveOrScale);
|
|
507
506
|
} else {
|
|
@@ -586,11 +585,10 @@ const EditDataHelper = {
|
|
|
586
585
|
if (useScaleX) scaleX /= changedScaleX;
|
|
587
586
|
if (useScaleY) scaleY /= changedScaleY;
|
|
588
587
|
if (!flipable) {
|
|
589
|
-
if (scaleX < 0) scaleX = 1 /
|
|
590
|
-
if (scaleY < 0) scaleY = 1 /
|
|
588
|
+
if (scaleX < 0) scaleX = 1 / boxBounds.width / worldScaleX;
|
|
589
|
+
if (scaleY < 0) scaleY = 1 / boxBounds.height / worldScaleY;
|
|
591
590
|
}
|
|
592
|
-
toPoint(around || align,
|
|
593
|
-
this.checkOrigin(target, origin, boundsType);
|
|
591
|
+
toPoint(around || align, boxBounds, origin, true);
|
|
594
592
|
if (dragBounds) {
|
|
595
593
|
const scaleData = {
|
|
596
594
|
x: scaleX,
|
|
@@ -601,19 +599,15 @@ const EditDataHelper = {
|
|
|
601
599
|
scaleY = scaleData.y;
|
|
602
600
|
}
|
|
603
601
|
if (useScaleX && widthRange) {
|
|
604
|
-
const nowWidth =
|
|
602
|
+
const nowWidth = boxBounds.width * target.scaleX;
|
|
605
603
|
scaleX = within(nowWidth * scaleX, widthRange) / nowWidth;
|
|
606
604
|
}
|
|
607
605
|
if (useScaleY && heightRange) {
|
|
608
|
-
const nowHeight =
|
|
606
|
+
const nowHeight = boxBounds.height * target.scaleY;
|
|
609
607
|
scaleY = within(nowHeight * scaleY, heightRange) / nowHeight;
|
|
610
608
|
}
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
minWidth += (innerBounds.width - boxBounds.width) * worldScaleX;
|
|
614
|
-
minHeight += (innerBounds.height - boxBounds.height) * worldScaleY;
|
|
615
|
-
}
|
|
616
|
-
const worldWidth = worldScaleX * innerBounds.width, worldHeight = worldScaleY * innerBounds.height;
|
|
609
|
+
const minWidth = 1, minHeight = 1;
|
|
610
|
+
const worldWidth = worldScaleX * boxBounds.width, worldHeight = worldScaleY * boxBounds.height;
|
|
617
611
|
if (useScaleX && abs(scaleX * worldWidth) < minWidth) scaleX = sign(scaleX) * minWidth / worldWidth;
|
|
618
612
|
if (useScaleY && abs(scaleY * worldHeight) < minHeight) scaleY = sign(scaleY) * minHeight / worldHeight;
|
|
619
613
|
if (lockRatio && scaleX !== scaleY) {
|
|
@@ -632,7 +626,7 @@ const EditDataHelper = {
|
|
|
632
626
|
around: around
|
|
633
627
|
};
|
|
634
628
|
},
|
|
635
|
-
getRotateData(target, direction, current, last, around
|
|
629
|
+
getRotateData(target, direction, current, last, around) {
|
|
636
630
|
let align, origin = {};
|
|
637
631
|
switch (direction) {
|
|
638
632
|
case topLeft:
|
|
@@ -654,14 +648,13 @@ const EditDataHelper = {
|
|
|
654
648
|
default:
|
|
655
649
|
align = "center";
|
|
656
650
|
}
|
|
657
|
-
toPoint(around || align, target.
|
|
658
|
-
this.checkOrigin(target, origin, boundsType);
|
|
651
|
+
toPoint(around || align, target.boxBounds, origin, true);
|
|
659
652
|
return {
|
|
660
653
|
origin: origin,
|
|
661
654
|
rotation: draw.PointHelper.getRotation(last, target.getWorldPointByBox(origin), current)
|
|
662
655
|
};
|
|
663
656
|
},
|
|
664
|
-
getSkewData(target, direction, move, around
|
|
657
|
+
getSkewData(target, direction, move, around) {
|
|
665
658
|
let align, origin = {}, skewX = 0, skewY = 0;
|
|
666
659
|
let last;
|
|
667
660
|
switch (direction) {
|
|
@@ -704,12 +697,10 @@ const EditDataHelper = {
|
|
|
704
697
|
align = "left";
|
|
705
698
|
skewY = 1;
|
|
706
699
|
}
|
|
707
|
-
const
|
|
708
|
-
const {width: width, height: height} = innerBounds;
|
|
700
|
+
const {boxBounds: boxBounds} = target, {width: width, height: height} = boxBounds;
|
|
709
701
|
last.x = last.x * width;
|
|
710
702
|
last.y = last.y * height;
|
|
711
|
-
toPoint(around || align,
|
|
712
|
-
this.checkOrigin(target, origin, boundsType);
|
|
703
|
+
toPoint(around || align, boxBounds, origin, true);
|
|
713
704
|
const rotation = draw.PointHelper.getRotation(last, origin, {
|
|
714
705
|
x: last.x + (skewX ? move.x : 0),
|
|
715
706
|
y: last.y + (skewY ? move.y : 0)
|
|
@@ -721,13 +712,6 @@ const EditDataHelper = {
|
|
|
721
712
|
skewY: skewY
|
|
722
713
|
};
|
|
723
714
|
},
|
|
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
|
-
},
|
|
731
715
|
getAround(around, altKey) {
|
|
732
716
|
return altKey && !around ? "center" : around;
|
|
733
717
|
},
|
|
@@ -1022,9 +1006,14 @@ class EditBox extends draw.Group {
|
|
|
1022
1006
|
if (this.app) this.rect.syncEventer = this.app.interaction.bottomList = null;
|
|
1023
1007
|
}
|
|
1024
1008
|
updateBounds(bounds) {
|
|
1025
|
-
const {editor: editor, mergeConfig: mergeConfig, single: single, rect: rect, circle: circle, buttons: buttons, resizePoints: resizePoints, rotatePoints: rotatePoints, resizeLines: resizeLines} = this;
|
|
1009
|
+
const {editor: editor, target: target, mergeConfig: mergeConfig, single: single, rect: rect, circle: circle, buttons: buttons, resizePoints: resizePoints, rotatePoints: rotatePoints, resizeLines: resizeLines} = this;
|
|
1026
1010
|
const {editMask: editMask} = editor;
|
|
1027
1011
|
const {middlePoint: middlePoint, resizeable: resizeable, rotateable: rotateable, hideOnSmall: hideOnSmall, editBox: editBox, editBoxType: editBoxType, mask: mask, dimOthers: dimOthers, bright: bright, spread: spread, hideRotatePoints: hideRotatePoints, hideResizeLines: hideResizeLines} = mergeConfig;
|
|
1012
|
+
if (editBoxType === "stroke") {
|
|
1013
|
+
const {scaleX: scaleX, scaleY: scaleY} = target.worldTransform, {strokeBoxSpread: strokeBoxSpread} = target.__layout;
|
|
1014
|
+
strokeBoxSpread && draw.BoundsHelper.spread(bounds, [ strokeBoxSpread * Math.abs(scaleY), strokeBoxSpread * Math.abs(scaleX) ]);
|
|
1015
|
+
}
|
|
1016
|
+
if (spread) draw.BoundsHelper.spread(bounds, spread);
|
|
1028
1017
|
editMask.visible = mask ? true : 0;
|
|
1029
1018
|
if (!draw.isUndefined(dimOthers) || !draw.isUndefined(bright)) {
|
|
1030
1019
|
editor.setDimOthers(dimOthers);
|
|
@@ -1033,8 +1022,6 @@ class EditBox extends draw.Group {
|
|
|
1033
1022
|
} else if (editor.hasDimOthers) {
|
|
1034
1023
|
editor.cancelDimOthers();
|
|
1035
1024
|
}
|
|
1036
|
-
if (editBoxType === "stroke") draw.BoundsHelper.spread(bounds, this.target.__layout.strokeBoxSpread);
|
|
1037
|
-
if (spread) draw.BoundsHelper.spread(bounds, spread);
|
|
1038
1025
|
if (this.view.worldOpacity) {
|
|
1039
1026
|
const {width: width, height: height} = bounds;
|
|
1040
1027
|
const smallSize = draw.isNumber(hideOnSmall) ? hideOnSmall : 10;
|
|
@@ -1171,7 +1158,7 @@ class EditBox extends draw.Group {
|
|
|
1171
1158
|
this.dragPoint = null;
|
|
1172
1159
|
}
|
|
1173
1160
|
onTransformStart(e) {
|
|
1174
|
-
const {hideOnMove: hideOnMove
|
|
1161
|
+
const {hideOnMove: hideOnMove} = this.mergedConfig;
|
|
1175
1162
|
if (this.moving || this.gesturing) this.editor.opacity = hideOnMove ? 0 : 1;
|
|
1176
1163
|
if (this.resizing) draw.ResizeEvent.resizingKeys = this.editor.leafList.keys;
|
|
1177
1164
|
const {dragStartData: dragStartData, target: target} = this;
|
|
@@ -1182,7 +1169,7 @@ class EditBox extends draw.Group {
|
|
|
1182
1169
|
x: target.x,
|
|
1183
1170
|
y: target.y
|
|
1184
1171
|
};
|
|
1185
|
-
dragStartData.bounds = Object.assign({}, target.getLayoutBounds(
|
|
1172
|
+
dragStartData.bounds = Object.assign({}, target.getLayoutBounds("box", "local"));
|
|
1186
1173
|
dragStartData.rotation = target.rotation;
|
|
1187
1174
|
}
|
|
1188
1175
|
onTransformEnd(e) {
|
|
@@ -1555,6 +1542,9 @@ function registerEditTool() {
|
|
|
1555
1542
|
const registerInnerEditor = registerEditTool;
|
|
1556
1543
|
|
|
1557
1544
|
const EditToolCreator = {
|
|
1545
|
+
EditTool: "EditTool",
|
|
1546
|
+
LineEditTool: "LineEditTool",
|
|
1547
|
+
PointsEditTool: "PointsEditTool",
|
|
1558
1548
|
list: {},
|
|
1559
1549
|
register(EditTool, name) {
|
|
1560
1550
|
const {tag: tag} = EditTool.prototype;
|
|
@@ -1746,7 +1736,7 @@ class TransformTool {
|
|
|
1746
1736
|
}
|
|
1747
1737
|
onScale(e) {
|
|
1748
1738
|
const {target: target, mergeConfig: mergeConfig, single: single, dragStartData: dragStartData} = this.editBox;
|
|
1749
|
-
let {around: around, lockRatio: lockRatio, flipable: flipable, editSize: editSize
|
|
1739
|
+
let {around: around, lockRatio: lockRatio, flipable: flipable, editSize: editSize} = mergeConfig, totalMove;
|
|
1750
1740
|
if (e instanceof core.ZoomEvent) {
|
|
1751
1741
|
if (!around) around = target.getBoxPoint(e);
|
|
1752
1742
|
totalMove = e.totalScale;
|
|
@@ -1755,7 +1745,7 @@ class TransformTool {
|
|
|
1755
1745
|
}
|
|
1756
1746
|
const {direction: direction} = e.current;
|
|
1757
1747
|
if (e.shiftKey || target.lockRatio) lockRatio = true;
|
|
1758
|
-
const data = EditDataHelper.getScaleData(target, dragStartData.bounds, direction, totalMove, lockRatio, EditDataHelper.getAround(around, e.altKey), flipable, !single || editSize === "scale"
|
|
1748
|
+
const data = EditDataHelper.getScaleData(target, dragStartData.bounds, direction, totalMove, lockRatio, EditDataHelper.getAround(around, e.altKey), flipable, !single || editSize === "scale");
|
|
1759
1749
|
const targetX = target.x, targetY = target.y;
|
|
1760
1750
|
if (e instanceof core.DragEvent && this.editTool && this.editTool.onScaleWithDrag) {
|
|
1761
1751
|
data.drag = e;
|
|
@@ -1767,7 +1757,7 @@ class TransformTool {
|
|
|
1767
1757
|
}
|
|
1768
1758
|
onRotate(e) {
|
|
1769
1759
|
const {target: target, mergeConfig: mergeConfig, dragStartData: dragStartData} = this.editBox;
|
|
1770
|
-
const {around: around, rotateAround: rotateAround, rotateGap: rotateGap, diagonalRotateKey: diagonalRotateKey
|
|
1760
|
+
const {around: around, rotateAround: rotateAround, rotateGap: rotateGap, diagonalRotateKey: diagonalRotateKey} = mergeConfig;
|
|
1771
1761
|
const {direction: direction} = e.current;
|
|
1772
1762
|
let origin, rotation;
|
|
1773
1763
|
if (e instanceof core.RotateEvent) {
|
|
@@ -1775,7 +1765,7 @@ class TransformTool {
|
|
|
1775
1765
|
origin = rotateAround ? draw.AroundHelper.getPoint(rotateAround, target.boxBounds) : target.getBoxPoint(e);
|
|
1776
1766
|
} else {
|
|
1777
1767
|
const isDiagonalRotate = diagonalRotateKey ? e.isHoldKeys(diagonalRotateKey) : e.shiftKey;
|
|
1778
|
-
const data = EditDataHelper.getRotateData(target, direction, e, dragStartData, isDiagonalRotate ? null : rotateAround || target.around || target.origin || around || "center"
|
|
1768
|
+
const data = EditDataHelper.getRotateData(target, direction, e, dragStartData, isDiagonalRotate ? null : rotateAround || target.around || target.origin || around || "center");
|
|
1779
1769
|
rotation = dragStartData.rotation + data.rotation - target.rotation;
|
|
1780
1770
|
origin = data.origin;
|
|
1781
1771
|
}
|
|
@@ -1787,8 +1777,8 @@ class TransformTool {
|
|
|
1787
1777
|
}
|
|
1788
1778
|
onSkew(e) {
|
|
1789
1779
|
const {target: target, mergeConfig: mergeConfig} = this.editBox;
|
|
1790
|
-
const {around: around
|
|
1791
|
-
const {origin: origin, skewX: skewX, skewY: skewY} = EditDataHelper.getSkewData(target, e.current.direction, e.getInnerMove(target), EditDataHelper.getAround(around, e.altKey)
|
|
1780
|
+
const {around: around} = mergeConfig;
|
|
1781
|
+
const {origin: origin, skewX: skewX, skewY: skewY} = EditDataHelper.getSkewData(target, e.current.direction, e.getInnerMove(target), EditDataHelper.getAround(around, e.altKey));
|
|
1792
1782
|
if (!skewX && !skewY) return;
|
|
1793
1783
|
this.skewOf(origin, skewX, skewY);
|
|
1794
1784
|
}
|
|
@@ -1849,7 +1839,7 @@ class TransformTool {
|
|
|
1849
1839
|
scaleOf(origin, scaleX, scaleY = scaleX, _resize) {
|
|
1850
1840
|
if (!this.checkTransform("resizeable")) return;
|
|
1851
1841
|
const {target: target, mergeConfig: mergeConfig, single: single, editor: editor} = this.editBox;
|
|
1852
|
-
const {beforeScale: beforeScale
|
|
1842
|
+
const {beforeScale: beforeScale} = mergeConfig;
|
|
1853
1843
|
if (beforeScale) {
|
|
1854
1844
|
const check = beforeScale({
|
|
1855
1845
|
target: target,
|
|
@@ -1867,8 +1857,7 @@ class TransformTool {
|
|
|
1867
1857
|
worldOrigin: worldOrigin,
|
|
1868
1858
|
scaleX: scaleX,
|
|
1869
1859
|
scaleY: scaleY,
|
|
1870
|
-
transform: transform
|
|
1871
|
-
editBoxType: editBoxType
|
|
1860
|
+
transform: transform
|
|
1872
1861
|
};
|
|
1873
1862
|
this.emitEvent(new EditorScaleEvent(EditorScaleEvent.BEFORE_SCALE, data));
|
|
1874
1863
|
const event = new EditorScaleEvent(EditorScaleEvent.SCALE, data);
|
|
@@ -1896,7 +1885,7 @@ class TransformTool {
|
|
|
1896
1885
|
rotateOf(origin, rotation) {
|
|
1897
1886
|
if (!this.checkTransform("rotateable")) return;
|
|
1898
1887
|
const {target: target, mergeConfig: mergeConfig, single: single, editor: editor} = this.editBox;
|
|
1899
|
-
const {beforeRotate: beforeRotate
|
|
1888
|
+
const {beforeRotate: beforeRotate} = mergeConfig;
|
|
1900
1889
|
if (beforeRotate) {
|
|
1901
1890
|
const check = beforeRotate({
|
|
1902
1891
|
target: target,
|
|
@@ -1912,8 +1901,7 @@ class TransformTool {
|
|
|
1912
1901
|
editor: editor,
|
|
1913
1902
|
worldOrigin: worldOrigin,
|
|
1914
1903
|
rotation: rotation,
|
|
1915
|
-
transform: transform
|
|
1916
|
-
editBoxType: editBoxType
|
|
1904
|
+
transform: transform
|
|
1917
1905
|
};
|
|
1918
1906
|
this.emitEvent(new EditorRotateEvent(EditorRotateEvent.BEFORE_ROTATE, data));
|
|
1919
1907
|
const event = new EditorRotateEvent(EditorRotateEvent.ROTATE, data);
|
|
@@ -1923,7 +1911,7 @@ class TransformTool {
|
|
|
1923
1911
|
skewOf(origin, skewX, skewY = 0, _resize) {
|
|
1924
1912
|
if (!this.checkTransform("skewable")) return;
|
|
1925
1913
|
const {target: target, mergeConfig: mergeConfig, single: single, editor: editor} = this.editBox;
|
|
1926
|
-
const {beforeSkew: beforeSkew
|
|
1914
|
+
const {beforeSkew: beforeSkew} = mergeConfig;
|
|
1927
1915
|
if (beforeSkew) {
|
|
1928
1916
|
const check = beforeSkew({
|
|
1929
1917
|
target: target,
|
|
@@ -1941,8 +1929,7 @@ class TransformTool {
|
|
|
1941
1929
|
worldOrigin: worldOrigin,
|
|
1942
1930
|
skewX: skewX,
|
|
1943
1931
|
skewY: skewY,
|
|
1944
|
-
transform: transform
|
|
1945
|
-
editBoxType: editBoxType
|
|
1932
|
+
transform: transform
|
|
1946
1933
|
};
|
|
1947
1934
|
this.emitEvent(new EditorSkewEvent(EditorSkewEvent.BEFORE_SKEW, data));
|
|
1948
1935
|
const event = new EditorSkewEvent(EditorSkewEvent.SKEW, data);
|
|
@@ -2398,32 +2385,32 @@ exports.EditTool = class EditTool extends InnerEditor {
|
|
|
2398
2385
|
app.unlockLayout();
|
|
2399
2386
|
}
|
|
2400
2387
|
onScale(e) {
|
|
2401
|
-
const {scaleX: scaleX, scaleY: scaleY, transform: transform, worldOrigin: worldOrigin, editor: editor
|
|
2388
|
+
const {scaleX: scaleX, scaleY: scaleY, transform: transform, worldOrigin: worldOrigin, editor: editor} = e;
|
|
2402
2389
|
const {app: app, list: list} = editor;
|
|
2403
2390
|
app.lockLayout();
|
|
2404
2391
|
list.forEach(target => {
|
|
2405
2392
|
const resize = editor.getEditSize(target) !== "scale";
|
|
2406
|
-
if (transform) target.transformWorld(transform, resize, false
|
|
2393
|
+
if (transform) target.transformWorld(transform, resize, false); else target.scaleOfWorld(worldOrigin, scaleX, scaleY, resize, false);
|
|
2407
2394
|
});
|
|
2408
2395
|
app.unlockLayout();
|
|
2409
2396
|
}
|
|
2410
2397
|
onRotate(e) {
|
|
2411
|
-
const {rotation: rotation, transform: transform, worldOrigin: worldOrigin, editor: editor
|
|
2398
|
+
const {rotation: rotation, transform: transform, worldOrigin: worldOrigin, editor: editor} = e;
|
|
2412
2399
|
const {app: app, list: list} = editor;
|
|
2413
2400
|
app.lockLayout();
|
|
2414
2401
|
list.forEach(target => {
|
|
2415
2402
|
const resize = editor.getEditSize(target) !== "scale";
|
|
2416
|
-
if (transform) target.transformWorld(transform, resize, false
|
|
2403
|
+
if (transform) target.transformWorld(transform, resize, false); else target.rotateOfWorld(worldOrigin, rotation);
|
|
2417
2404
|
});
|
|
2418
2405
|
app.unlockLayout();
|
|
2419
2406
|
}
|
|
2420
2407
|
onSkew(e) {
|
|
2421
|
-
const {skewX: skewX, skewY: skewY, transform: transform, worldOrigin: worldOrigin, editor: editor
|
|
2408
|
+
const {skewX: skewX, skewY: skewY, transform: transform, worldOrigin: worldOrigin, editor: editor} = e;
|
|
2422
2409
|
const {app: app, list: list} = editor;
|
|
2423
2410
|
app.lockLayout();
|
|
2424
2411
|
list.forEach(target => {
|
|
2425
2412
|
const resize = editor.getEditSize(target) !== "scale";
|
|
2426
|
-
if (transform) target.transformWorld(transform, resize, false
|
|
2413
|
+
if (transform) target.transformWorld(transform, resize, false); else target.skewOfWorld(worldOrigin, skewX, skewY, resize);
|
|
2427
2414
|
});
|
|
2428
2415
|
app.unlockLayout();
|
|
2429
2416
|
}
|
|
@@ -2567,8 +2554,10 @@ draw.UI.addAttr("editConfig", undefined, draw.dataType);
|
|
|
2567
2554
|
|
|
2568
2555
|
draw.UI.addAttr("editOuter", ui => {
|
|
2569
2556
|
ui.updateLayout();
|
|
2570
|
-
const
|
|
2571
|
-
|
|
2557
|
+
const {EditTool: EditTool, LineEditTool: LineEditTool, PointsEditTool: PointsEditTool} = EditToolCreator;
|
|
2558
|
+
const name = ui.pathInputed || ui.isPointsMode ? PointsEditTool : ui.tag + "EditTool";
|
|
2559
|
+
const hasTool = EditToolCreator.list[name];
|
|
2560
|
+
return ui.__.__isLinePath && !(name == PointsEditTool && hasTool) ? LineEditTool : hasTool ? name : EditTool;
|
|
2572
2561
|
}, draw.dataType);
|
|
2573
2562
|
|
|
2574
2563
|
draw.UI.addAttr("editInner", "PathEditor", draw.dataType);
|
package/dist/editor.esm.js
CHANGED
|
@@ -489,17 +489,16 @@ const {topLeft: topLeft, top: top, topRight: topRight, right: right$1, bottomRig
|
|
|
489
489
|
const {toPoint: toPoint} = AroundHelper, {within: within, sign: sign} = MathHelper, {abs: abs} = Math;
|
|
490
490
|
|
|
491
491
|
const EditDataHelper = {
|
|
492
|
-
getScaleData(target, startBounds, direction, totalMoveOrScale, lockRatio, around, flipable, scaleMode
|
|
492
|
+
getScaleData(target, startBounds, direction, totalMoveOrScale, lockRatio, around, flipable, scaleMode) {
|
|
493
493
|
let align, origin = {}, scaleX = 1, scaleY = 1, lockScale;
|
|
494
494
|
const {widthRange: widthRange, heightRange: heightRange, dragBounds: dragBounds, worldTransform: worldTransform, boxBounds: boxBounds} = target;
|
|
495
495
|
const {width: width, height: height} = startBounds, worldScaleX = abs(worldTransform.scaleX), worldScaleY = abs(worldTransform.scaleY);
|
|
496
|
-
const innerBounds = target.getBounds(boundsType, "inner");
|
|
497
496
|
const originChangedScaleX = target.scaleX / startBounds.scaleX;
|
|
498
497
|
const originChangedScaleY = target.scaleY / startBounds.scaleY;
|
|
499
498
|
const signX = sign(originChangedScaleX);
|
|
500
499
|
const signY = sign(originChangedScaleY);
|
|
501
|
-
const changedScaleX = scaleMode ? originChangedScaleX : signX *
|
|
502
|
-
const changedScaleY = scaleMode ? originChangedScaleY : signY *
|
|
500
|
+
const changedScaleX = scaleMode ? originChangedScaleX : signX * boxBounds.width / width;
|
|
501
|
+
const changedScaleY = scaleMode ? originChangedScaleY : signY * boxBounds.height / height;
|
|
503
502
|
if (isNumber(totalMoveOrScale)) {
|
|
504
503
|
scaleX = scaleY = Math.sqrt(totalMoveOrScale);
|
|
505
504
|
} else {
|
|
@@ -584,11 +583,10 @@ const EditDataHelper = {
|
|
|
584
583
|
if (useScaleX) scaleX /= changedScaleX;
|
|
585
584
|
if (useScaleY) scaleY /= changedScaleY;
|
|
586
585
|
if (!flipable) {
|
|
587
|
-
if (scaleX < 0) scaleX = 1 /
|
|
588
|
-
if (scaleY < 0) scaleY = 1 /
|
|
586
|
+
if (scaleX < 0) scaleX = 1 / boxBounds.width / worldScaleX;
|
|
587
|
+
if (scaleY < 0) scaleY = 1 / boxBounds.height / worldScaleY;
|
|
589
588
|
}
|
|
590
|
-
toPoint(around || align,
|
|
591
|
-
this.checkOrigin(target, origin, boundsType);
|
|
589
|
+
toPoint(around || align, boxBounds, origin, true);
|
|
592
590
|
if (dragBounds) {
|
|
593
591
|
const scaleData = {
|
|
594
592
|
x: scaleX,
|
|
@@ -599,19 +597,15 @@ const EditDataHelper = {
|
|
|
599
597
|
scaleY = scaleData.y;
|
|
600
598
|
}
|
|
601
599
|
if (useScaleX && widthRange) {
|
|
602
|
-
const nowWidth =
|
|
600
|
+
const nowWidth = boxBounds.width * target.scaleX;
|
|
603
601
|
scaleX = within(nowWidth * scaleX, widthRange) / nowWidth;
|
|
604
602
|
}
|
|
605
603
|
if (useScaleY && heightRange) {
|
|
606
|
-
const nowHeight =
|
|
604
|
+
const nowHeight = boxBounds.height * target.scaleY;
|
|
607
605
|
scaleY = within(nowHeight * scaleY, heightRange) / nowHeight;
|
|
608
606
|
}
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
minWidth += (innerBounds.width - boxBounds.width) * worldScaleX;
|
|
612
|
-
minHeight += (innerBounds.height - boxBounds.height) * worldScaleY;
|
|
613
|
-
}
|
|
614
|
-
const worldWidth = worldScaleX * innerBounds.width, worldHeight = worldScaleY * innerBounds.height;
|
|
607
|
+
const minWidth = 1, minHeight = 1;
|
|
608
|
+
const worldWidth = worldScaleX * boxBounds.width, worldHeight = worldScaleY * boxBounds.height;
|
|
615
609
|
if (useScaleX && abs(scaleX * worldWidth) < minWidth) scaleX = sign(scaleX) * minWidth / worldWidth;
|
|
616
610
|
if (useScaleY && abs(scaleY * worldHeight) < minHeight) scaleY = sign(scaleY) * minHeight / worldHeight;
|
|
617
611
|
if (lockRatio && scaleX !== scaleY) {
|
|
@@ -630,7 +624,7 @@ const EditDataHelper = {
|
|
|
630
624
|
around: around
|
|
631
625
|
};
|
|
632
626
|
},
|
|
633
|
-
getRotateData(target, direction, current, last, around
|
|
627
|
+
getRotateData(target, direction, current, last, around) {
|
|
634
628
|
let align, origin = {};
|
|
635
629
|
switch (direction) {
|
|
636
630
|
case topLeft:
|
|
@@ -652,14 +646,13 @@ const EditDataHelper = {
|
|
|
652
646
|
default:
|
|
653
647
|
align = "center";
|
|
654
648
|
}
|
|
655
|
-
toPoint(around || align, target.
|
|
656
|
-
this.checkOrigin(target, origin, boundsType);
|
|
649
|
+
toPoint(around || align, target.boxBounds, origin, true);
|
|
657
650
|
return {
|
|
658
651
|
origin: origin,
|
|
659
652
|
rotation: PointHelper.getRotation(last, target.getWorldPointByBox(origin), current)
|
|
660
653
|
};
|
|
661
654
|
},
|
|
662
|
-
getSkewData(target, direction, move, around
|
|
655
|
+
getSkewData(target, direction, move, around) {
|
|
663
656
|
let align, origin = {}, skewX = 0, skewY = 0;
|
|
664
657
|
let last;
|
|
665
658
|
switch (direction) {
|
|
@@ -702,12 +695,10 @@ const EditDataHelper = {
|
|
|
702
695
|
align = "left";
|
|
703
696
|
skewY = 1;
|
|
704
697
|
}
|
|
705
|
-
const
|
|
706
|
-
const {width: width, height: height} = innerBounds;
|
|
698
|
+
const {boxBounds: boxBounds} = target, {width: width, height: height} = boxBounds;
|
|
707
699
|
last.x = last.x * width;
|
|
708
700
|
last.y = last.y * height;
|
|
709
|
-
toPoint(around || align,
|
|
710
|
-
this.checkOrigin(target, origin, boundsType);
|
|
701
|
+
toPoint(around || align, boxBounds, origin, true);
|
|
711
702
|
const rotation = PointHelper.getRotation(last, origin, {
|
|
712
703
|
x: last.x + (skewX ? move.x : 0),
|
|
713
704
|
y: last.y + (skewY ? move.y : 0)
|
|
@@ -719,13 +710,6 @@ const EditDataHelper = {
|
|
|
719
710
|
skewY: skewY
|
|
720
711
|
};
|
|
721
712
|
},
|
|
722
|
-
checkOrigin(target, origin, boundsType) {
|
|
723
|
-
if (boundsType !== "box") {
|
|
724
|
-
const {boxBounds: boxBounds} = target, innerBounds = target.getBounds(boundsType, "inner");
|
|
725
|
-
origin.x += innerBounds.x - boxBounds.x;
|
|
726
|
-
origin.y += innerBounds.y - boxBounds.y;
|
|
727
|
-
}
|
|
728
|
-
},
|
|
729
713
|
getAround(around, altKey) {
|
|
730
714
|
return altKey && !around ? "center" : around;
|
|
731
715
|
},
|
|
@@ -1020,9 +1004,14 @@ class EditBox extends Group {
|
|
|
1020
1004
|
if (this.app) this.rect.syncEventer = this.app.interaction.bottomList = null;
|
|
1021
1005
|
}
|
|
1022
1006
|
updateBounds(bounds) {
|
|
1023
|
-
const {editor: editor, mergeConfig: mergeConfig, single: single, rect: rect, circle: circle, buttons: buttons, resizePoints: resizePoints, rotatePoints: rotatePoints, resizeLines: resizeLines} = this;
|
|
1007
|
+
const {editor: editor, target: target, mergeConfig: mergeConfig, single: single, rect: rect, circle: circle, buttons: buttons, resizePoints: resizePoints, rotatePoints: rotatePoints, resizeLines: resizeLines} = this;
|
|
1024
1008
|
const {editMask: editMask} = editor;
|
|
1025
1009
|
const {middlePoint: middlePoint, resizeable: resizeable, rotateable: rotateable, hideOnSmall: hideOnSmall, editBox: editBox, editBoxType: editBoxType, mask: mask, dimOthers: dimOthers, bright: bright, spread: spread, hideRotatePoints: hideRotatePoints, hideResizeLines: hideResizeLines} = mergeConfig;
|
|
1010
|
+
if (editBoxType === "stroke") {
|
|
1011
|
+
const {scaleX: scaleX, scaleY: scaleY} = target.worldTransform, {strokeBoxSpread: strokeBoxSpread} = target.__layout;
|
|
1012
|
+
strokeBoxSpread && BoundsHelper.spread(bounds, [ strokeBoxSpread * Math.abs(scaleY), strokeBoxSpread * Math.abs(scaleX) ]);
|
|
1013
|
+
}
|
|
1014
|
+
if (spread) BoundsHelper.spread(bounds, spread);
|
|
1026
1015
|
editMask.visible = mask ? true : 0;
|
|
1027
1016
|
if (!isUndefined(dimOthers) || !isUndefined(bright)) {
|
|
1028
1017
|
editor.setDimOthers(dimOthers);
|
|
@@ -1031,8 +1020,6 @@ class EditBox extends Group {
|
|
|
1031
1020
|
} else if (editor.hasDimOthers) {
|
|
1032
1021
|
editor.cancelDimOthers();
|
|
1033
1022
|
}
|
|
1034
|
-
if (editBoxType === "stroke") BoundsHelper.spread(bounds, this.target.__layout.strokeBoxSpread);
|
|
1035
|
-
if (spread) BoundsHelper.spread(bounds, spread);
|
|
1036
1023
|
if (this.view.worldOpacity) {
|
|
1037
1024
|
const {width: width, height: height} = bounds;
|
|
1038
1025
|
const smallSize = isNumber(hideOnSmall) ? hideOnSmall : 10;
|
|
@@ -1169,7 +1156,7 @@ class EditBox extends Group {
|
|
|
1169
1156
|
this.dragPoint = null;
|
|
1170
1157
|
}
|
|
1171
1158
|
onTransformStart(e) {
|
|
1172
|
-
const {hideOnMove: hideOnMove
|
|
1159
|
+
const {hideOnMove: hideOnMove} = this.mergedConfig;
|
|
1173
1160
|
if (this.moving || this.gesturing) this.editor.opacity = hideOnMove ? 0 : 1;
|
|
1174
1161
|
if (this.resizing) ResizeEvent.resizingKeys = this.editor.leafList.keys;
|
|
1175
1162
|
const {dragStartData: dragStartData, target: target} = this;
|
|
@@ -1180,7 +1167,7 @@ class EditBox extends Group {
|
|
|
1180
1167
|
x: target.x,
|
|
1181
1168
|
y: target.y
|
|
1182
1169
|
};
|
|
1183
|
-
dragStartData.bounds = Object.assign({}, target.getLayoutBounds(
|
|
1170
|
+
dragStartData.bounds = Object.assign({}, target.getLayoutBounds("box", "local"));
|
|
1184
1171
|
dragStartData.rotation = target.rotation;
|
|
1185
1172
|
}
|
|
1186
1173
|
onTransformEnd(e) {
|
|
@@ -1553,6 +1540,9 @@ function registerEditTool() {
|
|
|
1553
1540
|
const registerInnerEditor = registerEditTool;
|
|
1554
1541
|
|
|
1555
1542
|
const EditToolCreator = {
|
|
1543
|
+
EditTool: "EditTool",
|
|
1544
|
+
LineEditTool: "LineEditTool",
|
|
1545
|
+
PointsEditTool: "PointsEditTool",
|
|
1556
1546
|
list: {},
|
|
1557
1547
|
register(EditTool, name) {
|
|
1558
1548
|
const {tag: tag} = EditTool.prototype;
|
|
@@ -1744,7 +1734,7 @@ class TransformTool {
|
|
|
1744
1734
|
}
|
|
1745
1735
|
onScale(e) {
|
|
1746
1736
|
const {target: target, mergeConfig: mergeConfig, single: single, dragStartData: dragStartData} = this.editBox;
|
|
1747
|
-
let {around: around, lockRatio: lockRatio, flipable: flipable, editSize: editSize
|
|
1737
|
+
let {around: around, lockRatio: lockRatio, flipable: flipable, editSize: editSize} = mergeConfig, totalMove;
|
|
1748
1738
|
if (e instanceof ZoomEvent) {
|
|
1749
1739
|
if (!around) around = target.getBoxPoint(e);
|
|
1750
1740
|
totalMove = e.totalScale;
|
|
@@ -1753,7 +1743,7 @@ class TransformTool {
|
|
|
1753
1743
|
}
|
|
1754
1744
|
const {direction: direction} = e.current;
|
|
1755
1745
|
if (e.shiftKey || target.lockRatio) lockRatio = true;
|
|
1756
|
-
const data = EditDataHelper.getScaleData(target, dragStartData.bounds, direction, totalMove, lockRatio, EditDataHelper.getAround(around, e.altKey), flipable, !single || editSize === "scale"
|
|
1746
|
+
const data = EditDataHelper.getScaleData(target, dragStartData.bounds, direction, totalMove, lockRatio, EditDataHelper.getAround(around, e.altKey), flipable, !single || editSize === "scale");
|
|
1757
1747
|
const targetX = target.x, targetY = target.y;
|
|
1758
1748
|
if (e instanceof DragEvent && this.editTool && this.editTool.onScaleWithDrag) {
|
|
1759
1749
|
data.drag = e;
|
|
@@ -1765,7 +1755,7 @@ class TransformTool {
|
|
|
1765
1755
|
}
|
|
1766
1756
|
onRotate(e) {
|
|
1767
1757
|
const {target: target, mergeConfig: mergeConfig, dragStartData: dragStartData} = this.editBox;
|
|
1768
|
-
const {around: around, rotateAround: rotateAround, rotateGap: rotateGap, diagonalRotateKey: diagonalRotateKey
|
|
1758
|
+
const {around: around, rotateAround: rotateAround, rotateGap: rotateGap, diagonalRotateKey: diagonalRotateKey} = mergeConfig;
|
|
1769
1759
|
const {direction: direction} = e.current;
|
|
1770
1760
|
let origin, rotation;
|
|
1771
1761
|
if (e instanceof RotateEvent) {
|
|
@@ -1773,7 +1763,7 @@ class TransformTool {
|
|
|
1773
1763
|
origin = rotateAround ? AroundHelper.getPoint(rotateAround, target.boxBounds) : target.getBoxPoint(e);
|
|
1774
1764
|
} else {
|
|
1775
1765
|
const isDiagonalRotate = diagonalRotateKey ? e.isHoldKeys(diagonalRotateKey) : e.shiftKey;
|
|
1776
|
-
const data = EditDataHelper.getRotateData(target, direction, e, dragStartData, isDiagonalRotate ? null : rotateAround || target.around || target.origin || around || "center"
|
|
1766
|
+
const data = EditDataHelper.getRotateData(target, direction, e, dragStartData, isDiagonalRotate ? null : rotateAround || target.around || target.origin || around || "center");
|
|
1777
1767
|
rotation = dragStartData.rotation + data.rotation - target.rotation;
|
|
1778
1768
|
origin = data.origin;
|
|
1779
1769
|
}
|
|
@@ -1785,8 +1775,8 @@ class TransformTool {
|
|
|
1785
1775
|
}
|
|
1786
1776
|
onSkew(e) {
|
|
1787
1777
|
const {target: target, mergeConfig: mergeConfig} = this.editBox;
|
|
1788
|
-
const {around: around
|
|
1789
|
-
const {origin: origin, skewX: skewX, skewY: skewY} = EditDataHelper.getSkewData(target, e.current.direction, e.getInnerMove(target), EditDataHelper.getAround(around, e.altKey)
|
|
1778
|
+
const {around: around} = mergeConfig;
|
|
1779
|
+
const {origin: origin, skewX: skewX, skewY: skewY} = EditDataHelper.getSkewData(target, e.current.direction, e.getInnerMove(target), EditDataHelper.getAround(around, e.altKey));
|
|
1790
1780
|
if (!skewX && !skewY) return;
|
|
1791
1781
|
this.skewOf(origin, skewX, skewY);
|
|
1792
1782
|
}
|
|
@@ -1847,7 +1837,7 @@ class TransformTool {
|
|
|
1847
1837
|
scaleOf(origin, scaleX, scaleY = scaleX, _resize) {
|
|
1848
1838
|
if (!this.checkTransform("resizeable")) return;
|
|
1849
1839
|
const {target: target, mergeConfig: mergeConfig, single: single, editor: editor} = this.editBox;
|
|
1850
|
-
const {beforeScale: beforeScale
|
|
1840
|
+
const {beforeScale: beforeScale} = mergeConfig;
|
|
1851
1841
|
if (beforeScale) {
|
|
1852
1842
|
const check = beforeScale({
|
|
1853
1843
|
target: target,
|
|
@@ -1865,8 +1855,7 @@ class TransformTool {
|
|
|
1865
1855
|
worldOrigin: worldOrigin,
|
|
1866
1856
|
scaleX: scaleX,
|
|
1867
1857
|
scaleY: scaleY,
|
|
1868
|
-
transform: transform
|
|
1869
|
-
editBoxType: editBoxType
|
|
1858
|
+
transform: transform
|
|
1870
1859
|
};
|
|
1871
1860
|
this.emitEvent(new EditorScaleEvent(EditorScaleEvent.BEFORE_SCALE, data));
|
|
1872
1861
|
const event = new EditorScaleEvent(EditorScaleEvent.SCALE, data);
|
|
@@ -1894,7 +1883,7 @@ class TransformTool {
|
|
|
1894
1883
|
rotateOf(origin, rotation) {
|
|
1895
1884
|
if (!this.checkTransform("rotateable")) return;
|
|
1896
1885
|
const {target: target, mergeConfig: mergeConfig, single: single, editor: editor} = this.editBox;
|
|
1897
|
-
const {beforeRotate: beforeRotate
|
|
1886
|
+
const {beforeRotate: beforeRotate} = mergeConfig;
|
|
1898
1887
|
if (beforeRotate) {
|
|
1899
1888
|
const check = beforeRotate({
|
|
1900
1889
|
target: target,
|
|
@@ -1910,8 +1899,7 @@ class TransformTool {
|
|
|
1910
1899
|
editor: editor,
|
|
1911
1900
|
worldOrigin: worldOrigin,
|
|
1912
1901
|
rotation: rotation,
|
|
1913
|
-
transform: transform
|
|
1914
|
-
editBoxType: editBoxType
|
|
1902
|
+
transform: transform
|
|
1915
1903
|
};
|
|
1916
1904
|
this.emitEvent(new EditorRotateEvent(EditorRotateEvent.BEFORE_ROTATE, data));
|
|
1917
1905
|
const event = new EditorRotateEvent(EditorRotateEvent.ROTATE, data);
|
|
@@ -1921,7 +1909,7 @@ class TransformTool {
|
|
|
1921
1909
|
skewOf(origin, skewX, skewY = 0, _resize) {
|
|
1922
1910
|
if (!this.checkTransform("skewable")) return;
|
|
1923
1911
|
const {target: target, mergeConfig: mergeConfig, single: single, editor: editor} = this.editBox;
|
|
1924
|
-
const {beforeSkew: beforeSkew
|
|
1912
|
+
const {beforeSkew: beforeSkew} = mergeConfig;
|
|
1925
1913
|
if (beforeSkew) {
|
|
1926
1914
|
const check = beforeSkew({
|
|
1927
1915
|
target: target,
|
|
@@ -1939,8 +1927,7 @@ class TransformTool {
|
|
|
1939
1927
|
worldOrigin: worldOrigin,
|
|
1940
1928
|
skewX: skewX,
|
|
1941
1929
|
skewY: skewY,
|
|
1942
|
-
transform: transform
|
|
1943
|
-
editBoxType: editBoxType
|
|
1930
|
+
transform: transform
|
|
1944
1931
|
};
|
|
1945
1932
|
this.emitEvent(new EditorSkewEvent(EditorSkewEvent.BEFORE_SKEW, data));
|
|
1946
1933
|
const event = new EditorSkewEvent(EditorSkewEvent.SKEW, data);
|
|
@@ -2396,32 +2383,32 @@ let EditTool = class EditTool extends InnerEditor {
|
|
|
2396
2383
|
app.unlockLayout();
|
|
2397
2384
|
}
|
|
2398
2385
|
onScale(e) {
|
|
2399
|
-
const {scaleX: scaleX, scaleY: scaleY, transform: transform, worldOrigin: worldOrigin, editor: editor
|
|
2386
|
+
const {scaleX: scaleX, scaleY: scaleY, transform: transform, worldOrigin: worldOrigin, editor: editor} = e;
|
|
2400
2387
|
const {app: app, list: list} = editor;
|
|
2401
2388
|
app.lockLayout();
|
|
2402
2389
|
list.forEach(target => {
|
|
2403
2390
|
const resize = editor.getEditSize(target) !== "scale";
|
|
2404
|
-
if (transform) target.transformWorld(transform, resize, false
|
|
2391
|
+
if (transform) target.transformWorld(transform, resize, false); else target.scaleOfWorld(worldOrigin, scaleX, scaleY, resize, false);
|
|
2405
2392
|
});
|
|
2406
2393
|
app.unlockLayout();
|
|
2407
2394
|
}
|
|
2408
2395
|
onRotate(e) {
|
|
2409
|
-
const {rotation: rotation, transform: transform, worldOrigin: worldOrigin, editor: editor
|
|
2396
|
+
const {rotation: rotation, transform: transform, worldOrigin: worldOrigin, editor: editor} = e;
|
|
2410
2397
|
const {app: app, list: list} = editor;
|
|
2411
2398
|
app.lockLayout();
|
|
2412
2399
|
list.forEach(target => {
|
|
2413
2400
|
const resize = editor.getEditSize(target) !== "scale";
|
|
2414
|
-
if (transform) target.transformWorld(transform, resize, false
|
|
2401
|
+
if (transform) target.transformWorld(transform, resize, false); else target.rotateOfWorld(worldOrigin, rotation);
|
|
2415
2402
|
});
|
|
2416
2403
|
app.unlockLayout();
|
|
2417
2404
|
}
|
|
2418
2405
|
onSkew(e) {
|
|
2419
|
-
const {skewX: skewX, skewY: skewY, transform: transform, worldOrigin: worldOrigin, editor: editor
|
|
2406
|
+
const {skewX: skewX, skewY: skewY, transform: transform, worldOrigin: worldOrigin, editor: editor} = e;
|
|
2420
2407
|
const {app: app, list: list} = editor;
|
|
2421
2408
|
app.lockLayout();
|
|
2422
2409
|
list.forEach(target => {
|
|
2423
2410
|
const resize = editor.getEditSize(target) !== "scale";
|
|
2424
|
-
if (transform) target.transformWorld(transform, resize, false
|
|
2411
|
+
if (transform) target.transformWorld(transform, resize, false); else target.skewOfWorld(worldOrigin, skewX, skewY, resize);
|
|
2425
2412
|
});
|
|
2426
2413
|
app.unlockLayout();
|
|
2427
2414
|
}
|
|
@@ -2565,8 +2552,10 @@ UI.addAttr("editConfig", undefined, dataType);
|
|
|
2565
2552
|
|
|
2566
2553
|
UI.addAttr("editOuter", ui => {
|
|
2567
2554
|
ui.updateLayout();
|
|
2568
|
-
const
|
|
2569
|
-
|
|
2555
|
+
const {EditTool: EditTool, LineEditTool: LineEditTool, PointsEditTool: PointsEditTool} = EditToolCreator;
|
|
2556
|
+
const name = ui.pathInputed || ui.isPointsMode ? PointsEditTool : ui.tag + "EditTool";
|
|
2557
|
+
const hasTool = EditToolCreator.list[name];
|
|
2558
|
+
return ui.__.__isLinePath && !(name == PointsEditTool && hasTool) ? LineEditTool : hasTool ? name : EditTool;
|
|
2570
2559
|
}, dataType);
|
|
2571
2560
|
|
|
2572
2561
|
UI.addAttr("editInner", "PathEditor", dataType);
|