@leafer/worker 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/worker.js +294 -144
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +300 -149
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +23 -23
package/dist/worker.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() {
|
|
@@ -7481,7 +7481,7 @@ class Picker {
|
|
|
7481
7481
|
children: [ target ]
|
|
7482
7482
|
} : target);
|
|
7483
7483
|
const {list: list} = this.findList;
|
|
7484
|
-
const leaf = this.getBestMatchLeaf(list, options.bottomList, ignoreHittable);
|
|
7484
|
+
const leaf = this.getBestMatchLeaf(list, options.bottomList, ignoreHittable, !!options.findList);
|
|
7485
7485
|
const path = ignoreHittable ? this.getPath(leaf) : this.getHitablePath(leaf);
|
|
7486
7486
|
this.clear();
|
|
7487
7487
|
return through ? {
|
|
@@ -7496,7 +7496,7 @@ class Picker {
|
|
|
7496
7496
|
hitPoint(hitPoint, hitRadius, options) {
|
|
7497
7497
|
return !!this.getByPoint(hitPoint, hitRadius, options).target;
|
|
7498
7498
|
}
|
|
7499
|
-
getBestMatchLeaf(list, bottomList, ignoreHittable) {
|
|
7499
|
+
getBestMatchLeaf(list, bottomList, ignoreHittable, allowNull) {
|
|
7500
7500
|
const findList = this.findList = new LeafList;
|
|
7501
7501
|
if (list.length) {
|
|
7502
7502
|
let find;
|
|
@@ -7527,15 +7527,27 @@ class Picker {
|
|
|
7527
7527
|
if (findList.length) return findList.list[0];
|
|
7528
7528
|
}
|
|
7529
7529
|
}
|
|
7530
|
+
if (allowNull) return null;
|
|
7530
7531
|
return ignoreHittable ? list[0] : list.find(item => LeafHelper.worldHittable(item));
|
|
7531
7532
|
}
|
|
7532
7533
|
getPath(leaf) {
|
|
7533
|
-
const path = new LeafList;
|
|
7534
|
+
const path = new LeafList, syncList = [], {target: target} = this;
|
|
7534
7535
|
while (leaf) {
|
|
7536
|
+
if (leaf.syncEventer) syncList.push(leaf.syncEventer);
|
|
7535
7537
|
path.add(leaf);
|
|
7536
7538
|
leaf = leaf.parent;
|
|
7539
|
+
if (leaf === target) break;
|
|
7540
|
+
}
|
|
7541
|
+
if (syncList.length) {
|
|
7542
|
+
syncList.forEach(item => {
|
|
7543
|
+
while (item) {
|
|
7544
|
+
if (item.__.hittable) path.add(item);
|
|
7545
|
+
item = item.parent;
|
|
7546
|
+
if (item === target) break;
|
|
7547
|
+
}
|
|
7548
|
+
});
|
|
7537
7549
|
}
|
|
7538
|
-
if (
|
|
7550
|
+
if (target) path.add(target);
|
|
7539
7551
|
return path;
|
|
7540
7552
|
}
|
|
7541
7553
|
getHitablePath(leaf) {
|
|
@@ -8033,12 +8045,12 @@ class ImageData extends RectData {
|
|
|
8033
8045
|
}
|
|
8034
8046
|
__getData() {
|
|
8035
8047
|
const data = super.__getData();
|
|
8036
|
-
delete data.fill;
|
|
8048
|
+
if (data.url) delete data.fill;
|
|
8037
8049
|
return data;
|
|
8038
8050
|
}
|
|
8039
8051
|
__getInputData(names, options) {
|
|
8040
8052
|
const data = super.__getInputData(names, options);
|
|
8041
|
-
delete data.fill;
|
|
8053
|
+
if (data.url) delete data.fill;
|
|
8042
8054
|
return data;
|
|
8043
8055
|
}
|
|
8044
8056
|
}
|
|
@@ -8057,7 +8069,7 @@ class CanvasData extends RectData {
|
|
|
8057
8069
|
}
|
|
8058
8070
|
}
|
|
8059
8071
|
|
|
8060
|
-
const {max: max$
|
|
8072
|
+
const {max: max$4, add: add$1} = FourNumberHelper;
|
|
8061
8073
|
|
|
8062
8074
|
const UIBounds = {
|
|
8063
8075
|
__updateStrokeSpread() {
|
|
@@ -8073,7 +8085,7 @@ const UIBounds = {
|
|
|
8073
8085
|
}
|
|
8074
8086
|
if (data.__useArrow) spread += strokeWidth * 5;
|
|
8075
8087
|
if (box) {
|
|
8076
|
-
spread = max$
|
|
8088
|
+
spread = max$4(spread, box.__layout.strokeSpread = box.__updateStrokeSpread());
|
|
8077
8089
|
boxSpread = Math.max(boxSpread, box.__layout.strokeBoxSpread);
|
|
8078
8090
|
}
|
|
8079
8091
|
this.__layout.strokeBoxSpread = boxSpread;
|
|
@@ -8083,86 +8095,18 @@ const UIBounds = {
|
|
|
8083
8095
|
let spread = 0;
|
|
8084
8096
|
const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__, {strokeSpread: strokeSpread} = this.__layout, box = this.__box;
|
|
8085
8097
|
if (shadow) spread = Effect.getShadowRenderSpread(this, shadow);
|
|
8086
|
-
if (blur) spread = max$
|
|
8098
|
+
if (blur) spread = max$4(spread, blur);
|
|
8087
8099
|
if (filter) spread = add$1(spread, Filter.getSpread(filter));
|
|
8088
8100
|
if (renderSpread) spread = add$1(spread, renderSpread);
|
|
8089
8101
|
if (strokeSpread) spread = add$1(spread, strokeSpread);
|
|
8090
8102
|
let shapeSpread = spread;
|
|
8091
|
-
if (innerShadow) shapeSpread = max$
|
|
8092
|
-
if (backgroundBlur) shapeSpread = max$
|
|
8103
|
+
if (innerShadow) shapeSpread = max$4(shapeSpread, Effect.getInnerShadowSpread(this, innerShadow));
|
|
8104
|
+
if (backgroundBlur) shapeSpread = max$4(shapeSpread, backgroundBlur);
|
|
8093
8105
|
this.__layout.renderShapeSpread = shapeSpread;
|
|
8094
|
-
return box ? max$
|
|
8095
|
-
}
|
|
8096
|
-
};
|
|
8097
|
-
|
|
8098
|
-
const {float: float$1} = MathHelper;
|
|
8099
|
-
|
|
8100
|
-
const tempContent = new Bounds, tempMerge = new Bounds, tempIntersect = new Bounds;
|
|
8101
|
-
|
|
8102
|
-
const DragBoundsHelper = {
|
|
8103
|
-
limitMove(leaf, move) {
|
|
8104
|
-
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
8105
|
-
if (dragBounds) D$2.getValidMove(leaf.__localBoxBounds, D$2.getDragBounds(leaf), dragBoundsType, move, true);
|
|
8106
|
-
D$2.axisMove(leaf, move);
|
|
8107
|
-
},
|
|
8108
|
-
limitScaleOf(leaf, origin, scale) {
|
|
8109
|
-
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
8110
|
-
if (dragBounds) D$2.getValidScaleOf(leaf.__localBoxBounds, D$2.getDragBounds(leaf), dragBoundsType, leaf.getLocalPointByInner(leaf.getInnerPointByBox(origin)), scale, true);
|
|
8111
|
-
},
|
|
8112
|
-
axisMove(leaf, move) {
|
|
8113
|
-
const {draggable: draggable} = leaf;
|
|
8114
|
-
if (draggable === "x") move.y = 0;
|
|
8115
|
-
if (draggable === "y") move.x = 0;
|
|
8116
|
-
},
|
|
8117
|
-
getDragBounds(leaf) {
|
|
8118
|
-
const {dragBounds: dragBounds} = leaf;
|
|
8119
|
-
return dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds;
|
|
8120
|
-
},
|
|
8121
|
-
isInnerMode(content, dragBounds, dragBoundsType, sideType) {
|
|
8122
|
-
return dragBoundsType === "inner" || dragBoundsType === "auto" && content[sideType] > dragBounds[sideType];
|
|
8123
|
-
},
|
|
8124
|
-
getValidMove(content, dragBounds, dragBoundsType, move, change) {
|
|
8125
|
-
const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
|
|
8126
|
-
const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
|
|
8127
|
-
if (!change) move = Object.assign({}, move);
|
|
8128
|
-
if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
8129
|
-
if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
|
|
8130
|
-
} else {
|
|
8131
|
-
if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
|
|
8132
|
-
}
|
|
8133
|
-
if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
8134
|
-
if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
|
|
8135
|
-
} else {
|
|
8136
|
-
if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
|
|
8137
|
-
}
|
|
8138
|
-
move.x = float$1(move.x);
|
|
8139
|
-
move.y = float$1(move.y);
|
|
8140
|
-
return move;
|
|
8141
|
-
},
|
|
8142
|
-
getValidScaleOf(content, dragBounds, dragBoundsType, origin, scale, change) {
|
|
8143
|
-
if (!change) scale = Object.assign({}, scale);
|
|
8144
|
-
let fitScaleX, fitScaleY;
|
|
8145
|
-
tempContent.set(content).scaleOf(origin, scale.x, scale.y).unsign();
|
|
8146
|
-
tempMerge.set(tempContent).add(dragBounds);
|
|
8147
|
-
tempIntersect.set(tempContent).intersect(dragBounds);
|
|
8148
|
-
if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
8149
|
-
fitScaleX = tempMerge.width / tempContent.width;
|
|
8150
|
-
} else {
|
|
8151
|
-
fitScaleX = tempIntersect.width / tempContent.width;
|
|
8152
|
-
}
|
|
8153
|
-
if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
8154
|
-
fitScaleY = tempMerge.height / tempContent.height;
|
|
8155
|
-
} else {
|
|
8156
|
-
fitScaleY = tempIntersect.height / tempContent.height;
|
|
8157
|
-
}
|
|
8158
|
-
scale.x = float$1(tempIntersect.width) ? scale.x * fitScaleX : 1;
|
|
8159
|
-
scale.y = float$1(tempIntersect.height) ? scale.y * fitScaleY : 1;
|
|
8160
|
-
return scale;
|
|
8106
|
+
return box ? max$4(box.__updateRenderSpread(), spread) : spread;
|
|
8161
8107
|
}
|
|
8162
8108
|
};
|
|
8163
8109
|
|
|
8164
|
-
const D$2 = DragBoundsHelper;
|
|
8165
|
-
|
|
8166
8110
|
const {stintSet: stintSet$1} = DataHelper;
|
|
8167
8111
|
|
|
8168
8112
|
const UIRender = {
|
|
@@ -9828,6 +9772,102 @@ class UIEvent extends Event {
|
|
|
9828
9772
|
}
|
|
9829
9773
|
}
|
|
9830
9774
|
|
|
9775
|
+
const {float: float$1, sign: sign$2} = MathHelper, {min: min, max: max$3, abs: abs$7} = Math;
|
|
9776
|
+
|
|
9777
|
+
const tempContent = new Bounds, tempDragBounds = new Bounds;
|
|
9778
|
+
|
|
9779
|
+
const DragBoundsHelper = {
|
|
9780
|
+
limitMove(leaf, move) {
|
|
9781
|
+
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
9782
|
+
if (dragBounds) D$2.getValidMove(leaf.__localBoxBounds, D$2.getDragBounds(leaf), dragBoundsType, move, true);
|
|
9783
|
+
D$2.axisMove(leaf, move);
|
|
9784
|
+
},
|
|
9785
|
+
limitScaleOf(leaf, origin, scale, lockRatio) {
|
|
9786
|
+
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
9787
|
+
if (dragBounds) D$2.getValidScaleOf(leaf.__localBoxBounds, D$2.getDragBounds(leaf), dragBoundsType, leaf.getLocalPointByInner(leaf.getInnerPointByBox(origin)), scale, lockRatio, true);
|
|
9788
|
+
},
|
|
9789
|
+
axisMove(leaf, move) {
|
|
9790
|
+
const {draggable: draggable} = leaf;
|
|
9791
|
+
if (draggable === "x") move.y = 0;
|
|
9792
|
+
if (draggable === "y") move.x = 0;
|
|
9793
|
+
},
|
|
9794
|
+
getDragBounds(leaf) {
|
|
9795
|
+
const {dragBounds: dragBounds} = leaf;
|
|
9796
|
+
return dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds;
|
|
9797
|
+
},
|
|
9798
|
+
isInnerMode(content, dragBounds, dragBoundsType, sideType) {
|
|
9799
|
+
return dragBoundsType === "inner" || dragBoundsType === "auto" && content[sideType] > dragBounds[sideType];
|
|
9800
|
+
},
|
|
9801
|
+
getValidMove(content, dragBounds, dragBoundsType, move, change) {
|
|
9802
|
+
const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
|
|
9803
|
+
const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
|
|
9804
|
+
if (!change) move = Object.assign({}, move);
|
|
9805
|
+
if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
9806
|
+
if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
|
|
9807
|
+
} else {
|
|
9808
|
+
if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
|
|
9809
|
+
}
|
|
9810
|
+
if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
9811
|
+
if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
|
|
9812
|
+
} else {
|
|
9813
|
+
if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
|
|
9814
|
+
}
|
|
9815
|
+
move.x = float$1(move.x);
|
|
9816
|
+
move.y = float$1(move.y);
|
|
9817
|
+
return move;
|
|
9818
|
+
},
|
|
9819
|
+
getValidScaleOf(content, dragBounds, dragBoundsType, origin, scale, lockRatio, change) {
|
|
9820
|
+
if (!change) scale = Object.assign({}, scale);
|
|
9821
|
+
tempDragBounds.set(dragBounds);
|
|
9822
|
+
tempContent.set(content).scaleOf(origin, scale.x, scale.y);
|
|
9823
|
+
const originLeftScale = (origin.x - content.x) / content.width, originRightScale = 1 - originLeftScale;
|
|
9824
|
+
const originTopScale = (origin.y - content.y) / content.height, originBottomScale = 1 - originTopScale;
|
|
9825
|
+
let correctScaleX, correctScaleY, aScale, bScale, aSize, bSize;
|
|
9826
|
+
if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
9827
|
+
correctScaleX = scale.x < 0 ? 1 / scale.x : 1;
|
|
9828
|
+
if (scale.x < 0) tempContent.scaleOf(origin, correctScaleX, 1);
|
|
9829
|
+
aSize = float$1(tempContent.minX - tempDragBounds.minX);
|
|
9830
|
+
bSize = float$1(tempDragBounds.maxX - tempContent.maxX);
|
|
9831
|
+
aScale = originLeftScale && aSize > 0 ? 1 + aSize / (originLeftScale * tempContent.width) : 1;
|
|
9832
|
+
bScale = originRightScale && bSize > 0 ? 1 + bSize / (originRightScale * tempContent.width) : 1;
|
|
9833
|
+
correctScaleX *= max$3(aScale, bScale);
|
|
9834
|
+
} else {
|
|
9835
|
+
if (scale.x < 0) tempContent.unsign();
|
|
9836
|
+
aSize = float$1(tempDragBounds.minX - tempContent.minX);
|
|
9837
|
+
bSize = float$1(tempContent.maxX - tempDragBounds.maxX);
|
|
9838
|
+
aScale = originLeftScale && aSize > 0 ? 1 - aSize / (originLeftScale * tempContent.width) : 1;
|
|
9839
|
+
bScale = originRightScale && bSize > 0 ? 1 - bSize / (originRightScale * tempContent.width) : 1;
|
|
9840
|
+
correctScaleX = min(aScale, bScale);
|
|
9841
|
+
}
|
|
9842
|
+
if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
9843
|
+
correctScaleY = scale.y < 0 ? 1 / scale.y : 1;
|
|
9844
|
+
if (scale.y < 0) tempContent.scaleOf(origin, 1, correctScaleY);
|
|
9845
|
+
aSize = float$1(tempContent.minY - tempDragBounds.minY);
|
|
9846
|
+
bSize = float$1(tempDragBounds.maxY - tempContent.maxY);
|
|
9847
|
+
aScale = originTopScale && aSize > 0 ? 1 + aSize / (originTopScale * tempContent.height) : 1;
|
|
9848
|
+
bScale = originBottomScale && bSize > 0 ? 1 + bSize / (originBottomScale * tempContent.height) : 1;
|
|
9849
|
+
correctScaleY *= max$3(aScale, bScale);
|
|
9850
|
+
if (lockRatio) {
|
|
9851
|
+
aScale = max$3(abs$7(correctScaleX), abs$7(correctScaleY));
|
|
9852
|
+
correctScaleX = sign$2(correctScaleX) * aScale;
|
|
9853
|
+
correctScaleY = sign$2(correctScaleY) * aScale;
|
|
9854
|
+
}
|
|
9855
|
+
} else {
|
|
9856
|
+
if (scale.y < 0) tempContent.unsign();
|
|
9857
|
+
aSize = float$1(tempDragBounds.minY - tempContent.minY);
|
|
9858
|
+
bSize = float$1(tempContent.maxY - tempDragBounds.maxY);
|
|
9859
|
+
aScale = originTopScale && aSize > 0 ? 1 - aSize / (originTopScale * tempContent.height) : 1;
|
|
9860
|
+
bScale = originBottomScale && bSize > 0 ? 1 - bSize / (originBottomScale * tempContent.height) : 1;
|
|
9861
|
+
correctScaleY = min(aScale, bScale);
|
|
9862
|
+
}
|
|
9863
|
+
scale.x *= isFinite(correctScaleX) ? correctScaleX : 1;
|
|
9864
|
+
scale.y *= isFinite(correctScaleY) ? correctScaleY : 1;
|
|
9865
|
+
return scale;
|
|
9866
|
+
}
|
|
9867
|
+
};
|
|
9868
|
+
|
|
9869
|
+
const D$2 = DragBoundsHelper;
|
|
9870
|
+
|
|
9831
9871
|
let PointerEvent = class PointerEvent extends UIEvent {};
|
|
9832
9872
|
|
|
9833
9873
|
PointerEvent.POINTER = "pointer";
|
|
@@ -11372,7 +11412,14 @@ const PaintModule = {
|
|
|
11372
11412
|
|
|
11373
11413
|
let origin$1 = {}, tempMatrix$1 = getMatrixData();
|
|
11374
11414
|
|
|
11375
|
-
const {get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate$2, skew: skewHelper} = MatrixHelper;
|
|
11415
|
+
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;
|
|
11416
|
+
|
|
11417
|
+
function stretchMode(data, box, scaleX, scaleY) {
|
|
11418
|
+
const transform = get$3();
|
|
11419
|
+
translate$1(transform, box.x, box.y);
|
|
11420
|
+
if (scaleX) scaleHelper(transform, scaleX, scaleY);
|
|
11421
|
+
data.transform = transform;
|
|
11422
|
+
}
|
|
11376
11423
|
|
|
11377
11424
|
function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
11378
11425
|
const transform = get$3();
|
|
@@ -11389,8 +11436,11 @@ function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipScaleX, c
|
|
|
11389
11436
|
const transform = get$3();
|
|
11390
11437
|
layout$3(transform, box, x, y, scaleX, scaleY, rotation, skew);
|
|
11391
11438
|
if (clipScaleX) {
|
|
11392
|
-
|
|
11393
|
-
|
|
11439
|
+
if (rotation || skew) {
|
|
11440
|
+
set(tempMatrix$1);
|
|
11441
|
+
scaleOfOuter$1(tempMatrix$1, box, clipScaleX, clipScaleY);
|
|
11442
|
+
multiplyParent(transform, tempMatrix$1);
|
|
11443
|
+
} else scaleOfOuter$1(transform, box, clipScaleX, clipScaleY);
|
|
11394
11444
|
}
|
|
11395
11445
|
data.transform = transform;
|
|
11396
11446
|
}
|
|
@@ -11486,7 +11536,10 @@ function getPatternData(paint, box, image) {
|
|
|
11486
11536
|
if (offset) PointHelper.move(tempImage, offset);
|
|
11487
11537
|
switch (mode) {
|
|
11488
11538
|
case "stretch":
|
|
11489
|
-
if (!sameBox)
|
|
11539
|
+
if (!sameBox) {
|
|
11540
|
+
scaleX = box.width / width, scaleY = box.height / height;
|
|
11541
|
+
stretchMode(data, box, scaleX, scaleY);
|
|
11542
|
+
}
|
|
11490
11543
|
break;
|
|
11491
11544
|
|
|
11492
11545
|
case "normal":
|
|
@@ -11495,7 +11548,7 @@ function getPatternData(paint, box, image) {
|
|
|
11495
11548
|
let clipScaleX, clipScaleY;
|
|
11496
11549
|
if (clipSize) clipScaleX = box.width / clipSize.width, clipScaleY = box.height / clipSize.height;
|
|
11497
11550
|
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY);
|
|
11498
|
-
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX :
|
|
11551
|
+
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX : clipScaleX, scaleY = scaleY ? scaleY * clipScaleY : clipScaleY;
|
|
11499
11552
|
}
|
|
11500
11553
|
break;
|
|
11501
11554
|
|
|
@@ -11512,17 +11565,14 @@ function getPatternData(paint, box, image) {
|
|
|
11512
11565
|
if (scaleX) fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
11513
11566
|
}
|
|
11514
11567
|
if (!data.transform) {
|
|
11515
|
-
if (box.x || box.y)
|
|
11516
|
-
data.transform = get$2();
|
|
11517
|
-
translate(data.transform, box.x, box.y);
|
|
11518
|
-
}
|
|
11568
|
+
if (box.x || box.y) translate(data.transform = get$2(), box.x, box.y);
|
|
11519
11569
|
}
|
|
11520
|
-
|
|
11570
|
+
data.width = width;
|
|
11571
|
+
data.height = height;
|
|
11572
|
+
if (scaleX) {
|
|
11521
11573
|
data.scaleX = scaleX;
|
|
11522
11574
|
data.scaleY = scaleY;
|
|
11523
11575
|
}
|
|
11524
|
-
data.width = width;
|
|
11525
|
-
data.height = height;
|
|
11526
11576
|
if (opacity) data.opacity = opacity;
|
|
11527
11577
|
if (filters) data.filters = filters;
|
|
11528
11578
|
if (repeat) data.repeat = isString(repeat) ? repeat === "x" ? "repeat-x" : "repeat-y" : "repeat";
|
|
@@ -11654,7 +11704,7 @@ function ignoreRender(ui, value) {
|
|
|
11654
11704
|
|
|
11655
11705
|
const {get: get$1, scale: scale$2, copy: copy$4} = MatrixHelper;
|
|
11656
11706
|
|
|
11657
|
-
const {floor: floor$1, ceil: ceil$1, max: max$2, abs: abs$
|
|
11707
|
+
const {floor: floor$1, ceil: ceil$1, max: max$2, abs: abs$6} = Math;
|
|
11658
11708
|
|
|
11659
11709
|
function createPattern(ui, paint, pixelRatio) {
|
|
11660
11710
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
@@ -11665,8 +11715,8 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
11665
11715
|
scaleX *= pixelRatio;
|
|
11666
11716
|
scaleY *= pixelRatio;
|
|
11667
11717
|
if (sx) {
|
|
11668
|
-
sx = abs$
|
|
11669
|
-
sy = abs$
|
|
11718
|
+
sx = abs$6(sx);
|
|
11719
|
+
sy = abs$6(sy);
|
|
11670
11720
|
imageMatrix = get$1();
|
|
11671
11721
|
copy$4(imageMatrix, transform);
|
|
11672
11722
|
scale$2(imageMatrix, 1 / sx, 1 / sy);
|
|
@@ -11808,6 +11858,7 @@ const PaintImageModule = {
|
|
|
11808
11858
|
recycleImage: recycleImage,
|
|
11809
11859
|
createData: createData,
|
|
11810
11860
|
getPatternData: getPatternData,
|
|
11861
|
+
stretchMode: stretchMode,
|
|
11811
11862
|
fillOrFitMode: fillOrFitMode,
|
|
11812
11863
|
clipMode: clipMode,
|
|
11813
11864
|
repeatMode: repeatMode
|
|
@@ -11918,7 +11969,7 @@ const PaintGradientModule = {
|
|
|
11918
11969
|
getTransform: getTransform
|
|
11919
11970
|
};
|
|
11920
11971
|
|
|
11921
|
-
const {copy: copy$3, move: move$6, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max$1} = Math;
|
|
11972
|
+
const {copy: copy$3, move: move$6, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max$1, abs: abs$5} = Math;
|
|
11922
11973
|
|
|
11923
11974
|
const tempBounds = {}, tempMatrix = new Matrix;
|
|
11924
11975
|
|
|
@@ -11962,7 +12013,7 @@ function shadow$1(ui, current, shape) {
|
|
|
11962
12013
|
function getShadowRenderSpread(_ui, shadow) {
|
|
11963
12014
|
let top = 0, right = 0, bottom = 0, left = 0, x, y, spread, blur;
|
|
11964
12015
|
shadow.forEach(item => {
|
|
11965
|
-
x = item.x || 0, y = item.y || 0,
|
|
12016
|
+
x = item.x || 0, y = item.y || 0, blur = (item.blur || 0) * 1.5, spread = abs$5(item.spread || 0);
|
|
11966
12017
|
top = max$1(top, spread + blur - y);
|
|
11967
12018
|
right = max$1(right, spread + blur + x);
|
|
11968
12019
|
bottom = max$1(bottom, spread + blur + y);
|
|
@@ -12738,7 +12789,10 @@ function targetAttr(fn) {
|
|
|
12738
12789
|
t.setDimOthers(false);
|
|
12739
12790
|
t.setBright(false);
|
|
12740
12791
|
if (isArray(value) && value.length > 1 && value[0].locked) value.splice(0, 1);
|
|
12741
|
-
if (t.single)
|
|
12792
|
+
if (t.single) {
|
|
12793
|
+
delete t.element.syncEventer;
|
|
12794
|
+
delete t.element.__world.ignorePixelSnap;
|
|
12795
|
+
}
|
|
12742
12796
|
}
|
|
12743
12797
|
const type = isSelect ? EditorEvent.BEFORE_SELECT : EditorEvent.BEFORE_HOVER;
|
|
12744
12798
|
if (this.hasEvent(type)) this.emitEvent(new EditorEvent(type, {
|
|
@@ -12759,7 +12813,15 @@ function mergeConfigAttr() {
|
|
|
12759
12813
|
defineKey(target, key, {
|
|
12760
12814
|
get() {
|
|
12761
12815
|
const {config: config, element: element, dragPoint: dragPoint, editBox: editBox, app: app} = this, mergeConfig = Object.assign({}, config);
|
|
12762
|
-
if (element && element.editConfig)
|
|
12816
|
+
if (element && element.editConfig) {
|
|
12817
|
+
let {editConfig: editConfig} = element;
|
|
12818
|
+
if (editConfig.hover || editConfig.hoverStyle) {
|
|
12819
|
+
editConfig = Object.assign({}, editConfig);
|
|
12820
|
+
delete editConfig.hover;
|
|
12821
|
+
delete editConfig.hoverStyle;
|
|
12822
|
+
}
|
|
12823
|
+
Object.assign(mergeConfig, editConfig);
|
|
12824
|
+
}
|
|
12763
12825
|
if (editBox.config) Object.assign(mergeConfig, editBox.config);
|
|
12764
12826
|
if (dragPoint) {
|
|
12765
12827
|
if (dragPoint.editConfig) Object.assign(mergeConfig, dragPoint.editConfig);
|
|
@@ -12776,7 +12838,7 @@ function mergeConfigAttr() {
|
|
|
12776
12838
|
};
|
|
12777
12839
|
}
|
|
12778
12840
|
|
|
12779
|
-
const {abs: abs$
|
|
12841
|
+
const {abs: abs$4} = Math;
|
|
12780
12842
|
|
|
12781
12843
|
const {copy: copy$2, scale: scale$1} = MatrixHelper;
|
|
12782
12844
|
|
|
@@ -12819,7 +12881,7 @@ class Stroker extends UI {
|
|
|
12819
12881
|
leaf = list[i];
|
|
12820
12882
|
const {worldTransform: worldTransform, worldRenderBounds: worldRenderBounds} = leaf;
|
|
12821
12883
|
if (worldRenderBounds.width && worldRenderBounds.height && (!bounds || bounds.hit(worldRenderBounds, options.matrix))) {
|
|
12822
|
-
const aScaleX = abs$
|
|
12884
|
+
const aScaleX = abs$4(worldTransform.scaleX), aScaleY = abs$4(worldTransform.scaleY);
|
|
12823
12885
|
copy$2(matrix$1, worldTransform);
|
|
12824
12886
|
matrix$1.half = strokeWidth % 2;
|
|
12825
12887
|
if (aScaleX !== aScaleY) {
|
|
@@ -12833,7 +12895,7 @@ class Stroker extends UI {
|
|
|
12833
12895
|
canvas.setWorld(matrix$1, options.matrix);
|
|
12834
12896
|
canvas.beginPath();
|
|
12835
12897
|
if (leaf.__.__useArrow) leaf.__drawPath(canvas); else leaf.__.__pathForRender ? leaf.__drawRenderPath(canvas) : leaf.__drawPathByBox(canvas);
|
|
12836
|
-
data.strokeWidth = strokeWidth / abs$
|
|
12898
|
+
data.strokeWidth = strokeWidth / abs$4(worldTransform.scaleX);
|
|
12837
12899
|
}
|
|
12838
12900
|
if (stroke) isString(stroke) ? Paint.stroke(stroke, this, canvas) : Paint.strokes(stroke, this, canvas);
|
|
12839
12901
|
if (fill) isString(fill) ? Paint.fill(fill, this, canvas) : Paint.fills(fill, this, canvas);
|
|
@@ -12945,8 +13007,10 @@ class EditSelect extends Group {
|
|
|
12945
13007
|
onHover() {
|
|
12946
13008
|
const {editor: editor} = this;
|
|
12947
13009
|
if (this.running && !this.dragging && !editor.dragging) {
|
|
12948
|
-
const {
|
|
12949
|
-
|
|
13010
|
+
const {hoverTarget: hoverTarget, mergeConfig: mergeConfig} = editor, config = Object.assign({}, mergeConfig);
|
|
13011
|
+
if (hoverTarget && hoverTarget.editConfig) Object.assign(config, hoverTarget.editConfig);
|
|
13012
|
+
const {stroke: stroke, strokeWidth: strokeWidth, hover: hover, hoverStyle: hoverStyle} = config;
|
|
13013
|
+
this.hoverStroker.setTarget(hover ? hoverTarget : null, Object.assign({
|
|
12950
13014
|
stroke: stroke,
|
|
12951
13015
|
strokeWidth: strokeWidth
|
|
12952
13016
|
}, hoverStyle || {}));
|
|
@@ -13126,13 +13190,11 @@ class EditSelect extends Group {
|
|
|
13126
13190
|
|
|
13127
13191
|
const {topLeft: topLeft$1, top: top$1, topRight: topRight$1, right: right$2, bottomRight: bottomRight, bottom: bottom$1, bottomLeft: bottomLeft, left: left$2} = Direction9;
|
|
13128
13192
|
|
|
13129
|
-
const {toPoint: toPoint} = AroundHelper;
|
|
13130
|
-
|
|
13131
|
-
const {within: within$3, sign: sign$1} = MathHelper;
|
|
13193
|
+
const {toPoint: toPoint} = AroundHelper, {within: within$3, sign: sign$1} = MathHelper, {abs: abs$3} = Math;
|
|
13132
13194
|
|
|
13133
13195
|
const EditDataHelper = {
|
|
13134
13196
|
getScaleData(target, startBounds, direction, totalMoveOrScale, lockRatio, around, flipable, scaleMode) {
|
|
13135
|
-
let align, origin = {}, scaleX = 1, scaleY = 1;
|
|
13197
|
+
let align, origin = {}, scaleX = 1, scaleY = 1, lockScale;
|
|
13136
13198
|
const {boxBounds: boxBounds, widthRange: widthRange, heightRange: heightRange, dragBounds: dragBounds, worldBoxBounds: worldBoxBounds} = target;
|
|
13137
13199
|
const {width: width, height: height} = startBounds;
|
|
13138
13200
|
const originChangedScaleX = target.scaleX / startBounds.scaleX;
|
|
@@ -13202,23 +13264,22 @@ const EditDataHelper = {
|
|
|
13202
13264
|
if (lockRatio === "corner" && direction % 2) {
|
|
13203
13265
|
lockRatio = false;
|
|
13204
13266
|
} else {
|
|
13205
|
-
let scale;
|
|
13206
13267
|
switch (direction) {
|
|
13207
13268
|
case top$1:
|
|
13208
13269
|
case bottom$1:
|
|
13209
|
-
|
|
13270
|
+
scaleX = scaleY;
|
|
13210
13271
|
break;
|
|
13211
13272
|
|
|
13212
13273
|
case left$2:
|
|
13213
13274
|
case right$2:
|
|
13214
|
-
|
|
13275
|
+
scaleY = scaleX;
|
|
13215
13276
|
break;
|
|
13216
13277
|
|
|
13217
13278
|
default:
|
|
13218
|
-
|
|
13279
|
+
lockScale = Math.sqrt(abs$3(scaleX * scaleY));
|
|
13280
|
+
scaleX = sign$1(scaleX) * lockScale;
|
|
13281
|
+
scaleY = sign$1(scaleY) * lockScale;
|
|
13219
13282
|
}
|
|
13220
|
-
scaleX = scaleX < 0 ? -scale : scale;
|
|
13221
|
-
scaleY = scaleY < 0 ? -scale : scale;
|
|
13222
13283
|
}
|
|
13223
13284
|
}
|
|
13224
13285
|
}
|
|
@@ -13236,7 +13297,7 @@ const EditDataHelper = {
|
|
|
13236
13297
|
x: scaleX,
|
|
13237
13298
|
y: scaleY
|
|
13238
13299
|
};
|
|
13239
|
-
DragBoundsHelper.limitScaleOf(target, origin, scaleData);
|
|
13300
|
+
DragBoundsHelper.limitScaleOf(target, origin, scaleData, lockRatio);
|
|
13240
13301
|
scaleX = scaleData.x;
|
|
13241
13302
|
scaleY = scaleData.y;
|
|
13242
13303
|
}
|
|
@@ -13248,9 +13309,13 @@ const EditDataHelper = {
|
|
|
13248
13309
|
const nowHeight = boxBounds.height * target.scaleY;
|
|
13249
13310
|
scaleY = within$3(nowHeight * scaleY, heightRange) / nowHeight;
|
|
13250
13311
|
}
|
|
13251
|
-
if (useScaleX &&
|
|
13252
|
-
if (useScaleY &&
|
|
13253
|
-
if (lockRatio && scaleX !== scaleY)
|
|
13312
|
+
if (useScaleX && abs$3(scaleX * worldBoxBounds.width) < 1) scaleX = sign$1(scaleX) / worldBoxBounds.width;
|
|
13313
|
+
if (useScaleY && abs$3(scaleY * worldBoxBounds.height) < 1) scaleY = sign$1(scaleY) / worldBoxBounds.height;
|
|
13314
|
+
if (lockRatio && scaleX !== scaleY) {
|
|
13315
|
+
lockScale = Math.min(abs$3(scaleX), abs$3(scaleY));
|
|
13316
|
+
scaleX = sign$1(scaleX) * lockScale;
|
|
13317
|
+
scaleY = sign$1(scaleY) * lockScale;
|
|
13318
|
+
}
|
|
13254
13319
|
return {
|
|
13255
13320
|
origin: origin,
|
|
13256
13321
|
scaleX: scaleX,
|
|
@@ -13500,7 +13565,7 @@ class EditBox extends Group {
|
|
|
13500
13565
|
return this.scaleX * this.scaleY < 0;
|
|
13501
13566
|
}
|
|
13502
13567
|
get canUse() {
|
|
13503
|
-
return this.visible && this.view.visible;
|
|
13568
|
+
return this.app && this.visible && this.view.visible;
|
|
13504
13569
|
}
|
|
13505
13570
|
get canGesture() {
|
|
13506
13571
|
if (!this.canUse) return false;
|
|
@@ -13581,7 +13646,7 @@ class EditBox extends Group {
|
|
|
13581
13646
|
}
|
|
13582
13647
|
load() {
|
|
13583
13648
|
const {target: target, mergeConfig: mergeConfig, single: single, rect: rect, circle: circle, resizePoints: resizePoints, resizeLines: resizeLines} = this;
|
|
13584
|
-
const {stroke: stroke, strokeWidth: strokeWidth, resizeLine: resizeLine} = mergeConfig;
|
|
13649
|
+
const {stroke: stroke, strokeWidth: strokeWidth, resizeLine: resizeLine, ignorePixelSnap: ignorePixelSnap} = mergeConfig;
|
|
13585
13650
|
const pointsStyle = this.getPointsStyle();
|
|
13586
13651
|
const middlePointsStyle = this.getMiddlePointsStyle();
|
|
13587
13652
|
this.visible = !target.locked;
|
|
@@ -13601,16 +13666,16 @@ class EditBox extends Group {
|
|
|
13601
13666
|
strokeWidth: strokeWidth,
|
|
13602
13667
|
editConfig: editConfig
|
|
13603
13668
|
}, mergeConfig.rect || {}));
|
|
13604
|
-
const
|
|
13605
|
-
rect.hittable = !
|
|
13606
|
-
|
|
13607
|
-
if (syncEventer) {
|
|
13669
|
+
const rectThrough = isNull(mergeConfig.rectThrough) ? single : mergeConfig.rectThrough;
|
|
13670
|
+
rect.hittable = !rectThrough;
|
|
13671
|
+
if (rectThrough) {
|
|
13608
13672
|
target.syncEventer = rect;
|
|
13609
13673
|
this.app.interaction.bottomList = [ {
|
|
13610
13674
|
target: rect,
|
|
13611
13675
|
proxy: target
|
|
13612
13676
|
} ];
|
|
13613
13677
|
}
|
|
13678
|
+
if (single) DataHelper.stintSet(target.__world, "ignorePixelSnap", ignorePixelSnap);
|
|
13614
13679
|
updateMoveCursor(this);
|
|
13615
13680
|
}
|
|
13616
13681
|
update() {
|
|
@@ -16335,6 +16400,69 @@ class HTMLTextData extends ImageData {
|
|
|
16335
16400
|
}
|
|
16336
16401
|
}
|
|
16337
16402
|
|
|
16403
|
+
const unicodeEntities = {
|
|
16404
|
+
lt: "<",
|
|
16405
|
+
gt: ">",
|
|
16406
|
+
amp: "&",
|
|
16407
|
+
quot: '"',
|
|
16408
|
+
apos: "'",
|
|
16409
|
+
nbsp: " ",
|
|
16410
|
+
ensp: " ",
|
|
16411
|
+
emsp: " ",
|
|
16412
|
+
thinsp: " ",
|
|
16413
|
+
ndash: "–",
|
|
16414
|
+
mdash: "—",
|
|
16415
|
+
hellip: "…",
|
|
16416
|
+
middot: "·",
|
|
16417
|
+
bull: "•",
|
|
16418
|
+
laquo: "«",
|
|
16419
|
+
raquo: "»",
|
|
16420
|
+
lsquo: "‘",
|
|
16421
|
+
rsquo: "’",
|
|
16422
|
+
ldquo: "“",
|
|
16423
|
+
rdquo: "”",
|
|
16424
|
+
cent: "¢",
|
|
16425
|
+
pound: "£",
|
|
16426
|
+
yen: "¥",
|
|
16427
|
+
euro: "€",
|
|
16428
|
+
times: "×",
|
|
16429
|
+
divide: "÷",
|
|
16430
|
+
plusmn: "±",
|
|
16431
|
+
minus: "−",
|
|
16432
|
+
frac12: "½",
|
|
16433
|
+
frac14: "¼",
|
|
16434
|
+
frac34: "¾",
|
|
16435
|
+
sup2: "²",
|
|
16436
|
+
sup3: "³",
|
|
16437
|
+
deg: "°",
|
|
16438
|
+
reg: "®",
|
|
16439
|
+
copy: "©",
|
|
16440
|
+
trade: "™",
|
|
16441
|
+
section: "§",
|
|
16442
|
+
para: "¶",
|
|
16443
|
+
dagger: "†",
|
|
16444
|
+
Dagger: "‡",
|
|
16445
|
+
larr: "←",
|
|
16446
|
+
uarr: "↑",
|
|
16447
|
+
rarr: "→",
|
|
16448
|
+
darr: "↓",
|
|
16449
|
+
harr: "↔",
|
|
16450
|
+
alpha: "α",
|
|
16451
|
+
beta: "β",
|
|
16452
|
+
gamma: "γ",
|
|
16453
|
+
delta: "δ",
|
|
16454
|
+
pi: "π",
|
|
16455
|
+
sigma: "σ",
|
|
16456
|
+
omega: "ω",
|
|
16457
|
+
Omega: "Ω",
|
|
16458
|
+
micro: "µ",
|
|
16459
|
+
infinity: "∞",
|
|
16460
|
+
not: "¬",
|
|
16461
|
+
equiv: "≡",
|
|
16462
|
+
le: "≤",
|
|
16463
|
+
ge: "≥"
|
|
16464
|
+
};
|
|
16465
|
+
|
|
16338
16466
|
let HTMLText = class HTMLText extends Image {
|
|
16339
16467
|
get __tag() {
|
|
16340
16468
|
return "HTMLText";
|
|
@@ -16354,7 +16482,7 @@ let HTMLText = class HTMLText extends Image {
|
|
|
16354
16482
|
document.body.appendChild(div);
|
|
16355
16483
|
const {width: width, height: height} = div.getBoundingClientRect();
|
|
16356
16484
|
const realWidth = width + 10;
|
|
16357
|
-
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${realWidth}" height="${height}">\n <foreignObject width="${realWidth}" height="${height}">\n <style>\n * {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n </style>\n <body xmlns="http://www.w3.org/1999/xhtml">\n ${this.text}\n </body>\n </foreignObject>\n </svg>`;
|
|
16485
|
+
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${realWidth}" height="${height}">\n <foreignObject width="${realWidth}" height="${height}">\n <style>\n * {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n </style>\n <body xmlns="http://www.w3.org/1999/xhtml">\n ${this.decodeText(this.text)}\n </body>\n </foreignObject>\n </svg>`;
|
|
16358
16486
|
data.__setImageFill("data:image/svg+xml," + encodeURIComponent(svg));
|
|
16359
16487
|
data.__naturalWidth = realWidth / data.pixelRatio;
|
|
16360
16488
|
data.__naturalHeight = height / data.pixelRatio;
|
|
@@ -16367,6 +16495,29 @@ let HTMLText = class HTMLText extends Image {
|
|
|
16367
16495
|
if (this.textEditing && !options.exporting) return;
|
|
16368
16496
|
super.__draw(canvas, options, originCanvas);
|
|
16369
16497
|
}
|
|
16498
|
+
decodeText(text) {
|
|
16499
|
+
if (!text.includes("&")) return text;
|
|
16500
|
+
let result = "", i = 0, entity, value;
|
|
16501
|
+
while (i < text.length) {
|
|
16502
|
+
if (text[i] === "&") {
|
|
16503
|
+
const semicolonIndex = text.indexOf(";", i + 1);
|
|
16504
|
+
if (semicolonIndex > i + 1) {
|
|
16505
|
+
entity = text.slice(i + 1, semicolonIndex);
|
|
16506
|
+
value = unicodeEntities[entity];
|
|
16507
|
+
if (value !== undefined) {
|
|
16508
|
+
result += value;
|
|
16509
|
+
i = semicolonIndex + 1;
|
|
16510
|
+
continue;
|
|
16511
|
+
}
|
|
16512
|
+
}
|
|
16513
|
+
}
|
|
16514
|
+
result += text[i++];
|
|
16515
|
+
}
|
|
16516
|
+
return result;
|
|
16517
|
+
}
|
|
16518
|
+
static addUnicodeEntity(entity, unicode) {
|
|
16519
|
+
if (isString(entity)) unicodeEntities[entity] = unicode; else Object.assign(unicodeEntities, entity);
|
|
16520
|
+
}
|
|
16370
16521
|
};
|
|
16371
16522
|
|
|
16372
16523
|
__decorate([ dataProcessor(HTMLTextData) ], HTMLText.prototype, "__", void 0);
|