@leafer/worker 1.9.2 → 1.9.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 +89 -71
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +90 -71
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +22 -22
package/dist/worker.module.js
CHANGED
|
@@ -54,7 +54,7 @@ function isUndefined(value) {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
function isNull(value) {
|
|
57
|
-
return value
|
|
57
|
+
return value == null;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
function isString(value) {
|
|
@@ -304,6 +304,9 @@ const MathHelper = {
|
|
|
304
304
|
num = round$6(num * a) / a;
|
|
305
305
|
return num === -0 ? 0 : num;
|
|
306
306
|
},
|
|
307
|
+
sign(num) {
|
|
308
|
+
return num < 0 ? -1 : 1;
|
|
309
|
+
},
|
|
307
310
|
getScaleData(scale, size, originSize, scaleData) {
|
|
308
311
|
if (!scaleData) scaleData = {};
|
|
309
312
|
if (size) {
|
|
@@ -659,7 +662,7 @@ const M$a = MatrixHelper;
|
|
|
659
662
|
|
|
660
663
|
const {toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$3} = MatrixHelper;
|
|
661
664
|
|
|
662
|
-
const {sin: sin$5, cos: cos$5, abs: abs$
|
|
665
|
+
const {sin: sin$5, cos: cos$5, abs: abs$7, sqrt: sqrt$4, atan2: atan2$2, min: min$1, round: round$5} = Math;
|
|
663
666
|
|
|
664
667
|
const PointHelper = {
|
|
665
668
|
defaultPoint: getPointData(),
|
|
@@ -752,8 +755,8 @@ const PointHelper = {
|
|
|
752
755
|
return getDistanceFrom(t.x, t.y, point.x, point.y);
|
|
753
756
|
},
|
|
754
757
|
getDistanceFrom(x1, y1, x2, y2) {
|
|
755
|
-
const x = abs$
|
|
756
|
-
const y = abs$
|
|
758
|
+
const x = abs$7(x2 - x1);
|
|
759
|
+
const y = abs$7(y2 - y1);
|
|
757
760
|
return sqrt$4(x * x + y * y);
|
|
758
761
|
},
|
|
759
762
|
getMinDistanceFrom(x1, y1, x2, y2, x3, y3) {
|
|
@@ -1191,10 +1194,8 @@ const BoundsHelper = {
|
|
|
1191
1194
|
t.y += y;
|
|
1192
1195
|
},
|
|
1193
1196
|
scroll(t, data) {
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
t.y += data.scrollY;
|
|
1197
|
-
}
|
|
1197
|
+
t.x += data.scrollX;
|
|
1198
|
+
t.y += data.scrollY;
|
|
1198
1199
|
},
|
|
1199
1200
|
getByMove(t, x, y) {
|
|
1200
1201
|
t = Object.assign({}, t);
|
|
@@ -2542,7 +2543,7 @@ const RectHelper = {
|
|
|
2542
2543
|
}
|
|
2543
2544
|
};
|
|
2544
2545
|
|
|
2545
|
-
const {sin: sin$4, cos: cos$4, atan2: atan2$1, ceil: ceil$1, abs: abs$
|
|
2546
|
+
const {sin: sin$4, cos: cos$4, atan2: atan2$1, ceil: ceil$1, abs: abs$6, PI: PI$3, sqrt: sqrt$3, pow: pow$1} = Math;
|
|
2546
2547
|
|
|
2547
2548
|
const {setPoint: setPoint$4, addPoint: addPoint$2} = TwoPointBoundsHelper;
|
|
2548
2549
|
|
|
@@ -2615,7 +2616,7 @@ const BezierHelper = {
|
|
|
2615
2616
|
let endRadian = atan2$1(CBy, CBx);
|
|
2616
2617
|
let totalRadian = endRadian - startRadian;
|
|
2617
2618
|
if (totalRadian < 0) totalRadian += PI2;
|
|
2618
|
-
if (totalRadian === PI$3 || abs$
|
|
2619
|
+
if (totalRadian === PI$3 || abs$6(BAx + BAy) < 1e-12 || abs$6(CBx + CBy) < 1e-12) {
|
|
2619
2620
|
if (data) data.push(L$a, x1, y1);
|
|
2620
2621
|
if (setPointBounds) {
|
|
2621
2622
|
setPoint$4(setPointBounds, fromX, fromY);
|
|
@@ -2648,7 +2649,7 @@ const BezierHelper = {
|
|
|
2648
2649
|
let totalRadian = endRadian - startRadian;
|
|
2649
2650
|
if (totalRadian < 0) totalRadian += PI2; else if (totalRadian > PI2) totalRadian -= PI2;
|
|
2650
2651
|
if (anticlockwise) totalRadian -= PI2;
|
|
2651
|
-
const parts = ceil$1(abs$
|
|
2652
|
+
const parts = ceil$1(abs$6(totalRadian / PI_2));
|
|
2652
2653
|
const partRadian = totalRadian / parts;
|
|
2653
2654
|
const partRadian4Sin = sin$4(partRadian / 4);
|
|
2654
2655
|
const control = 8 / 3 * partRadian4Sin * partRadian4Sin / sin$4(partRadian / 2);
|
|
@@ -3115,7 +3116,7 @@ const {M: M$7, L: L$8, C: C$6, Q: Q$5, Z: Z$6, N: N$4, D: D$5, X: X$4, G: G$4, F
|
|
|
3115
3116
|
|
|
3116
3117
|
const {getMinDistanceFrom: getMinDistanceFrom, getRadianFrom: getRadianFrom} = PointHelper;
|
|
3117
3118
|
|
|
3118
|
-
const {tan: tan, min: min, abs: abs$
|
|
3119
|
+
const {tan: tan, min: min, abs: abs$5} = Math;
|
|
3119
3120
|
|
|
3120
3121
|
const startPoint = {};
|
|
3121
3122
|
|
|
@@ -3173,7 +3174,7 @@ const PathCommandDataHelper = {
|
|
|
3173
3174
|
arcTo(data, x1, y1, x2, y2, radius, lastX, lastY) {
|
|
3174
3175
|
if (!isUndefined(lastX)) {
|
|
3175
3176
|
const d = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2);
|
|
3176
|
-
radius = min(radius, min(d / 2, d / 2 * abs$
|
|
3177
|
+
radius = min(radius, min(d / 2, d / 2 * abs$5(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
|
|
3177
3178
|
}
|
|
3178
3179
|
data.push(U$4, x1, y1, x2, y2, radius);
|
|
3179
3180
|
},
|
|
@@ -3971,7 +3972,7 @@ const I$1 = ImageManager;
|
|
|
3971
3972
|
|
|
3972
3973
|
const {IMAGE: IMAGE, create: create$1} = IncrementId;
|
|
3973
3974
|
|
|
3974
|
-
const {floor: floor$2, max: max$
|
|
3975
|
+
const {floor: floor$2, max: max$2} = Math;
|
|
3975
3976
|
|
|
3976
3977
|
class LeaferImage {
|
|
3977
3978
|
get url() {
|
|
@@ -4060,7 +4061,7 @@ class LeaferImage {
|
|
|
4060
4061
|
}
|
|
4061
4062
|
if (data) return data;
|
|
4062
4063
|
}
|
|
4063
|
-
const canvas = Platform.origin.createCanvas(max$
|
|
4064
|
+
const canvas = Platform.origin.createCanvas(max$2(floor$2(width + (xGap || 0)), 1), max$2(floor$2(height + (yGap || 0)), 1));
|
|
4064
4065
|
const ctx = canvas.getContext("2d");
|
|
4065
4066
|
if (opacity) ctx.globalAlpha = opacity;
|
|
4066
4067
|
ctx.drawImage(this.view, 0, 0, width, height);
|
|
@@ -4104,7 +4105,7 @@ function createDescriptor(key, defaultValue) {
|
|
|
4104
4105
|
return {
|
|
4105
4106
|
get() {
|
|
4106
4107
|
const v = this[privateKey];
|
|
4107
|
-
return
|
|
4108
|
+
return v == null ? defaultValue : v;
|
|
4108
4109
|
},
|
|
4109
4110
|
set(value) {
|
|
4110
4111
|
this[privateKey] = value;
|
|
@@ -4390,21 +4391,21 @@ function defineDataProcessor(target, key, defaultValue) {
|
|
|
4390
4391
|
};
|
|
4391
4392
|
} else if (typeof defaultValue === "function") {
|
|
4392
4393
|
property.get = function() {
|
|
4393
|
-
|
|
4394
|
-
return v
|
|
4394
|
+
const v = this[computedKey];
|
|
4395
|
+
return v == null ? defaultValue(this.__leaf) : v;
|
|
4395
4396
|
};
|
|
4396
4397
|
} else if (isObject(defaultValue)) {
|
|
4397
4398
|
const isEmpty = isEmptyData(defaultValue);
|
|
4398
4399
|
property.get = function() {
|
|
4399
|
-
|
|
4400
|
-
return v
|
|
4400
|
+
const v = this[computedKey];
|
|
4401
|
+
return v == null ? this[computedKey] = isEmpty ? {} : DataHelper.clone(defaultValue) : v;
|
|
4401
4402
|
};
|
|
4402
4403
|
}
|
|
4403
4404
|
const isBox = target.isBranchLeaf;
|
|
4404
4405
|
if (key === "width") {
|
|
4405
4406
|
property.get = function() {
|
|
4406
4407
|
const v = this[computedKey];
|
|
4407
|
-
if (v
|
|
4408
|
+
if (v == null) {
|
|
4408
4409
|
const t = this, naturalWidth = t.__naturalWidth, leaf = t.__leaf;
|
|
4409
4410
|
if (!defaultValue || leaf.pathInputed) return leaf.boxBounds.width;
|
|
4410
4411
|
if (naturalWidth) return t._height && t.__useNaturalRatio ? t._height * naturalWidth / t.__naturalHeight : naturalWidth;
|
|
@@ -4414,7 +4415,7 @@ function defineDataProcessor(target, key, defaultValue) {
|
|
|
4414
4415
|
} else if (key === "height") {
|
|
4415
4416
|
property.get = function() {
|
|
4416
4417
|
const v = this[computedKey];
|
|
4417
|
-
if (v
|
|
4418
|
+
if (v == null) {
|
|
4418
4419
|
const t = this, naturalHeight = t.__naturalHeight, leaf = t.__leaf;
|
|
4419
4420
|
if (!defaultValue || leaf.pathInputed) return leaf.boxBounds.height;
|
|
4420
4421
|
if (naturalHeight) return t._width && t.__useNaturalRatio ? t._width * naturalHeight / t.__naturalWidth : naturalHeight;
|
|
@@ -5174,7 +5175,7 @@ class LeafLayout {
|
|
|
5174
5175
|
}
|
|
5175
5176
|
boxChange() {
|
|
5176
5177
|
this.boxChanged = true;
|
|
5177
|
-
this.localBoxChanged || this.localBoxChange();
|
|
5178
|
+
this.localBoxChanged ? this.boundsChanged || (this.boundsChanged = true) : this.localBoxChange();
|
|
5178
5179
|
this.hitCanvasChanged = true;
|
|
5179
5180
|
}
|
|
5180
5181
|
localBoxChange() {
|
|
@@ -5208,7 +5209,7 @@ class LeafLayout {
|
|
|
5208
5209
|
}
|
|
5209
5210
|
matrixChange() {
|
|
5210
5211
|
this.matrixChanged = true;
|
|
5211
|
-
this.localBoxChanged || this.localBoxChange();
|
|
5212
|
+
this.localBoxChanged ? this.boundsChanged || (this.boundsChanged = true) : this.localBoxChange();
|
|
5212
5213
|
}
|
|
5213
5214
|
surfaceChange() {
|
|
5214
5215
|
this.surfaceChanged = true;
|
|
@@ -6274,10 +6275,10 @@ let Leaf = class Leaf {
|
|
|
6274
6275
|
relative.innerToWorld(world, to, distance);
|
|
6275
6276
|
world = to ? to : world;
|
|
6276
6277
|
}
|
|
6277
|
-
toInnerPoint(this.
|
|
6278
|
+
toInnerPoint(this.scrollWorldTransform, world, to, distance);
|
|
6278
6279
|
}
|
|
6279
6280
|
innerToWorld(inner, to, distance, relative) {
|
|
6280
|
-
toOuterPoint(this.
|
|
6281
|
+
toOuterPoint(this.scrollWorldTransform, inner, to, distance);
|
|
6281
6282
|
if (relative) relative.worldToInner(to ? to : inner, null, distance);
|
|
6282
6283
|
}
|
|
6283
6284
|
getBoxPoint(world, relative, distance, change) {
|
|
@@ -6741,7 +6742,7 @@ class LeafLevelList {
|
|
|
6741
6742
|
}
|
|
6742
6743
|
}
|
|
6743
6744
|
|
|
6744
|
-
const version = "1.9.
|
|
6745
|
+
const version = "1.9.4";
|
|
6745
6746
|
|
|
6746
6747
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6747
6748
|
get allowBackgroundColor() {
|
|
@@ -8940,26 +8941,24 @@ let Box = class Box extends Group {
|
|
|
8940
8941
|
}
|
|
8941
8942
|
__updateStrokeBounds() {}
|
|
8942
8943
|
__updateRenderBounds() {
|
|
8943
|
-
let isOverflow;
|
|
8944
|
+
let isOverflow, isScrollMode;
|
|
8944
8945
|
if (this.children.length) {
|
|
8945
|
-
const data = this.__, layout = this.__layout, {renderBounds: renderBounds, boxBounds: boxBounds} = layout;
|
|
8946
|
+
const data = this.__, layout = this.__layout, {renderBounds: renderBounds, boxBounds: boxBounds} = layout, {overflow: overflow} = data;
|
|
8946
8947
|
const childrenRenderBounds = layout.childrenRenderBounds || (layout.childrenRenderBounds = getBoundsData());
|
|
8947
8948
|
super.__updateRenderBounds(childrenRenderBounds);
|
|
8948
|
-
|
|
8949
|
+
if (isScrollMode = overflow.includes("scroll")) {
|
|
8950
|
+
add(childrenRenderBounds, boxBounds);
|
|
8951
|
+
scroll(childrenRenderBounds, data);
|
|
8952
|
+
}
|
|
8949
8953
|
this.__updateRectRenderBounds();
|
|
8950
8954
|
isOverflow = !includes$1(boxBounds, childrenRenderBounds);
|
|
8951
|
-
if (isOverflow &&
|
|
8955
|
+
if (isOverflow && overflow === "show") add(renderBounds, childrenRenderBounds);
|
|
8952
8956
|
} else this.__updateRectRenderBounds();
|
|
8953
8957
|
DataHelper.stintSet(this, "isOverflow", isOverflow);
|
|
8954
|
-
this.__checkScroll();
|
|
8958
|
+
this.__checkScroll(isScrollMode);
|
|
8955
8959
|
}
|
|
8956
8960
|
__updateRectRenderBounds() {}
|
|
8957
|
-
|
|
8958
|
-
if (this.hasScroller) this.__updateScroll();
|
|
8959
|
-
super.__updateWorldBounds();
|
|
8960
|
-
}
|
|
8961
|
-
__checkScroll() {}
|
|
8962
|
-
__updateScroll() {}
|
|
8961
|
+
__checkScroll(_isScrollMode) {}
|
|
8963
8962
|
__updateRectChange() {}
|
|
8964
8963
|
__updateChange() {
|
|
8965
8964
|
super.__updateChange();
|
|
@@ -11571,7 +11570,7 @@ function ignoreRender(ui, value) {
|
|
|
11571
11570
|
|
|
11572
11571
|
const {get: get$1, scale: scale$2, copy: copy$4} = MatrixHelper;
|
|
11573
11572
|
|
|
11574
|
-
const {floor: floor$1, max: max, abs: abs$
|
|
11573
|
+
const {floor: floor$1, max: max$1, abs: abs$4} = Math;
|
|
11575
11574
|
|
|
11576
11575
|
function createPattern(ui, paint, pixelRatio) {
|
|
11577
11576
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
@@ -11584,8 +11583,8 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
11584
11583
|
const xGap = gap && gap.x * scaleX;
|
|
11585
11584
|
const yGap = gap && gap.y * scaleY;
|
|
11586
11585
|
if (sx) {
|
|
11587
|
-
sx = abs$
|
|
11588
|
-
sy = abs$
|
|
11586
|
+
sx = abs$4(sx);
|
|
11587
|
+
sy = abs$4(sy);
|
|
11589
11588
|
imageMatrix = get$1();
|
|
11590
11589
|
copy$4(imageMatrix, transform);
|
|
11591
11590
|
scale$2(imageMatrix, 1 / sx, 1 / sy);
|
|
@@ -11623,7 +11622,7 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
11623
11622
|
}
|
|
11624
11623
|
if (imageMatrix) {
|
|
11625
11624
|
const canvasWidth = width + (xGap || 0), canvasHeight = height + (yGap || 0);
|
|
11626
|
-
scale$2(imageMatrix, canvasWidth / max(floor$1(canvasWidth), 1), canvasHeight / max(floor$1(canvasHeight), 1));
|
|
11625
|
+
scale$2(imageMatrix, canvasWidth / max$1(floor$1(canvasWidth), 1), canvasHeight / max$1(floor$1(canvasHeight), 1));
|
|
11627
11626
|
}
|
|
11628
11627
|
const canvas = image.getCanvas(width, height, data.opacity, data.filters, xGap, yGap);
|
|
11629
11628
|
const pattern = image.getPattern(canvas, repeat || (Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
|
|
@@ -12647,7 +12646,7 @@ function mergeConfigAttr() {
|
|
|
12647
12646
|
return (target, key) => {
|
|
12648
12647
|
defineKey(target, key, {
|
|
12649
12648
|
get() {
|
|
12650
|
-
const {config: config, element: element, dragPoint: dragPoint, editBox: editBox} = this, mergeConfig = Object.assign({}, config);
|
|
12649
|
+
const {config: config, element: element, dragPoint: dragPoint, editBox: editBox, app: app} = this, mergeConfig = Object.assign({}, config);
|
|
12651
12650
|
if (element && element.editConfig) Object.assign(mergeConfig, element.editConfig);
|
|
12652
12651
|
if (editBox.config) Object.assign(mergeConfig, editBox.config);
|
|
12653
12652
|
if (dragPoint) {
|
|
@@ -12658,13 +12657,14 @@ function mergeConfigAttr() {
|
|
|
12658
12657
|
isNull(mergeConfig.lockRatio) && (mergeConfig.lockRatio = true);
|
|
12659
12658
|
}
|
|
12660
12659
|
}
|
|
12660
|
+
if (isUndefined(mergeConfig.dragLimitAnimate)) mergeConfig.dragLimitAnimate = app && app.config.pointer.dragLimitAnimate;
|
|
12661
12661
|
return this.mergedConfig = mergeConfig;
|
|
12662
12662
|
}
|
|
12663
12663
|
});
|
|
12664
12664
|
};
|
|
12665
12665
|
}
|
|
12666
12666
|
|
|
12667
|
-
const {abs: abs$
|
|
12667
|
+
const {abs: abs$3} = Math;
|
|
12668
12668
|
|
|
12669
12669
|
const {copy: copy$2, scale: scale$1} = MatrixHelper;
|
|
12670
12670
|
|
|
@@ -12707,7 +12707,7 @@ class Stroker extends UI {
|
|
|
12707
12707
|
leaf = list[i];
|
|
12708
12708
|
const {worldTransform: worldTransform, worldRenderBounds: worldRenderBounds} = leaf;
|
|
12709
12709
|
if (worldRenderBounds.width && worldRenderBounds.height && (!bounds || bounds.hit(worldRenderBounds, options.matrix))) {
|
|
12710
|
-
const aScaleX = abs$
|
|
12710
|
+
const aScaleX = abs$3(worldTransform.scaleX), aScaleY = abs$3(worldTransform.scaleY);
|
|
12711
12711
|
copy$2(matrix$1, worldTransform);
|
|
12712
12712
|
matrix$1.half = strokeWidth % 2;
|
|
12713
12713
|
if (aScaleX !== aScaleY) {
|
|
@@ -12721,7 +12721,7 @@ class Stroker extends UI {
|
|
|
12721
12721
|
canvas.setWorld(matrix$1, options.matrix);
|
|
12722
12722
|
canvas.beginPath();
|
|
12723
12723
|
if (leaf.__.__useArrow) leaf.__drawPath(canvas); else leaf.__.__pathForRender ? leaf.__drawRenderPath(canvas) : leaf.__drawPathByBox(canvas);
|
|
12724
|
-
data.strokeWidth = strokeWidth / abs$
|
|
12724
|
+
data.strokeWidth = strokeWidth / abs$3(worldTransform.scaleX);
|
|
12725
12725
|
}
|
|
12726
12726
|
if (stroke) isString(stroke) ? Paint.stroke(stroke, this, canvas) : Paint.strokes(stroke, this, canvas);
|
|
12727
12727
|
if (fill) isString(fill) ? Paint.fill(fill, this, canvas) : Paint.fills(fill, this, canvas);
|
|
@@ -13015,7 +13015,7 @@ const {topLeft: topLeft$1, top: top$1, topRight: topRight$1, right: right$2, bot
|
|
|
13015
13015
|
|
|
13016
13016
|
const {toPoint: toPoint} = AroundHelper;
|
|
13017
13017
|
|
|
13018
|
-
const {within: within$
|
|
13018
|
+
const {within: within$3, sign: sign$1} = MathHelper;
|
|
13019
13019
|
|
|
13020
13020
|
const EditDataHelper = {
|
|
13021
13021
|
getScaleData(target, startBounds, direction, totalMove, lockRatio, around, flipable, scaleMode) {
|
|
@@ -13028,8 +13028,8 @@ const EditDataHelper = {
|
|
|
13028
13028
|
}
|
|
13029
13029
|
const originChangedScaleX = target.scaleX / startBounds.scaleX;
|
|
13030
13030
|
const originChangedScaleY = target.scaleY / startBounds.scaleY;
|
|
13031
|
-
const signX = originChangedScaleX
|
|
13032
|
-
const signY = originChangedScaleY
|
|
13031
|
+
const signX = sign$1(originChangedScaleX);
|
|
13032
|
+
const signY = sign$1(originChangedScaleY);
|
|
13033
13033
|
const changedScaleX = scaleMode ? originChangedScaleX : signX * boxBounds.width / width;
|
|
13034
13034
|
const changedScaleY = scaleMode ? originChangedScaleY : signY * boxBounds.height / height;
|
|
13035
13035
|
totalMove.x *= scaleMode ? originChangedScaleX : signX;
|
|
@@ -13129,14 +13129,14 @@ const EditDataHelper = {
|
|
|
13129
13129
|
}
|
|
13130
13130
|
if (useScaleX && widthRange) {
|
|
13131
13131
|
const nowWidth = boxBounds.width * target.scaleX;
|
|
13132
|
-
scaleX = within$
|
|
13132
|
+
scaleX = within$3(nowWidth * scaleX, widthRange) / nowWidth;
|
|
13133
13133
|
}
|
|
13134
13134
|
if (useScaleY && heightRange) {
|
|
13135
13135
|
const nowHeight = boxBounds.height * target.scaleY;
|
|
13136
|
-
scaleY = within$
|
|
13136
|
+
scaleY = within$3(nowHeight * scaleY, heightRange) / nowHeight;
|
|
13137
13137
|
}
|
|
13138
|
-
if (useScaleX && Math.abs(scaleX * worldBoxBounds.width) < 1) scaleX = (scaleX
|
|
13139
|
-
if (useScaleY && Math.abs(scaleY * worldBoxBounds.height) < 1) scaleY = (scaleY
|
|
13138
|
+
if (useScaleX && Math.abs(scaleX * worldBoxBounds.width) < 1) scaleX = sign$1(scaleX) / worldBoxBounds.width;
|
|
13139
|
+
if (useScaleY && Math.abs(scaleY * worldBoxBounds.height) < 1) scaleY = sign$1(scaleY) / worldBoxBounds.height;
|
|
13140
13140
|
if (lockRatio && scaleX !== scaleY) scaleY = scaleX = Math.min(scaleX, scaleY);
|
|
13141
13141
|
return {
|
|
13142
13142
|
origin: origin,
|
|
@@ -13638,7 +13638,7 @@ class EditBox extends Group {
|
|
|
13638
13638
|
if (pointType && pointType.includes("resize")) ResizeEvent.resizingKeys = editor.leafList.keys;
|
|
13639
13639
|
}
|
|
13640
13640
|
onDragEnd(e) {
|
|
13641
|
-
if (this.moving) this.transformTool.onMove(e);
|
|
13641
|
+
if (this.moving && this.mergeConfig.dragLimitAnimate && this.target.dragBounds) this.transformTool.onMove(e);
|
|
13642
13642
|
this.dragPoint = null;
|
|
13643
13643
|
this.resetDoing();
|
|
13644
13644
|
const {name: name, pointType: pointType} = e.current;
|
|
@@ -14158,9 +14158,8 @@ EditorSkewEvent.SKEW = "editor.skew";
|
|
|
14158
14158
|
|
|
14159
14159
|
class TransformTool {
|
|
14160
14160
|
onMove(e) {
|
|
14161
|
-
const {target: target, mergeConfig: mergeConfig, dragStartData: dragStartData
|
|
14161
|
+
const {target: target, mergeConfig: mergeConfig, dragStartData: dragStartData} = this.editBox;
|
|
14162
14162
|
let move, {dragLimitAnimate: dragLimitAnimate} = mergeConfig;
|
|
14163
|
-
if (isUndefined(dragLimitAnimate)) dragLimitAnimate = app && app.config.pointer.dragLimitAnimate;
|
|
14164
14163
|
const isMoveEnd = e.type === MoveEvent.END || e.type === DragEvent.END;
|
|
14165
14164
|
const axisDrag = isString(target.draggable);
|
|
14166
14165
|
const checkLimitMove = !dragLimitAnimate || isMoveEnd || axisDrag;
|
|
@@ -14507,11 +14506,22 @@ let Editor = class Editor extends Group {
|
|
|
14507
14506
|
updateEditTool() {
|
|
14508
14507
|
this.unloadEditTool();
|
|
14509
14508
|
if (this.editing) {
|
|
14510
|
-
const
|
|
14511
|
-
|
|
14512
|
-
this.
|
|
14513
|
-
|
|
14514
|
-
|
|
14509
|
+
const target = this.element;
|
|
14510
|
+
let name = target.editOuter || "EditTool";
|
|
14511
|
+
const {beforeEditOuter: beforeEditOuter} = this.mergeConfig;
|
|
14512
|
+
if (beforeEditOuter) {
|
|
14513
|
+
const check = beforeEditOuter({
|
|
14514
|
+
target: target,
|
|
14515
|
+
name: name
|
|
14516
|
+
});
|
|
14517
|
+
if (isString(check)) name = check; else if (check === false) return;
|
|
14518
|
+
}
|
|
14519
|
+
if (EditToolCreator.list[name]) {
|
|
14520
|
+
const tool = this.editTool = this.editToolList[name] = this.editToolList[name] || EditToolCreator.get(name, this);
|
|
14521
|
+
this.editBox.load();
|
|
14522
|
+
tool.load();
|
|
14523
|
+
this.update();
|
|
14524
|
+
}
|
|
14515
14525
|
}
|
|
14516
14526
|
}
|
|
14517
14527
|
unloadEditTool() {
|
|
@@ -14604,13 +14614,21 @@ let Editor = class Editor extends Group {
|
|
|
14604
14614
|
if (isString(nameOrSelect)) name = nameOrSelect; else if (!select) select = nameOrSelect;
|
|
14605
14615
|
if (target && select) this.target = target;
|
|
14606
14616
|
if (this.single) {
|
|
14607
|
-
|
|
14608
|
-
|
|
14609
|
-
|
|
14617
|
+
if (!target) target = this.element;
|
|
14618
|
+
if (!name) name = target.editInner;
|
|
14619
|
+
const {beforeEditInner: beforeEditInner} = this.mergeConfig;
|
|
14620
|
+
if (beforeEditInner) {
|
|
14621
|
+
const check = beforeEditInner({
|
|
14622
|
+
target: target,
|
|
14623
|
+
name: name
|
|
14624
|
+
});
|
|
14625
|
+
if (isString(check)) name = check; else if (check === false) return;
|
|
14626
|
+
}
|
|
14627
|
+
if (EditToolCreator.list[name]) {
|
|
14610
14628
|
this.editTool.unload();
|
|
14611
14629
|
this.innerEditing = true;
|
|
14612
14630
|
this.innerEditor = this.editToolList[name] = this.editToolList[name] || EditToolCreator.get(name, this);
|
|
14613
|
-
this.innerEditor.editTarget =
|
|
14631
|
+
this.innerEditor.editTarget = target;
|
|
14614
14632
|
this.emitInnerEvent(InnerEditorEvent.BEFORE_OPEN);
|
|
14615
14633
|
this.innerEditor.load();
|
|
14616
14634
|
this.emitInnerEvent(InnerEditorEvent.OPEN);
|
|
@@ -15550,6 +15568,8 @@ const MultiTouchHelper = {
|
|
|
15550
15568
|
}
|
|
15551
15569
|
};
|
|
15552
15570
|
|
|
15571
|
+
const {abs: abs$2, max: max} = Math, {sign: sign, within: within$2} = MathHelper;
|
|
15572
|
+
|
|
15553
15573
|
const WheelEventHelper = {
|
|
15554
15574
|
getMove(event, config) {
|
|
15555
15575
|
let {moveSpeed: moveSpeed} = config;
|
|
@@ -15558,8 +15578,9 @@ const WheelEventHelper = {
|
|
|
15558
15578
|
deltaX = deltaY;
|
|
15559
15579
|
deltaY = 0;
|
|
15560
15580
|
}
|
|
15561
|
-
|
|
15562
|
-
if (
|
|
15581
|
+
const absX = abs$2(deltaX), absY = abs$2(deltaY);
|
|
15582
|
+
if (absX > 50) deltaX = max(50, absX / 3) * sign(deltaX);
|
|
15583
|
+
if (absY > 50) deltaY = max(50, absY / 3) * sign(deltaY);
|
|
15563
15584
|
return {
|
|
15564
15585
|
x: -deltaX * moveSpeed * 2,
|
|
15565
15586
|
y: -deltaY * moveSpeed * 2
|
|
@@ -15577,11 +15598,9 @@ const WheelEventHelper = {
|
|
|
15577
15598
|
zoom = !event.shiftKey && (event.metaKey || event.ctrlKey);
|
|
15578
15599
|
}
|
|
15579
15600
|
if (zoom) {
|
|
15580
|
-
zoomSpeed =
|
|
15601
|
+
zoomSpeed = within$2(zoomSpeed, 0, 1);
|
|
15581
15602
|
const min = event.deltaY ? config.delta.y : config.delta.x;
|
|
15582
|
-
scale = 1 - delta / (min * 4) * zoomSpeed;
|
|
15583
|
-
if (scale < .5) scale = .5;
|
|
15584
|
-
if (scale >= 1.5) scale = 1.5;
|
|
15603
|
+
scale = within$2(1 - delta / (min * 4) * zoomSpeed, .5, 1.5);
|
|
15585
15604
|
}
|
|
15586
15605
|
return scale;
|
|
15587
15606
|
}
|