@leafer/miniapp 1.9.9 → 1.9.10
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/miniapp.module.js +213 -148
- package/dist/miniapp.module.min.js +1 -1
- package/dist/miniapp.module.min.js.map +1 -1
- package/package.json +21 -21
package/dist/miniapp.module.js
CHANGED
|
@@ -249,7 +249,7 @@ class LeafData {
|
|
|
249
249
|
|
|
250
250
|
let tempA, tempB, tempTo;
|
|
251
251
|
|
|
252
|
-
const {max: max$
|
|
252
|
+
const {max: max$6} = Math, tempFour = [ 0, 0, 0, 0 ];
|
|
253
253
|
|
|
254
254
|
const FourNumberHelper = {
|
|
255
255
|
zero: [ ...tempFour ],
|
|
@@ -263,7 +263,7 @@ const FourNumberHelper = {
|
|
|
263
263
|
return to;
|
|
264
264
|
},
|
|
265
265
|
setTemp(top, right, bottom, left) {
|
|
266
|
-
return set$
|
|
266
|
+
return set$2(tempFour, top, right, bottom, left);
|
|
267
267
|
},
|
|
268
268
|
toTempAB(a, b, change) {
|
|
269
269
|
tempTo = change ? isNumber(a) ? b : a : [];
|
|
@@ -301,24 +301,24 @@ const FourNumberHelper = {
|
|
|
301
301
|
return data;
|
|
302
302
|
},
|
|
303
303
|
max(t, other, change) {
|
|
304
|
-
if (isNumber(t) && isNumber(other)) return max$
|
|
304
|
+
if (isNumber(t) && isNumber(other)) return max$6(t, other);
|
|
305
305
|
toTempAB(t, other, change);
|
|
306
|
-
return set$
|
|
306
|
+
return set$2(tempTo, max$6(tempA[0], tempB[0]), max$6(tempA[1], tempB[1]), max$6(tempA[2], tempB[2]), max$6(tempA[3], tempB[3]));
|
|
307
307
|
},
|
|
308
308
|
add(t, other, change) {
|
|
309
309
|
if (isNumber(t) && isNumber(other)) return t + other;
|
|
310
310
|
toTempAB(t, other, change);
|
|
311
|
-
return set$
|
|
311
|
+
return set$2(tempTo, tempA[0] + tempB[0], tempA[1] + tempB[1], tempA[2] + tempB[2], tempA[3] + tempB[3]);
|
|
312
312
|
},
|
|
313
313
|
swapAndScale(t, scaleX, scaleY, change) {
|
|
314
314
|
if (isNumber(t)) return scaleX === scaleY ? t * scaleX : [ t * scaleY, t * scaleX ];
|
|
315
315
|
const to = change ? t : [];
|
|
316
316
|
const [top, right, bottom, left] = t.length === 4 ? t : get$5(t);
|
|
317
|
-
return set$
|
|
317
|
+
return set$2(to, bottom * scaleY, left * scaleX, top * scaleY, right * scaleX);
|
|
318
318
|
}
|
|
319
319
|
};
|
|
320
320
|
|
|
321
|
-
const {set: set$
|
|
321
|
+
const {set: set$2, get: get$5, setTemp: setTemp, toTempAB: toTempAB} = FourNumberHelper;
|
|
322
322
|
|
|
323
323
|
const {round: round$6, pow: pow$2, PI: PI$4} = Math;
|
|
324
324
|
|
|
@@ -720,7 +720,7 @@ const M$b = MatrixHelper;
|
|
|
720
720
|
|
|
721
721
|
const {toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$3} = MatrixHelper;
|
|
722
722
|
|
|
723
|
-
const {sin: sin$5, cos: cos$5, abs: abs$
|
|
723
|
+
const {sin: sin$5, cos: cos$5, abs: abs$a, sqrt: sqrt$4, atan2: atan2$2, min: min$2, round: round$5} = Math;
|
|
724
724
|
|
|
725
725
|
const PointHelper = {
|
|
726
726
|
defaultPoint: getPointData(),
|
|
@@ -813,12 +813,12 @@ const PointHelper = {
|
|
|
813
813
|
return getDistanceFrom(t.x, t.y, point.x, point.y);
|
|
814
814
|
},
|
|
815
815
|
getDistanceFrom(x1, y1, x2, y2) {
|
|
816
|
-
const x = abs$
|
|
817
|
-
const y = abs$
|
|
816
|
+
const x = abs$a(x2 - x1);
|
|
817
|
+
const y = abs$a(y2 - y1);
|
|
818
818
|
return sqrt$4(x * x + y * y);
|
|
819
819
|
},
|
|
820
820
|
getMinDistanceFrom(x1, y1, x2, y2, x3, y3) {
|
|
821
|
-
return min$
|
|
821
|
+
return min$2(getDistanceFrom(x1, y1, x2, y2), getDistanceFrom(x2, y2, x3, y3));
|
|
822
822
|
},
|
|
823
823
|
getAngle(t, to) {
|
|
824
824
|
return getAtan2(t, to) / OneRadian;
|
|
@@ -2592,11 +2592,11 @@ const RectHelper = {
|
|
|
2592
2592
|
}
|
|
2593
2593
|
};
|
|
2594
2594
|
|
|
2595
|
-
const {sin: sin$4, cos: cos$4, hypot: hypot, atan2: atan2$1, ceil: ceil$2, abs: abs$
|
|
2595
|
+
const {sin: sin$4, cos: cos$4, hypot: hypot, atan2: atan2$1, ceil: ceil$2, abs: abs$9, PI: PI$3, sqrt: sqrt$3, pow: pow$1} = Math;
|
|
2596
2596
|
|
|
2597
2597
|
const {setPoint: setPoint$4, addPoint: addPoint$2} = TwoPointBoundsHelper;
|
|
2598
2598
|
|
|
2599
|
-
const {set: set, toNumberPoints: toNumberPoints$1} = PointHelper;
|
|
2599
|
+
const {set: set$1, toNumberPoints: toNumberPoints$1} = PointHelper;
|
|
2600
2600
|
|
|
2601
2601
|
const {M: M$a, L: L$a, C: C$8, Q: Q$7, Z: Z$8} = PathCommandMap;
|
|
2602
2602
|
|
|
@@ -2667,14 +2667,14 @@ const BezierHelper = {
|
|
|
2667
2667
|
const lenCB = hypot(CBx, CBy);
|
|
2668
2668
|
let totalRadian = endRadian - startRadian;
|
|
2669
2669
|
if (totalRadian < 0) totalRadian += PI2;
|
|
2670
|
-
if (lenBA < 1e-12 || lenCB < 1e-12 || totalRadian < 1e-12 || abs$
|
|
2670
|
+
if (lenBA < 1e-12 || lenCB < 1e-12 || totalRadian < 1e-12 || abs$9(totalRadian - PI$3) < 1e-12) {
|
|
2671
2671
|
if (data) data.push(L$a, x1, y1);
|
|
2672
2672
|
if (setPointBounds) {
|
|
2673
2673
|
setPoint$4(setPointBounds, fromX, fromY);
|
|
2674
2674
|
addPoint$2(setPointBounds, x1, y1);
|
|
2675
2675
|
}
|
|
2676
|
-
if (setStartPoint) set(setStartPoint, fromX, fromY);
|
|
2677
|
-
if (setEndPoint) set(setEndPoint, x1, y1);
|
|
2676
|
+
if (setStartPoint) set$1(setStartPoint, fromX, fromY);
|
|
2677
|
+
if (setEndPoint) set$1(setEndPoint, x1, y1);
|
|
2678
2678
|
return;
|
|
2679
2679
|
}
|
|
2680
2680
|
const anticlockwise = BAx * CBy - CBx * BAy < 0;
|
|
@@ -2700,7 +2700,7 @@ const BezierHelper = {
|
|
|
2700
2700
|
let totalRadian = endRadian - startRadian;
|
|
2701
2701
|
if (totalRadian < 0) totalRadian += PI2; else if (totalRadian > PI2) totalRadian -= PI2;
|
|
2702
2702
|
if (anticlockwise) totalRadian -= PI2;
|
|
2703
|
-
const parts = ceil$2(abs$
|
|
2703
|
+
const parts = ceil$2(abs$9(totalRadian / PI_2));
|
|
2704
2704
|
const partRadian = totalRadian / parts;
|
|
2705
2705
|
const partRadian4Sin = sin$4(partRadian / 4);
|
|
2706
2706
|
const control = 8 / 3 * partRadian4Sin * partRadian4Sin / sin$4(partRadian / 2);
|
|
@@ -2714,7 +2714,7 @@ const BezierHelper = {
|
|
|
2714
2714
|
let fromX = cx + x, fromY = cy + y;
|
|
2715
2715
|
if (data) data.push(data.length ? L$a : M$a, fromX, fromY);
|
|
2716
2716
|
if (setPointBounds) setPoint$4(setPointBounds, fromX, fromY);
|
|
2717
|
-
if (setStartPoint) set(setStartPoint, fromX, fromY);
|
|
2717
|
+
if (setStartPoint) set$1(setStartPoint, fromX, fromY);
|
|
2718
2718
|
for (let i = 0; i < parts; i++) {
|
|
2719
2719
|
endCos = cos$4(endRadian);
|
|
2720
2720
|
endSin = sin$4(endRadian);
|
|
@@ -2733,7 +2733,7 @@ const BezierHelper = {
|
|
|
2733
2733
|
startRadian = endRadian;
|
|
2734
2734
|
endRadian += partRadian;
|
|
2735
2735
|
}
|
|
2736
|
-
if (setEndPoint) set(setEndPoint, cx + x, cy + y);
|
|
2736
|
+
if (setEndPoint) set$1(setEndPoint, cx + x, cy + y);
|
|
2737
2737
|
},
|
|
2738
2738
|
quadraticCurveTo(data, fromX, fromY, x1, y1, toX, toY) {
|
|
2739
2739
|
data.push(C$8, (fromX + 2 * x1) / 3, (fromY + 2 * y1) / 3, (toX + 2 * x1) / 3, (toY + 2 * y1) / 3, toX, toY);
|
|
@@ -3167,7 +3167,7 @@ const {M: M$8, 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
|
|
|
3167
3167
|
|
|
3168
3168
|
const {getMinDistanceFrom: getMinDistanceFrom, getRadianFrom: getRadianFrom} = PointHelper;
|
|
3169
3169
|
|
|
3170
|
-
const {tan: tan, min: min, abs: abs$
|
|
3170
|
+
const {tan: tan, min: min$1, abs: abs$8} = Math;
|
|
3171
3171
|
|
|
3172
3172
|
const startPoint = {};
|
|
3173
3173
|
|
|
@@ -3225,7 +3225,7 @@ const PathCommandDataHelper = {
|
|
|
3225
3225
|
arcTo(data, x1, y1, x2, y2, radius, lastX, lastY) {
|
|
3226
3226
|
if (!isUndefined(lastX)) {
|
|
3227
3227
|
const d = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2);
|
|
3228
|
-
radius = min(radius, min(d / 2, d / 2 * abs$
|
|
3228
|
+
radius = min$1(radius, min$1(d / 2, d / 2 * abs$8(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
|
|
3229
3229
|
}
|
|
3230
3230
|
data.push(U$4, x1, y1, x2, y2, radius);
|
|
3231
3231
|
},
|
|
@@ -4023,7 +4023,7 @@ const I$1 = ImageManager;
|
|
|
4023
4023
|
|
|
4024
4024
|
const {IMAGE: IMAGE, create: create$1} = IncrementId;
|
|
4025
4025
|
|
|
4026
|
-
const {floor: floor$2, max: max$
|
|
4026
|
+
const {floor: floor$2, max: max$5} = Math;
|
|
4027
4027
|
|
|
4028
4028
|
class LeaferImage {
|
|
4029
4029
|
get url() {
|
|
@@ -4112,7 +4112,7 @@ class LeaferImage {
|
|
|
4112
4112
|
}
|
|
4113
4113
|
if (data) return data;
|
|
4114
4114
|
}
|
|
4115
|
-
const canvas = Platform.origin.createCanvas(max$
|
|
4115
|
+
const canvas = Platform.origin.createCanvas(max$5(floor$2(width + (xGap || 0)), 1), max$5(floor$2(height + (yGap || 0)), 1));
|
|
4116
4116
|
const ctx = canvas.getContext("2d");
|
|
4117
4117
|
if (opacity) ctx.globalAlpha = opacity;
|
|
4118
4118
|
ctx.imageSmoothingEnabled = smooth === false ? false : true;
|
|
@@ -6815,7 +6815,7 @@ class LeafLevelList {
|
|
|
6815
6815
|
}
|
|
6816
6816
|
}
|
|
6817
6817
|
|
|
6818
|
-
const version = "1.9.
|
|
6818
|
+
const version = "1.9.10";
|
|
6819
6819
|
|
|
6820
6820
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6821
6821
|
get allowBackgroundColor() {
|
|
@@ -7634,7 +7634,7 @@ class Picker {
|
|
|
7634
7634
|
children: [ target ]
|
|
7635
7635
|
} : target);
|
|
7636
7636
|
const {list: list} = this.findList;
|
|
7637
|
-
const leaf = this.getBestMatchLeaf(list, options.bottomList, ignoreHittable);
|
|
7637
|
+
const leaf = this.getBestMatchLeaf(list, options.bottomList, ignoreHittable, !!options.findList);
|
|
7638
7638
|
const path = ignoreHittable ? this.getPath(leaf) : this.getHitablePath(leaf);
|
|
7639
7639
|
this.clear();
|
|
7640
7640
|
return through ? {
|
|
@@ -7649,7 +7649,7 @@ class Picker {
|
|
|
7649
7649
|
hitPoint(hitPoint, hitRadius, options) {
|
|
7650
7650
|
return !!this.getByPoint(hitPoint, hitRadius, options).target;
|
|
7651
7651
|
}
|
|
7652
|
-
getBestMatchLeaf(list, bottomList, ignoreHittable) {
|
|
7652
|
+
getBestMatchLeaf(list, bottomList, ignoreHittable, allowNull) {
|
|
7653
7653
|
const findList = this.findList = new LeafList;
|
|
7654
7654
|
if (list.length) {
|
|
7655
7655
|
let find;
|
|
@@ -7680,15 +7680,27 @@ class Picker {
|
|
|
7680
7680
|
if (findList.length) return findList.list[0];
|
|
7681
7681
|
}
|
|
7682
7682
|
}
|
|
7683
|
+
if (allowNull) return null;
|
|
7683
7684
|
return ignoreHittable ? list[0] : list.find(item => LeafHelper.worldHittable(item));
|
|
7684
7685
|
}
|
|
7685
7686
|
getPath(leaf) {
|
|
7686
|
-
const path = new LeafList;
|
|
7687
|
+
const path = new LeafList, syncList = [], {target: target} = this;
|
|
7687
7688
|
while (leaf) {
|
|
7689
|
+
if (leaf.syncEventer) syncList.push(leaf.syncEventer);
|
|
7688
7690
|
path.add(leaf);
|
|
7689
7691
|
leaf = leaf.parent;
|
|
7692
|
+
if (leaf === target) break;
|
|
7693
|
+
}
|
|
7694
|
+
if (syncList.length) {
|
|
7695
|
+
syncList.forEach(item => {
|
|
7696
|
+
while (item) {
|
|
7697
|
+
if (item.__.hittable) path.add(item);
|
|
7698
|
+
item = item.parent;
|
|
7699
|
+
if (item === target) break;
|
|
7700
|
+
}
|
|
7701
|
+
});
|
|
7690
7702
|
}
|
|
7691
|
-
if (
|
|
7703
|
+
if (target) path.add(target);
|
|
7692
7704
|
return path;
|
|
7693
7705
|
}
|
|
7694
7706
|
getHitablePath(leaf) {
|
|
@@ -8186,12 +8198,12 @@ class ImageData extends RectData {
|
|
|
8186
8198
|
}
|
|
8187
8199
|
__getData() {
|
|
8188
8200
|
const data = super.__getData();
|
|
8189
|
-
delete data.fill;
|
|
8201
|
+
if (data.url) delete data.fill;
|
|
8190
8202
|
return data;
|
|
8191
8203
|
}
|
|
8192
8204
|
__getInputData(names, options) {
|
|
8193
8205
|
const data = super.__getInputData(names, options);
|
|
8194
|
-
delete data.fill;
|
|
8206
|
+
if (data.url) delete data.fill;
|
|
8195
8207
|
return data;
|
|
8196
8208
|
}
|
|
8197
8209
|
}
|
|
@@ -8210,7 +8222,7 @@ class CanvasData extends RectData {
|
|
|
8210
8222
|
}
|
|
8211
8223
|
}
|
|
8212
8224
|
|
|
8213
|
-
const {max: max$
|
|
8225
|
+
const {max: max$4, add: add$1} = FourNumberHelper;
|
|
8214
8226
|
|
|
8215
8227
|
const UIBounds = {
|
|
8216
8228
|
__updateStrokeSpread() {
|
|
@@ -8226,7 +8238,7 @@ const UIBounds = {
|
|
|
8226
8238
|
}
|
|
8227
8239
|
if (data.__useArrow) spread += strokeWidth * 5;
|
|
8228
8240
|
if (box) {
|
|
8229
|
-
spread = max$
|
|
8241
|
+
spread = max$4(spread, box.__layout.strokeSpread = box.__updateStrokeSpread());
|
|
8230
8242
|
boxSpread = Math.max(boxSpread, box.__layout.strokeBoxSpread);
|
|
8231
8243
|
}
|
|
8232
8244
|
this.__layout.strokeBoxSpread = boxSpread;
|
|
@@ -8236,86 +8248,18 @@ const UIBounds = {
|
|
|
8236
8248
|
let spread = 0;
|
|
8237
8249
|
const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__, {strokeSpread: strokeSpread} = this.__layout, box = this.__box;
|
|
8238
8250
|
if (shadow) spread = Effect.getShadowRenderSpread(this, shadow);
|
|
8239
|
-
if (blur) spread = max$
|
|
8251
|
+
if (blur) spread = max$4(spread, blur);
|
|
8240
8252
|
if (filter) spread = add$1(spread, Filter.getSpread(filter));
|
|
8241
8253
|
if (renderSpread) spread = add$1(spread, renderSpread);
|
|
8242
8254
|
if (strokeSpread) spread = add$1(spread, strokeSpread);
|
|
8243
8255
|
let shapeSpread = spread;
|
|
8244
|
-
if (innerShadow) shapeSpread = max$
|
|
8245
|
-
if (backgroundBlur) shapeSpread = max$
|
|
8256
|
+
if (innerShadow) shapeSpread = max$4(shapeSpread, Effect.getInnerShadowSpread(this, innerShadow));
|
|
8257
|
+
if (backgroundBlur) shapeSpread = max$4(shapeSpread, backgroundBlur);
|
|
8246
8258
|
this.__layout.renderShapeSpread = shapeSpread;
|
|
8247
|
-
return box ? max$
|
|
8259
|
+
return box ? max$4(box.__updateRenderSpread(), spread) : spread;
|
|
8248
8260
|
}
|
|
8249
8261
|
};
|
|
8250
8262
|
|
|
8251
|
-
const {float: float$1} = MathHelper;
|
|
8252
|
-
|
|
8253
|
-
const tempContent = new Bounds, tempMerge = new Bounds, tempIntersect = new Bounds;
|
|
8254
|
-
|
|
8255
|
-
const DragBoundsHelper = {
|
|
8256
|
-
limitMove(leaf, move) {
|
|
8257
|
-
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
8258
|
-
if (dragBounds) D$2.getValidMove(leaf.__localBoxBounds, D$2.getDragBounds(leaf), dragBoundsType, move, true);
|
|
8259
|
-
D$2.axisMove(leaf, move);
|
|
8260
|
-
},
|
|
8261
|
-
limitScaleOf(leaf, origin, scale) {
|
|
8262
|
-
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
8263
|
-
if (dragBounds) D$2.getValidScaleOf(leaf.__localBoxBounds, D$2.getDragBounds(leaf), dragBoundsType, leaf.getLocalPointByInner(leaf.getInnerPointByBox(origin)), scale, true);
|
|
8264
|
-
},
|
|
8265
|
-
axisMove(leaf, move) {
|
|
8266
|
-
const {draggable: draggable} = leaf;
|
|
8267
|
-
if (draggable === "x") move.y = 0;
|
|
8268
|
-
if (draggable === "y") move.x = 0;
|
|
8269
|
-
},
|
|
8270
|
-
getDragBounds(leaf) {
|
|
8271
|
-
const {dragBounds: dragBounds} = leaf;
|
|
8272
|
-
return dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds;
|
|
8273
|
-
},
|
|
8274
|
-
isInnerMode(content, dragBounds, dragBoundsType, sideType) {
|
|
8275
|
-
return dragBoundsType === "inner" || dragBoundsType === "auto" && content[sideType] > dragBounds[sideType];
|
|
8276
|
-
},
|
|
8277
|
-
getValidMove(content, dragBounds, dragBoundsType, move, change) {
|
|
8278
|
-
const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
|
|
8279
|
-
const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
|
|
8280
|
-
if (!change) move = Object.assign({}, move);
|
|
8281
|
-
if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
8282
|
-
if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
|
|
8283
|
-
} else {
|
|
8284
|
-
if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
|
|
8285
|
-
}
|
|
8286
|
-
if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
8287
|
-
if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
|
|
8288
|
-
} else {
|
|
8289
|
-
if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
|
|
8290
|
-
}
|
|
8291
|
-
move.x = float$1(move.x);
|
|
8292
|
-
move.y = float$1(move.y);
|
|
8293
|
-
return move;
|
|
8294
|
-
},
|
|
8295
|
-
getValidScaleOf(content, dragBounds, dragBoundsType, origin, scale, change) {
|
|
8296
|
-
if (!change) scale = Object.assign({}, scale);
|
|
8297
|
-
let fitScaleX, fitScaleY;
|
|
8298
|
-
tempContent.set(content).scaleOf(origin, scale.x, scale.y).unsign();
|
|
8299
|
-
tempMerge.set(tempContent).add(dragBounds);
|
|
8300
|
-
tempIntersect.set(tempContent).intersect(dragBounds);
|
|
8301
|
-
if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
8302
|
-
fitScaleX = tempMerge.width / tempContent.width;
|
|
8303
|
-
} else {
|
|
8304
|
-
fitScaleX = tempIntersect.width / tempContent.width;
|
|
8305
|
-
}
|
|
8306
|
-
if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
8307
|
-
fitScaleY = tempMerge.height / tempContent.height;
|
|
8308
|
-
} else {
|
|
8309
|
-
fitScaleY = tempIntersect.height / tempContent.height;
|
|
8310
|
-
}
|
|
8311
|
-
scale.x = float$1(tempIntersect.width) ? scale.x * fitScaleX : 1;
|
|
8312
|
-
scale.y = float$1(tempIntersect.height) ? scale.y * fitScaleY : 1;
|
|
8313
|
-
return scale;
|
|
8314
|
-
}
|
|
8315
|
-
};
|
|
8316
|
-
|
|
8317
|
-
const D$2 = DragBoundsHelper;
|
|
8318
|
-
|
|
8319
8263
|
const {stintSet: stintSet$1} = DataHelper;
|
|
8320
8264
|
|
|
8321
8265
|
const UIRender = {
|
|
@@ -9981,6 +9925,102 @@ class UIEvent extends Event {
|
|
|
9981
9925
|
}
|
|
9982
9926
|
}
|
|
9983
9927
|
|
|
9928
|
+
const {float: float$1, sign: sign$2} = MathHelper, {min: min, max: max$3, abs: abs$7} = Math;
|
|
9929
|
+
|
|
9930
|
+
const tempContent = new Bounds, tempDragBounds = new Bounds;
|
|
9931
|
+
|
|
9932
|
+
const DragBoundsHelper = {
|
|
9933
|
+
limitMove(leaf, move) {
|
|
9934
|
+
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
9935
|
+
if (dragBounds) D$2.getValidMove(leaf.__localBoxBounds, D$2.getDragBounds(leaf), dragBoundsType, move, true);
|
|
9936
|
+
D$2.axisMove(leaf, move);
|
|
9937
|
+
},
|
|
9938
|
+
limitScaleOf(leaf, origin, scale, lockRatio) {
|
|
9939
|
+
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
9940
|
+
if (dragBounds) D$2.getValidScaleOf(leaf.__localBoxBounds, D$2.getDragBounds(leaf), dragBoundsType, leaf.getLocalPointByInner(leaf.getInnerPointByBox(origin)), scale, lockRatio, true);
|
|
9941
|
+
},
|
|
9942
|
+
axisMove(leaf, move) {
|
|
9943
|
+
const {draggable: draggable} = leaf;
|
|
9944
|
+
if (draggable === "x") move.y = 0;
|
|
9945
|
+
if (draggable === "y") move.x = 0;
|
|
9946
|
+
},
|
|
9947
|
+
getDragBounds(leaf) {
|
|
9948
|
+
const {dragBounds: dragBounds} = leaf;
|
|
9949
|
+
return dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds;
|
|
9950
|
+
},
|
|
9951
|
+
isInnerMode(content, dragBounds, dragBoundsType, sideType) {
|
|
9952
|
+
return dragBoundsType === "inner" || dragBoundsType === "auto" && content[sideType] > dragBounds[sideType];
|
|
9953
|
+
},
|
|
9954
|
+
getValidMove(content, dragBounds, dragBoundsType, move, change) {
|
|
9955
|
+
const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
|
|
9956
|
+
const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
|
|
9957
|
+
if (!change) move = Object.assign({}, move);
|
|
9958
|
+
if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
9959
|
+
if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
|
|
9960
|
+
} else {
|
|
9961
|
+
if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
|
|
9962
|
+
}
|
|
9963
|
+
if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
9964
|
+
if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
|
|
9965
|
+
} else {
|
|
9966
|
+
if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
|
|
9967
|
+
}
|
|
9968
|
+
move.x = float$1(move.x);
|
|
9969
|
+
move.y = float$1(move.y);
|
|
9970
|
+
return move;
|
|
9971
|
+
},
|
|
9972
|
+
getValidScaleOf(content, dragBounds, dragBoundsType, origin, scale, lockRatio, change) {
|
|
9973
|
+
if (!change) scale = Object.assign({}, scale);
|
|
9974
|
+
tempDragBounds.set(dragBounds);
|
|
9975
|
+
tempContent.set(content).scaleOf(origin, scale.x, scale.y);
|
|
9976
|
+
const originLeftScale = (origin.x - content.x) / content.width, originRightScale = 1 - originLeftScale;
|
|
9977
|
+
const originTopScale = (origin.y - content.y) / content.height, originBottomScale = 1 - originTopScale;
|
|
9978
|
+
let correctScaleX, correctScaleY, aScale, bScale, aSize, bSize;
|
|
9979
|
+
if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
9980
|
+
correctScaleX = scale.x < 0 ? 1 / scale.x : 1;
|
|
9981
|
+
if (scale.x < 0) tempContent.scaleOf(origin, correctScaleX, 1);
|
|
9982
|
+
aSize = float$1(tempContent.minX - tempDragBounds.minX);
|
|
9983
|
+
bSize = float$1(tempDragBounds.maxX - tempContent.maxX);
|
|
9984
|
+
aScale = originLeftScale && aSize > 0 ? 1 + aSize / (originLeftScale * tempContent.width) : 1;
|
|
9985
|
+
bScale = originRightScale && bSize > 0 ? 1 + bSize / (originRightScale * tempContent.width) : 1;
|
|
9986
|
+
correctScaleX *= max$3(aScale, bScale);
|
|
9987
|
+
} else {
|
|
9988
|
+
if (scale.x < 0) tempContent.unsign();
|
|
9989
|
+
aSize = float$1(tempDragBounds.minX - tempContent.minX);
|
|
9990
|
+
bSize = float$1(tempContent.maxX - tempDragBounds.maxX);
|
|
9991
|
+
aScale = originLeftScale && aSize > 0 ? 1 - aSize / (originLeftScale * tempContent.width) : 1;
|
|
9992
|
+
bScale = originRightScale && bSize > 0 ? 1 - bSize / (originRightScale * tempContent.width) : 1;
|
|
9993
|
+
correctScaleX = min(aScale, bScale);
|
|
9994
|
+
}
|
|
9995
|
+
if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
9996
|
+
correctScaleY = scale.y < 0 ? 1 / scale.y : 1;
|
|
9997
|
+
if (scale.y < 0) tempContent.scaleOf(origin, 1, correctScaleY);
|
|
9998
|
+
aSize = float$1(tempContent.minY - tempDragBounds.minY);
|
|
9999
|
+
bSize = float$1(tempDragBounds.maxY - tempContent.maxY);
|
|
10000
|
+
aScale = originTopScale && aSize > 0 ? 1 + aSize / (originTopScale * tempContent.height) : 1;
|
|
10001
|
+
bScale = originBottomScale && bSize > 0 ? 1 + bSize / (originBottomScale * tempContent.height) : 1;
|
|
10002
|
+
correctScaleY *= max$3(aScale, bScale);
|
|
10003
|
+
if (lockRatio) {
|
|
10004
|
+
aScale = max$3(abs$7(correctScaleX), abs$7(correctScaleY));
|
|
10005
|
+
correctScaleX = sign$2(correctScaleX) * aScale;
|
|
10006
|
+
correctScaleY = sign$2(correctScaleY) * aScale;
|
|
10007
|
+
}
|
|
10008
|
+
} else {
|
|
10009
|
+
if (scale.y < 0) tempContent.unsign();
|
|
10010
|
+
aSize = float$1(tempDragBounds.minY - tempContent.minY);
|
|
10011
|
+
bSize = float$1(tempContent.maxY - tempDragBounds.maxY);
|
|
10012
|
+
aScale = originTopScale && aSize > 0 ? 1 - aSize / (originTopScale * tempContent.height) : 1;
|
|
10013
|
+
bScale = originBottomScale && bSize > 0 ? 1 - bSize / (originBottomScale * tempContent.height) : 1;
|
|
10014
|
+
correctScaleY = min(aScale, bScale);
|
|
10015
|
+
}
|
|
10016
|
+
scale.x *= isFinite(correctScaleX) ? correctScaleX : 1;
|
|
10017
|
+
scale.y *= isFinite(correctScaleY) ? correctScaleY : 1;
|
|
10018
|
+
return scale;
|
|
10019
|
+
}
|
|
10020
|
+
};
|
|
10021
|
+
|
|
10022
|
+
const D$2 = DragBoundsHelper;
|
|
10023
|
+
|
|
9984
10024
|
let PointerEvent = class PointerEvent extends UIEvent {};
|
|
9985
10025
|
|
|
9986
10026
|
PointerEvent.POINTER = "pointer";
|
|
@@ -11637,7 +11677,14 @@ const PaintModule = {
|
|
|
11637
11677
|
|
|
11638
11678
|
let origin$1 = {}, tempMatrix$1 = getMatrixData();
|
|
11639
11679
|
|
|
11640
|
-
const {get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate$2, skew: skewHelper} = MatrixHelper;
|
|
11680
|
+
const {get: get$3, set: set, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate$2, skew: skewHelper} = MatrixHelper;
|
|
11681
|
+
|
|
11682
|
+
function stretchMode(data, box, scaleX, scaleY) {
|
|
11683
|
+
const transform = get$3();
|
|
11684
|
+
translate$1(transform, box.x, box.y);
|
|
11685
|
+
if (scaleX) scaleHelper(transform, scaleX, scaleY);
|
|
11686
|
+
data.transform = transform;
|
|
11687
|
+
}
|
|
11641
11688
|
|
|
11642
11689
|
function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
11643
11690
|
const transform = get$3();
|
|
@@ -11654,8 +11701,11 @@ function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipScaleX, c
|
|
|
11654
11701
|
const transform = get$3();
|
|
11655
11702
|
layout$3(transform, box, x, y, scaleX, scaleY, rotation, skew);
|
|
11656
11703
|
if (clipScaleX) {
|
|
11657
|
-
|
|
11658
|
-
|
|
11704
|
+
if (rotation || skew) {
|
|
11705
|
+
set(tempMatrix$1);
|
|
11706
|
+
scaleOfOuter$1(tempMatrix$1, box, clipScaleX, clipScaleY);
|
|
11707
|
+
multiplyParent(transform, tempMatrix$1);
|
|
11708
|
+
} else scaleOfOuter$1(transform, box, clipScaleX, clipScaleY);
|
|
11659
11709
|
}
|
|
11660
11710
|
data.transform = transform;
|
|
11661
11711
|
}
|
|
@@ -11751,7 +11801,10 @@ function getPatternData(paint, box, image) {
|
|
|
11751
11801
|
if (offset) PointHelper.move(tempImage, offset);
|
|
11752
11802
|
switch (mode) {
|
|
11753
11803
|
case "stretch":
|
|
11754
|
-
if (!sameBox)
|
|
11804
|
+
if (!sameBox) {
|
|
11805
|
+
scaleX = box.width / width, scaleY = box.height / height;
|
|
11806
|
+
stretchMode(data, box, scaleX, scaleY);
|
|
11807
|
+
}
|
|
11755
11808
|
break;
|
|
11756
11809
|
|
|
11757
11810
|
case "normal":
|
|
@@ -11760,7 +11813,7 @@ function getPatternData(paint, box, image) {
|
|
|
11760
11813
|
let clipScaleX, clipScaleY;
|
|
11761
11814
|
if (clipSize) clipScaleX = box.width / clipSize.width, clipScaleY = box.height / clipSize.height;
|
|
11762
11815
|
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY);
|
|
11763
|
-
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX :
|
|
11816
|
+
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX : clipScaleX, scaleY = scaleY ? scaleY * clipScaleY : clipScaleY;
|
|
11764
11817
|
}
|
|
11765
11818
|
break;
|
|
11766
11819
|
|
|
@@ -11777,17 +11830,14 @@ function getPatternData(paint, box, image) {
|
|
|
11777
11830
|
if (scaleX) fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
11778
11831
|
}
|
|
11779
11832
|
if (!data.transform) {
|
|
11780
|
-
if (box.x || box.y)
|
|
11781
|
-
data.transform = get$2();
|
|
11782
|
-
translate(data.transform, box.x, box.y);
|
|
11783
|
-
}
|
|
11833
|
+
if (box.x || box.y) translate(data.transform = get$2(), box.x, box.y);
|
|
11784
11834
|
}
|
|
11785
|
-
|
|
11835
|
+
data.width = width;
|
|
11836
|
+
data.height = height;
|
|
11837
|
+
if (scaleX) {
|
|
11786
11838
|
data.scaleX = scaleX;
|
|
11787
11839
|
data.scaleY = scaleY;
|
|
11788
11840
|
}
|
|
11789
|
-
data.width = width;
|
|
11790
|
-
data.height = height;
|
|
11791
11841
|
if (opacity) data.opacity = opacity;
|
|
11792
11842
|
if (filters) data.filters = filters;
|
|
11793
11843
|
if (repeat) data.repeat = isString(repeat) ? repeat === "x" ? "repeat-x" : "repeat-y" : "repeat";
|
|
@@ -11919,7 +11969,7 @@ function ignoreRender(ui, value) {
|
|
|
11919
11969
|
|
|
11920
11970
|
const {get: get$1, scale: scale$2, copy: copy$4} = MatrixHelper;
|
|
11921
11971
|
|
|
11922
|
-
const {floor: floor$1, ceil: ceil$1, max: max$2, abs: abs$
|
|
11972
|
+
const {floor: floor$1, ceil: ceil$1, max: max$2, abs: abs$6} = Math;
|
|
11923
11973
|
|
|
11924
11974
|
function createPattern(ui, paint, pixelRatio) {
|
|
11925
11975
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
@@ -11930,8 +11980,8 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
11930
11980
|
scaleX *= pixelRatio;
|
|
11931
11981
|
scaleY *= pixelRatio;
|
|
11932
11982
|
if (sx) {
|
|
11933
|
-
sx = abs$
|
|
11934
|
-
sy = abs$
|
|
11983
|
+
sx = abs$6(sx);
|
|
11984
|
+
sy = abs$6(sy);
|
|
11935
11985
|
imageMatrix = get$1();
|
|
11936
11986
|
copy$4(imageMatrix, transform);
|
|
11937
11987
|
scale$2(imageMatrix, 1 / sx, 1 / sy);
|
|
@@ -12073,6 +12123,7 @@ const PaintImageModule = {
|
|
|
12073
12123
|
recycleImage: recycleImage,
|
|
12074
12124
|
createData: createData,
|
|
12075
12125
|
getPatternData: getPatternData,
|
|
12126
|
+
stretchMode: stretchMode,
|
|
12076
12127
|
fillOrFitMode: fillOrFitMode,
|
|
12077
12128
|
clipMode: clipMode,
|
|
12078
12129
|
repeatMode: repeatMode
|
|
@@ -12183,7 +12234,7 @@ const PaintGradientModule = {
|
|
|
12183
12234
|
getTransform: getTransform
|
|
12184
12235
|
};
|
|
12185
12236
|
|
|
12186
|
-
const {copy: copy$3, move: move$6, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max$1} = Math;
|
|
12237
|
+
const {copy: copy$3, move: move$6, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max$1, abs: abs$5} = Math;
|
|
12187
12238
|
|
|
12188
12239
|
const tempBounds = {}, tempMatrix = new Matrix;
|
|
12189
12240
|
|
|
@@ -12227,7 +12278,7 @@ function shadow$1(ui, current, shape) {
|
|
|
12227
12278
|
function getShadowRenderSpread(_ui, shadow) {
|
|
12228
12279
|
let top = 0, right = 0, bottom = 0, left = 0, x, y, spread, blur;
|
|
12229
12280
|
shadow.forEach(item => {
|
|
12230
|
-
x = item.x || 0, y = item.y || 0,
|
|
12281
|
+
x = item.x || 0, y = item.y || 0, blur = (item.blur || 0) * 1.5, spread = abs$5(item.spread || 0);
|
|
12231
12282
|
top = max$1(top, spread + blur - y);
|
|
12232
12283
|
right = max$1(right, spread + blur + x);
|
|
12233
12284
|
bottom = max$1(bottom, spread + blur + y);
|
|
@@ -13009,7 +13060,10 @@ function targetAttr(fn) {
|
|
|
13009
13060
|
t.setDimOthers(false);
|
|
13010
13061
|
t.setBright(false);
|
|
13011
13062
|
if (isArray(value) && value.length > 1 && value[0].locked) value.splice(0, 1);
|
|
13012
|
-
if (t.single)
|
|
13063
|
+
if (t.single) {
|
|
13064
|
+
delete t.element.syncEventer;
|
|
13065
|
+
delete t.element.__world.ignorePixelSnap;
|
|
13066
|
+
}
|
|
13013
13067
|
}
|
|
13014
13068
|
const type = isSelect ? EditorEvent.BEFORE_SELECT : EditorEvent.BEFORE_HOVER;
|
|
13015
13069
|
if (this.hasEvent(type)) this.emitEvent(new EditorEvent(type, {
|
|
@@ -13030,7 +13084,15 @@ function mergeConfigAttr() {
|
|
|
13030
13084
|
defineKey(target, key, {
|
|
13031
13085
|
get() {
|
|
13032
13086
|
const {config: config, element: element, dragPoint: dragPoint, editBox: editBox, app: app} = this, mergeConfig = Object.assign({}, config);
|
|
13033
|
-
if (element && element.editConfig)
|
|
13087
|
+
if (element && element.editConfig) {
|
|
13088
|
+
let {editConfig: editConfig} = element;
|
|
13089
|
+
if (editConfig.hover || editConfig.hoverStyle) {
|
|
13090
|
+
editConfig = Object.assign({}, editConfig);
|
|
13091
|
+
delete editConfig.hover;
|
|
13092
|
+
delete editConfig.hoverStyle;
|
|
13093
|
+
}
|
|
13094
|
+
Object.assign(mergeConfig, editConfig);
|
|
13095
|
+
}
|
|
13034
13096
|
if (editBox.config) Object.assign(mergeConfig, editBox.config);
|
|
13035
13097
|
if (dragPoint) {
|
|
13036
13098
|
if (dragPoint.editConfig) Object.assign(mergeConfig, dragPoint.editConfig);
|
|
@@ -13047,7 +13109,7 @@ function mergeConfigAttr() {
|
|
|
13047
13109
|
};
|
|
13048
13110
|
}
|
|
13049
13111
|
|
|
13050
|
-
const {abs: abs$
|
|
13112
|
+
const {abs: abs$4} = Math;
|
|
13051
13113
|
|
|
13052
13114
|
const {copy: copy$2, scale: scale$1} = MatrixHelper;
|
|
13053
13115
|
|
|
@@ -13090,7 +13152,7 @@ class Stroker extends UI {
|
|
|
13090
13152
|
leaf = list[i];
|
|
13091
13153
|
const {worldTransform: worldTransform, worldRenderBounds: worldRenderBounds} = leaf;
|
|
13092
13154
|
if (worldRenderBounds.width && worldRenderBounds.height && (!bounds || bounds.hit(worldRenderBounds, options.matrix))) {
|
|
13093
|
-
const aScaleX = abs$
|
|
13155
|
+
const aScaleX = abs$4(worldTransform.scaleX), aScaleY = abs$4(worldTransform.scaleY);
|
|
13094
13156
|
copy$2(matrix$1, worldTransform);
|
|
13095
13157
|
matrix$1.half = strokeWidth % 2;
|
|
13096
13158
|
if (aScaleX !== aScaleY) {
|
|
@@ -13104,7 +13166,7 @@ class Stroker extends UI {
|
|
|
13104
13166
|
canvas.setWorld(matrix$1, options.matrix);
|
|
13105
13167
|
canvas.beginPath();
|
|
13106
13168
|
if (leaf.__.__useArrow) leaf.__drawPath(canvas); else leaf.__.__pathForRender ? leaf.__drawRenderPath(canvas) : leaf.__drawPathByBox(canvas);
|
|
13107
|
-
data.strokeWidth = strokeWidth / abs$
|
|
13169
|
+
data.strokeWidth = strokeWidth / abs$4(worldTransform.scaleX);
|
|
13108
13170
|
}
|
|
13109
13171
|
if (stroke) isString(stroke) ? Paint.stroke(stroke, this, canvas) : Paint.strokes(stroke, this, canvas);
|
|
13110
13172
|
if (fill) isString(fill) ? Paint.fill(fill, this, canvas) : Paint.fills(fill, this, canvas);
|
|
@@ -13216,8 +13278,10 @@ class EditSelect extends Group {
|
|
|
13216
13278
|
onHover() {
|
|
13217
13279
|
const {editor: editor} = this;
|
|
13218
13280
|
if (this.running && !this.dragging && !editor.dragging) {
|
|
13219
|
-
const {
|
|
13220
|
-
|
|
13281
|
+
const {hoverTarget: hoverTarget, mergeConfig: mergeConfig} = editor, config = Object.assign({}, mergeConfig);
|
|
13282
|
+
if (hoverTarget && hoverTarget.editConfig) Object.assign(config, hoverTarget.editConfig);
|
|
13283
|
+
const {stroke: stroke, strokeWidth: strokeWidth, hover: hover, hoverStyle: hoverStyle} = config;
|
|
13284
|
+
this.hoverStroker.setTarget(hover ? hoverTarget : null, Object.assign({
|
|
13221
13285
|
stroke: stroke,
|
|
13222
13286
|
strokeWidth: strokeWidth
|
|
13223
13287
|
}, hoverStyle || {}));
|
|
@@ -13397,13 +13461,11 @@ class EditSelect extends Group {
|
|
|
13397
13461
|
|
|
13398
13462
|
const {topLeft: topLeft$1, top: top$1, topRight: topRight$1, right: right$2, bottomRight: bottomRight, bottom: bottom$1, bottomLeft: bottomLeft, left: left$2} = Direction9;
|
|
13399
13463
|
|
|
13400
|
-
const {toPoint: toPoint} = AroundHelper;
|
|
13401
|
-
|
|
13402
|
-
const {within: within$3, sign: sign$1} = MathHelper;
|
|
13464
|
+
const {toPoint: toPoint} = AroundHelper, {within: within$3, sign: sign$1} = MathHelper, {abs: abs$3} = Math;
|
|
13403
13465
|
|
|
13404
13466
|
const EditDataHelper = {
|
|
13405
13467
|
getScaleData(target, startBounds, direction, totalMoveOrScale, lockRatio, around, flipable, scaleMode) {
|
|
13406
|
-
let align, origin = {}, scaleX = 1, scaleY = 1;
|
|
13468
|
+
let align, origin = {}, scaleX = 1, scaleY = 1, lockScale;
|
|
13407
13469
|
const {boxBounds: boxBounds, widthRange: widthRange, heightRange: heightRange, dragBounds: dragBounds, worldBoxBounds: worldBoxBounds} = target;
|
|
13408
13470
|
const {width: width, height: height} = startBounds;
|
|
13409
13471
|
const originChangedScaleX = target.scaleX / startBounds.scaleX;
|
|
@@ -13473,23 +13535,22 @@ const EditDataHelper = {
|
|
|
13473
13535
|
if (lockRatio === "corner" && direction % 2) {
|
|
13474
13536
|
lockRatio = false;
|
|
13475
13537
|
} else {
|
|
13476
|
-
let scale;
|
|
13477
13538
|
switch (direction) {
|
|
13478
13539
|
case top$1:
|
|
13479
13540
|
case bottom$1:
|
|
13480
|
-
|
|
13541
|
+
scaleX = scaleY;
|
|
13481
13542
|
break;
|
|
13482
13543
|
|
|
13483
13544
|
case left$2:
|
|
13484
13545
|
case right$2:
|
|
13485
|
-
|
|
13546
|
+
scaleY = scaleX;
|
|
13486
13547
|
break;
|
|
13487
13548
|
|
|
13488
13549
|
default:
|
|
13489
|
-
|
|
13550
|
+
lockScale = Math.sqrt(abs$3(scaleX * scaleY));
|
|
13551
|
+
scaleX = sign$1(scaleX) * lockScale;
|
|
13552
|
+
scaleY = sign$1(scaleY) * lockScale;
|
|
13490
13553
|
}
|
|
13491
|
-
scaleX = scaleX < 0 ? -scale : scale;
|
|
13492
|
-
scaleY = scaleY < 0 ? -scale : scale;
|
|
13493
13554
|
}
|
|
13494
13555
|
}
|
|
13495
13556
|
}
|
|
@@ -13507,7 +13568,7 @@ const EditDataHelper = {
|
|
|
13507
13568
|
x: scaleX,
|
|
13508
13569
|
y: scaleY
|
|
13509
13570
|
};
|
|
13510
|
-
DragBoundsHelper.limitScaleOf(target, origin, scaleData);
|
|
13571
|
+
DragBoundsHelper.limitScaleOf(target, origin, scaleData, lockRatio);
|
|
13511
13572
|
scaleX = scaleData.x;
|
|
13512
13573
|
scaleY = scaleData.y;
|
|
13513
13574
|
}
|
|
@@ -13519,9 +13580,13 @@ const EditDataHelper = {
|
|
|
13519
13580
|
const nowHeight = boxBounds.height * target.scaleY;
|
|
13520
13581
|
scaleY = within$3(nowHeight * scaleY, heightRange) / nowHeight;
|
|
13521
13582
|
}
|
|
13522
|
-
if (useScaleX &&
|
|
13523
|
-
if (useScaleY &&
|
|
13524
|
-
if (lockRatio && scaleX !== scaleY)
|
|
13583
|
+
if (useScaleX && abs$3(scaleX * worldBoxBounds.width) < 1) scaleX = sign$1(scaleX) / worldBoxBounds.width;
|
|
13584
|
+
if (useScaleY && abs$3(scaleY * worldBoxBounds.height) < 1) scaleY = sign$1(scaleY) / worldBoxBounds.height;
|
|
13585
|
+
if (lockRatio && scaleX !== scaleY) {
|
|
13586
|
+
lockScale = Math.min(abs$3(scaleX), abs$3(scaleY));
|
|
13587
|
+
scaleX = sign$1(scaleX) * lockScale;
|
|
13588
|
+
scaleY = sign$1(scaleY) * lockScale;
|
|
13589
|
+
}
|
|
13525
13590
|
return {
|
|
13526
13591
|
origin: origin,
|
|
13527
13592
|
scaleX: scaleX,
|
|
@@ -13771,7 +13836,7 @@ class EditBox extends Group {
|
|
|
13771
13836
|
return this.scaleX * this.scaleY < 0;
|
|
13772
13837
|
}
|
|
13773
13838
|
get canUse() {
|
|
13774
|
-
return this.visible && this.view.visible;
|
|
13839
|
+
return this.app && this.visible && this.view.visible;
|
|
13775
13840
|
}
|
|
13776
13841
|
get canGesture() {
|
|
13777
13842
|
if (!this.canUse) return false;
|
|
@@ -13852,7 +13917,7 @@ class EditBox extends Group {
|
|
|
13852
13917
|
}
|
|
13853
13918
|
load() {
|
|
13854
13919
|
const {target: target, mergeConfig: mergeConfig, single: single, rect: rect, circle: circle, resizePoints: resizePoints, resizeLines: resizeLines} = this;
|
|
13855
|
-
const {stroke: stroke, strokeWidth: strokeWidth, resizeLine: resizeLine} = mergeConfig;
|
|
13920
|
+
const {stroke: stroke, strokeWidth: strokeWidth, resizeLine: resizeLine, ignorePixelSnap: ignorePixelSnap} = mergeConfig;
|
|
13856
13921
|
const pointsStyle = this.getPointsStyle();
|
|
13857
13922
|
const middlePointsStyle = this.getMiddlePointsStyle();
|
|
13858
13923
|
this.visible = !target.locked;
|
|
@@ -13872,16 +13937,16 @@ class EditBox extends Group {
|
|
|
13872
13937
|
strokeWidth: strokeWidth,
|
|
13873
13938
|
editConfig: editConfig
|
|
13874
13939
|
}, mergeConfig.rect || {}));
|
|
13875
|
-
const
|
|
13876
|
-
rect.hittable = !
|
|
13877
|
-
|
|
13878
|
-
if (syncEventer) {
|
|
13940
|
+
const rectThrough = isNull(mergeConfig.rectThrough) ? single : mergeConfig.rectThrough;
|
|
13941
|
+
rect.hittable = !rectThrough;
|
|
13942
|
+
if (rectThrough) {
|
|
13879
13943
|
target.syncEventer = rect;
|
|
13880
13944
|
this.app.interaction.bottomList = [ {
|
|
13881
13945
|
target: rect,
|
|
13882
13946
|
proxy: target
|
|
13883
13947
|
} ];
|
|
13884
13948
|
}
|
|
13949
|
+
if (single) DataHelper.stintSet(target.__world, "ignorePixelSnap", ignorePixelSnap);
|
|
13885
13950
|
updateMoveCursor(this);
|
|
13886
13951
|
}
|
|
13887
13952
|
update() {
|