@leafer-in/editor 1.4.0 → 1.4.1
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 +16 -6
- package/dist/editor.cjs.map +1 -1
- package/dist/editor.esm.js +17 -7
- package/dist/editor.esm.js.map +1 -1
- package/dist/editor.esm.min.js +1 -1
- package/dist/editor.esm.min.js.map +1 -1
- package/dist/editor.js +16 -6
- package/dist/editor.js.map +1 -1
- 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 +5 -5
- package/src/Editor.ts +2 -1
- package/src/helper/EditDataHelper.ts +17 -5
package/dist/editor.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Event, defineKey,
|
|
1
|
+
import { Event, defineKey, MatrixHelper, BoundsHelper, LeafBoundsHelper, getMatrixData, getBoundsData, UI, Paint, Group, Rect, Bounds, LeafList, Direction9, AroundHelper, MathHelper, PointHelper, Box, Text, Matrix, Debug, LeafHelper, PropertyEvent, DataHelper, RenderEvent, getPointData, Plugin as Plugin$1, Creator, dataType } from '@leafer-ui/draw';
|
|
2
2
|
import { PointerEvent, DragEvent, MoveEvent, ZoomEvent, Plugin, RotateEvent, KeyEvent } from '@leafer-ui/core';
|
|
3
3
|
import '@leafer-in/resize';
|
|
4
4
|
|
|
@@ -160,7 +160,7 @@ class Stroker extends UI {
|
|
|
160
160
|
}
|
|
161
161
|
__decorate([
|
|
162
162
|
targetAttr(onTarget$1)
|
|
163
|
-
], Stroker.prototype, "target",
|
|
163
|
+
], Stroker.prototype, "target", void 0);
|
|
164
164
|
function onTarget$1(stroker) {
|
|
165
165
|
const value = stroker.target;
|
|
166
166
|
stroker.list = value ? (value instanceof Array ? value : [value]) : [];
|
|
@@ -439,7 +439,7 @@ const { within } = MathHelper;
|
|
|
439
439
|
const EditDataHelper = {
|
|
440
440
|
getScaleData(element, startBounds, direction, totalMove, lockRatio, around, flipable, scaleMode) {
|
|
441
441
|
let align, origin = {}, scaleX = 1, scaleY = 1;
|
|
442
|
-
const { boxBounds, widthRange, heightRange } = element;
|
|
442
|
+
const { boxBounds, widthRange, heightRange, dragBounds } = element;
|
|
443
443
|
const { width, height } = startBounds;
|
|
444
444
|
if (around) {
|
|
445
445
|
totalMove.x *= 2;
|
|
@@ -527,6 +527,17 @@ const EditDataHelper = {
|
|
|
527
527
|
if (scaleY < 0)
|
|
528
528
|
scaleY = 1 / boxBounds.height / worldTransform.scaleY;
|
|
529
529
|
}
|
|
530
|
+
toPoint(around || align, boxBounds, origin, true);
|
|
531
|
+
if (dragBounds) {
|
|
532
|
+
const allowBounds = dragBounds === 'parent' ? element.parent.boxBounds : dragBounds;
|
|
533
|
+
const localBounds = new Bounds(element.__localBoxBounds);
|
|
534
|
+
localBounds.scaleOf(element.getLocalPointByInner(origin), scaleX, scaleY);
|
|
535
|
+
if (!BoundsHelper.includes(allowBounds, localBounds)) {
|
|
536
|
+
const realBounds = localBounds.getIntersect(allowBounds);
|
|
537
|
+
scaleX *= realBounds.width / localBounds.width;
|
|
538
|
+
scaleY *= realBounds.height / localBounds.height;
|
|
539
|
+
}
|
|
540
|
+
}
|
|
530
541
|
if (widthRange) {
|
|
531
542
|
const nowWidth = boxBounds.width * element.scaleX;
|
|
532
543
|
scaleX = within(nowWidth * scaleX, widthRange) / nowWidth;
|
|
@@ -535,7 +546,6 @@ const EditDataHelper = {
|
|
|
535
546
|
const nowHeight = boxBounds.height * element.scaleY;
|
|
536
547
|
scaleY = within(nowHeight * scaleY, heightRange) / nowHeight;
|
|
537
548
|
}
|
|
538
|
-
toPoint(around || align, boxBounds, origin, true);
|
|
539
549
|
return { origin, scaleX, scaleY, direction, lockRatio, around };
|
|
540
550
|
},
|
|
541
551
|
getRotateData(bounds, direction, current, last, around) {
|
|
@@ -1439,9 +1449,9 @@ class Editor extends Group {
|
|
|
1439
1449
|
this.skewOf(origin, skewX, skewY);
|
|
1440
1450
|
}
|
|
1441
1451
|
move(x, y = 0) {
|
|
1452
|
+
const { element } = this;
|
|
1442
1453
|
if (!this.checkTransform('moveable'))
|
|
1443
1454
|
return;
|
|
1444
|
-
const { element } = this;
|
|
1445
1455
|
const world = element.getWorldPointByLocal(typeof x === 'object' ? Object.assign({}, x) : { x, y }, null, true);
|
|
1446
1456
|
if (this.multiple)
|
|
1447
1457
|
element.safeChange(() => element.move(x, y));
|
|
@@ -1649,10 +1659,10 @@ class Editor extends Group {
|
|
|
1649
1659
|
}
|
|
1650
1660
|
__decorate([
|
|
1651
1661
|
targetAttr(onHover)
|
|
1652
|
-
], Editor.prototype, "hoverTarget",
|
|
1662
|
+
], Editor.prototype, "hoverTarget", void 0);
|
|
1653
1663
|
__decorate([
|
|
1654
1664
|
targetAttr(onTarget)
|
|
1655
|
-
], Editor.prototype, "target",
|
|
1665
|
+
], Editor.prototype, "target", void 0);
|
|
1656
1666
|
|
|
1657
1667
|
class InnerEditor {
|
|
1658
1668
|
static registerInnerEditor() {
|