@leafer/worker 1.9.8 → 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 +299 -148
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +305 -153
- 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.js
CHANGED
|
@@ -230,7 +230,7 @@ var LeaferUI = function(exports) {
|
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
232
|
let tempA, tempB, tempTo;
|
|
233
|
-
const {max: max$
|
|
233
|
+
const {max: max$6} = Math, tempFour = [ 0, 0, 0, 0 ];
|
|
234
234
|
const FourNumberHelper = {
|
|
235
235
|
zero: [ ...tempFour ],
|
|
236
236
|
tempFour: tempFour,
|
|
@@ -243,7 +243,7 @@ var LeaferUI = function(exports) {
|
|
|
243
243
|
return to;
|
|
244
244
|
},
|
|
245
245
|
setTemp(top, right, bottom, left) {
|
|
246
|
-
return set$
|
|
246
|
+
return set$2(tempFour, top, right, bottom, left);
|
|
247
247
|
},
|
|
248
248
|
toTempAB(a, b, change) {
|
|
249
249
|
tempTo = change ? isNumber(a) ? b : a : [];
|
|
@@ -281,23 +281,23 @@ var LeaferUI = function(exports) {
|
|
|
281
281
|
return data;
|
|
282
282
|
},
|
|
283
283
|
max(t, other, change) {
|
|
284
|
-
if (isNumber(t) && isNumber(other)) return max$
|
|
284
|
+
if (isNumber(t) && isNumber(other)) return max$6(t, other);
|
|
285
285
|
toTempAB(t, other, change);
|
|
286
|
-
return set$
|
|
286
|
+
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]));
|
|
287
287
|
},
|
|
288
288
|
add(t, other, change) {
|
|
289
289
|
if (isNumber(t) && isNumber(other)) return t + other;
|
|
290
290
|
toTempAB(t, other, change);
|
|
291
|
-
return set$
|
|
291
|
+
return set$2(tempTo, tempA[0] + tempB[0], tempA[1] + tempB[1], tempA[2] + tempB[2], tempA[3] + tempB[3]);
|
|
292
292
|
},
|
|
293
293
|
swapAndScale(t, scaleX, scaleY, change) {
|
|
294
294
|
if (isNumber(t)) return scaleX === scaleY ? t * scaleX : [ t * scaleY, t * scaleX ];
|
|
295
295
|
const to = change ? t : [];
|
|
296
296
|
const [top, right, bottom, left] = t.length === 4 ? t : get$5(t);
|
|
297
|
-
return set$
|
|
297
|
+
return set$2(to, bottom * scaleY, left * scaleX, top * scaleY, right * scaleX);
|
|
298
298
|
}
|
|
299
299
|
};
|
|
300
|
-
const {set: set$
|
|
300
|
+
const {set: set$2, get: get$5, setTemp: setTemp, toTempAB: toTempAB} = FourNumberHelper;
|
|
301
301
|
const {round: round$6, pow: pow$2, PI: PI$4} = Math;
|
|
302
302
|
const MathHelper = {
|
|
303
303
|
within(value, min, max) {
|
|
@@ -682,7 +682,7 @@ var LeaferUI = function(exports) {
|
|
|
682
682
|
};
|
|
683
683
|
const M$b = MatrixHelper;
|
|
684
684
|
const {toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$3} = MatrixHelper;
|
|
685
|
-
const {sin: sin$5, cos: cos$5, abs: abs$
|
|
685
|
+
const {sin: sin$5, cos: cos$5, abs: abs$a, sqrt: sqrt$4, atan2: atan2$2, min: min$2, round: round$5} = Math;
|
|
686
686
|
const PointHelper = {
|
|
687
687
|
defaultPoint: getPointData(),
|
|
688
688
|
tempPoint: {},
|
|
@@ -774,12 +774,12 @@ var LeaferUI = function(exports) {
|
|
|
774
774
|
return getDistanceFrom(t.x, t.y, point.x, point.y);
|
|
775
775
|
},
|
|
776
776
|
getDistanceFrom(x1, y1, x2, y2) {
|
|
777
|
-
const x = abs$
|
|
778
|
-
const y = abs$
|
|
777
|
+
const x = abs$a(x2 - x1);
|
|
778
|
+
const y = abs$a(y2 - y1);
|
|
779
779
|
return sqrt$4(x * x + y * y);
|
|
780
780
|
},
|
|
781
781
|
getMinDistanceFrom(x1, y1, x2, y2, x3, y3) {
|
|
782
|
-
return min$
|
|
782
|
+
return min$2(getDistanceFrom(x1, y1, x2, y2), getDistanceFrom(x2, y2, x3, y3));
|
|
783
783
|
},
|
|
784
784
|
getAngle(t, to) {
|
|
785
785
|
return getAtan2(t, to) / OneRadian;
|
|
@@ -2417,9 +2417,9 @@ var LeaferUI = function(exports) {
|
|
|
2417
2417
|
data[0] ? drawer.arcTo(x, y, right, y, data[0]) : drawer.lineTo(x, y);
|
|
2418
2418
|
}
|
|
2419
2419
|
};
|
|
2420
|
-
const {sin: sin$4, cos: cos$4, hypot: hypot, atan2: atan2$1, ceil: ceil$2, abs: abs$
|
|
2420
|
+
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;
|
|
2421
2421
|
const {setPoint: setPoint$4, addPoint: addPoint$2} = TwoPointBoundsHelper;
|
|
2422
|
-
const {set: set, toNumberPoints: toNumberPoints$1} = PointHelper;
|
|
2422
|
+
const {set: set$1, toNumberPoints: toNumberPoints$1} = PointHelper;
|
|
2423
2423
|
const {M: M$a, L: L$a, C: C$8, Q: Q$7, Z: Z$8} = PathCommandMap;
|
|
2424
2424
|
const tempPoint$2 = {};
|
|
2425
2425
|
const BezierHelper = {
|
|
@@ -2487,14 +2487,14 @@ var LeaferUI = function(exports) {
|
|
|
2487
2487
|
const lenCB = hypot(CBx, CBy);
|
|
2488
2488
|
let totalRadian = endRadian - startRadian;
|
|
2489
2489
|
if (totalRadian < 0) totalRadian += PI2;
|
|
2490
|
-
if (lenBA < 1e-12 || lenCB < 1e-12 || totalRadian < 1e-12 || abs$
|
|
2490
|
+
if (lenBA < 1e-12 || lenCB < 1e-12 || totalRadian < 1e-12 || abs$9(totalRadian - PI$3) < 1e-12) {
|
|
2491
2491
|
if (data) data.push(L$a, x1, y1);
|
|
2492
2492
|
if (setPointBounds) {
|
|
2493
2493
|
setPoint$4(setPointBounds, fromX, fromY);
|
|
2494
2494
|
addPoint$2(setPointBounds, x1, y1);
|
|
2495
2495
|
}
|
|
2496
|
-
if (setStartPoint) set(setStartPoint, fromX, fromY);
|
|
2497
|
-
if (setEndPoint) set(setEndPoint, x1, y1);
|
|
2496
|
+
if (setStartPoint) set$1(setStartPoint, fromX, fromY);
|
|
2497
|
+
if (setEndPoint) set$1(setEndPoint, x1, y1);
|
|
2498
2498
|
return;
|
|
2499
2499
|
}
|
|
2500
2500
|
const anticlockwise = BAx * CBy - CBx * BAy < 0;
|
|
@@ -2520,7 +2520,7 @@ var LeaferUI = function(exports) {
|
|
|
2520
2520
|
let totalRadian = endRadian - startRadian;
|
|
2521
2521
|
if (totalRadian < 0) totalRadian += PI2; else if (totalRadian > PI2) totalRadian -= PI2;
|
|
2522
2522
|
if (anticlockwise) totalRadian -= PI2;
|
|
2523
|
-
const parts = ceil$2(abs$
|
|
2523
|
+
const parts = ceil$2(abs$9(totalRadian / PI_2));
|
|
2524
2524
|
const partRadian = totalRadian / parts;
|
|
2525
2525
|
const partRadian4Sin = sin$4(partRadian / 4);
|
|
2526
2526
|
const control = 8 / 3 * partRadian4Sin * partRadian4Sin / sin$4(partRadian / 2);
|
|
@@ -2534,7 +2534,7 @@ var LeaferUI = function(exports) {
|
|
|
2534
2534
|
let fromX = cx + x, fromY = cy + y;
|
|
2535
2535
|
if (data) data.push(data.length ? L$a : M$a, fromX, fromY);
|
|
2536
2536
|
if (setPointBounds) setPoint$4(setPointBounds, fromX, fromY);
|
|
2537
|
-
if (setStartPoint) set(setStartPoint, fromX, fromY);
|
|
2537
|
+
if (setStartPoint) set$1(setStartPoint, fromX, fromY);
|
|
2538
2538
|
for (let i = 0; i < parts; i++) {
|
|
2539
2539
|
endCos = cos$4(endRadian);
|
|
2540
2540
|
endSin = sin$4(endRadian);
|
|
@@ -2553,7 +2553,7 @@ var LeaferUI = function(exports) {
|
|
|
2553
2553
|
startRadian = endRadian;
|
|
2554
2554
|
endRadian += partRadian;
|
|
2555
2555
|
}
|
|
2556
|
-
if (setEndPoint) set(setEndPoint, cx + x, cy + y);
|
|
2556
|
+
if (setEndPoint) set$1(setEndPoint, cx + x, cy + y);
|
|
2557
2557
|
},
|
|
2558
2558
|
quadraticCurveTo(data, fromX, fromY, x1, y1, toX, toY) {
|
|
2559
2559
|
data.push(C$8, (fromX + 2 * x1) / 3, (fromY + 2 * y1) / 3, (toX + 2 * x1) / 3, (toY + 2 * y1) / 3, toX, toY);
|
|
@@ -2973,7 +2973,7 @@ var LeaferUI = function(exports) {
|
|
|
2973
2973
|
const {current: current, pushData: pushData, copyData: copyData} = PathConvert;
|
|
2974
2974
|
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: F$5, O: O$5, P: P$4, U: U$4} = PathCommandMap;
|
|
2975
2975
|
const {getMinDistanceFrom: getMinDistanceFrom, getRadianFrom: getRadianFrom} = PointHelper;
|
|
2976
|
-
const {tan: tan, min: min, abs: abs$
|
|
2976
|
+
const {tan: tan, min: min$1, abs: abs$8} = Math;
|
|
2977
2977
|
const startPoint = {};
|
|
2978
2978
|
const PathCommandDataHelper = {
|
|
2979
2979
|
beginPath(data) {
|
|
@@ -3029,7 +3029,7 @@ var LeaferUI = function(exports) {
|
|
|
3029
3029
|
arcTo(data, x1, y1, x2, y2, radius, lastX, lastY) {
|
|
3030
3030
|
if (!isUndefined(lastX)) {
|
|
3031
3031
|
const d = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2);
|
|
3032
|
-
radius = min(radius, min(d / 2, d / 2 * abs$
|
|
3032
|
+
radius = min$1(radius, min$1(d / 2, d / 2 * abs$8(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
|
|
3033
3033
|
}
|
|
3034
3034
|
data.push(U$4, x1, y1, x2, y2, radius);
|
|
3035
3035
|
},
|
|
@@ -3787,7 +3787,7 @@ var LeaferUI = function(exports) {
|
|
|
3787
3787
|
};
|
|
3788
3788
|
const I$1 = ImageManager;
|
|
3789
3789
|
const {IMAGE: IMAGE, create: create$1} = IncrementId;
|
|
3790
|
-
const {floor: floor$2, max: max$
|
|
3790
|
+
const {floor: floor$2, max: max$5} = Math;
|
|
3791
3791
|
class LeaferImage {
|
|
3792
3792
|
get url() {
|
|
3793
3793
|
return this.config.url;
|
|
@@ -3875,7 +3875,7 @@ var LeaferUI = function(exports) {
|
|
|
3875
3875
|
}
|
|
3876
3876
|
if (data) return data;
|
|
3877
3877
|
}
|
|
3878
|
-
const canvas = Platform.origin.createCanvas(max$
|
|
3878
|
+
const canvas = Platform.origin.createCanvas(max$5(floor$2(width + (xGap || 0)), 1), max$5(floor$2(height + (yGap || 0)), 1));
|
|
3879
3879
|
const ctx = canvas.getContext("2d");
|
|
3880
3880
|
if (opacity) ctx.globalAlpha = opacity;
|
|
3881
3881
|
ctx.imageSmoothingEnabled = smooth === false ? false : true;
|
|
@@ -6409,7 +6409,7 @@ var LeaferUI = function(exports) {
|
|
|
6409
6409
|
this.levelMap = null;
|
|
6410
6410
|
}
|
|
6411
6411
|
}
|
|
6412
|
-
const version = "1.9.
|
|
6412
|
+
const version = "1.9.10";
|
|
6413
6413
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6414
6414
|
get allowBackgroundColor() {
|
|
6415
6415
|
return true;
|
|
@@ -7045,7 +7045,7 @@ var LeaferUI = function(exports) {
|
|
|
7045
7045
|
children: [ target ]
|
|
7046
7046
|
} : target);
|
|
7047
7047
|
const {list: list} = this.findList;
|
|
7048
|
-
const leaf = this.getBestMatchLeaf(list, options.bottomList, ignoreHittable);
|
|
7048
|
+
const leaf = this.getBestMatchLeaf(list, options.bottomList, ignoreHittable, !!options.findList);
|
|
7049
7049
|
const path = ignoreHittable ? this.getPath(leaf) : this.getHitablePath(leaf);
|
|
7050
7050
|
this.clear();
|
|
7051
7051
|
return through ? {
|
|
@@ -7060,7 +7060,7 @@ var LeaferUI = function(exports) {
|
|
|
7060
7060
|
hitPoint(hitPoint, hitRadius, options) {
|
|
7061
7061
|
return !!this.getByPoint(hitPoint, hitRadius, options).target;
|
|
7062
7062
|
}
|
|
7063
|
-
getBestMatchLeaf(list, bottomList, ignoreHittable) {
|
|
7063
|
+
getBestMatchLeaf(list, bottomList, ignoreHittable, allowNull) {
|
|
7064
7064
|
const findList = this.findList = new LeafList;
|
|
7065
7065
|
if (list.length) {
|
|
7066
7066
|
let find;
|
|
@@ -7091,15 +7091,27 @@ var LeaferUI = function(exports) {
|
|
|
7091
7091
|
if (findList.length) return findList.list[0];
|
|
7092
7092
|
}
|
|
7093
7093
|
}
|
|
7094
|
+
if (allowNull) return null;
|
|
7094
7095
|
return ignoreHittable ? list[0] : list.find(item => LeafHelper.worldHittable(item));
|
|
7095
7096
|
}
|
|
7096
7097
|
getPath(leaf) {
|
|
7097
|
-
const path = new LeafList;
|
|
7098
|
+
const path = new LeafList, syncList = [], {target: target} = this;
|
|
7098
7099
|
while (leaf) {
|
|
7100
|
+
if (leaf.syncEventer) syncList.push(leaf.syncEventer);
|
|
7099
7101
|
path.add(leaf);
|
|
7100
7102
|
leaf = leaf.parent;
|
|
7103
|
+
if (leaf === target) break;
|
|
7104
|
+
}
|
|
7105
|
+
if (syncList.length) {
|
|
7106
|
+
syncList.forEach(item => {
|
|
7107
|
+
while (item) {
|
|
7108
|
+
if (item.__.hittable) path.add(item);
|
|
7109
|
+
item = item.parent;
|
|
7110
|
+
if (item === target) break;
|
|
7111
|
+
}
|
|
7112
|
+
});
|
|
7101
7113
|
}
|
|
7102
|
-
if (
|
|
7114
|
+
if (target) path.add(target);
|
|
7103
7115
|
return path;
|
|
7104
7116
|
}
|
|
7105
7117
|
getHitablePath(leaf) {
|
|
@@ -7556,12 +7568,12 @@ var LeaferUI = function(exports) {
|
|
|
7556
7568
|
}
|
|
7557
7569
|
__getData() {
|
|
7558
7570
|
const data = super.__getData();
|
|
7559
|
-
delete data.fill;
|
|
7571
|
+
if (data.url) delete data.fill;
|
|
7560
7572
|
return data;
|
|
7561
7573
|
}
|
|
7562
7574
|
__getInputData(names, options) {
|
|
7563
7575
|
const data = super.__getInputData(names, options);
|
|
7564
|
-
delete data.fill;
|
|
7576
|
+
if (data.url) delete data.fill;
|
|
7565
7577
|
return data;
|
|
7566
7578
|
}
|
|
7567
7579
|
}
|
|
@@ -7578,7 +7590,7 @@ var LeaferUI = function(exports) {
|
|
|
7578
7590
|
return data;
|
|
7579
7591
|
}
|
|
7580
7592
|
}
|
|
7581
|
-
const {max: max$
|
|
7593
|
+
const {max: max$4, add: add$1} = FourNumberHelper;
|
|
7582
7594
|
const UIBounds = {
|
|
7583
7595
|
__updateStrokeSpread() {
|
|
7584
7596
|
let spread = 0, boxSpread = 0;
|
|
@@ -7593,7 +7605,7 @@ var LeaferUI = function(exports) {
|
|
|
7593
7605
|
}
|
|
7594
7606
|
if (data.__useArrow) spread += strokeWidth * 5;
|
|
7595
7607
|
if (box) {
|
|
7596
|
-
spread = max$
|
|
7608
|
+
spread = max$4(spread, box.__layout.strokeSpread = box.__updateStrokeSpread());
|
|
7597
7609
|
boxSpread = Math.max(boxSpread, box.__layout.strokeBoxSpread);
|
|
7598
7610
|
}
|
|
7599
7611
|
this.__layout.strokeBoxSpread = boxSpread;
|
|
@@ -7603,81 +7615,17 @@ var LeaferUI = function(exports) {
|
|
|
7603
7615
|
let spread = 0;
|
|
7604
7616
|
const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__, {strokeSpread: strokeSpread} = this.__layout, box = this.__box;
|
|
7605
7617
|
if (shadow) spread = Effect.getShadowRenderSpread(this, shadow);
|
|
7606
|
-
if (blur) spread = max$
|
|
7618
|
+
if (blur) spread = max$4(spread, blur);
|
|
7607
7619
|
if (filter) spread = add$1(spread, Filter.getSpread(filter));
|
|
7608
7620
|
if (renderSpread) spread = add$1(spread, renderSpread);
|
|
7609
7621
|
if (strokeSpread) spread = add$1(spread, strokeSpread);
|
|
7610
7622
|
let shapeSpread = spread;
|
|
7611
|
-
if (innerShadow) shapeSpread = max$
|
|
7612
|
-
if (backgroundBlur) shapeSpread = max$
|
|
7623
|
+
if (innerShadow) shapeSpread = max$4(shapeSpread, Effect.getInnerShadowSpread(this, innerShadow));
|
|
7624
|
+
if (backgroundBlur) shapeSpread = max$4(shapeSpread, backgroundBlur);
|
|
7613
7625
|
this.__layout.renderShapeSpread = shapeSpread;
|
|
7614
|
-
return box ? max$
|
|
7615
|
-
}
|
|
7616
|
-
};
|
|
7617
|
-
const {float: float$1} = MathHelper;
|
|
7618
|
-
const tempContent = new Bounds, tempMerge = new Bounds, tempIntersect = new Bounds;
|
|
7619
|
-
const DragBoundsHelper = {
|
|
7620
|
-
limitMove(leaf, move) {
|
|
7621
|
-
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
7622
|
-
if (dragBounds) D$2.getValidMove(leaf.__localBoxBounds, D$2.getDragBounds(leaf), dragBoundsType, move, true);
|
|
7623
|
-
D$2.axisMove(leaf, move);
|
|
7624
|
-
},
|
|
7625
|
-
limitScaleOf(leaf, origin, scale) {
|
|
7626
|
-
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
7627
|
-
if (dragBounds) D$2.getValidScaleOf(leaf.__localBoxBounds, D$2.getDragBounds(leaf), dragBoundsType, leaf.getLocalPointByInner(leaf.getInnerPointByBox(origin)), scale, true);
|
|
7628
|
-
},
|
|
7629
|
-
axisMove(leaf, move) {
|
|
7630
|
-
const {draggable: draggable} = leaf;
|
|
7631
|
-
if (draggable === "x") move.y = 0;
|
|
7632
|
-
if (draggable === "y") move.x = 0;
|
|
7633
|
-
},
|
|
7634
|
-
getDragBounds(leaf) {
|
|
7635
|
-
const {dragBounds: dragBounds} = leaf;
|
|
7636
|
-
return dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds;
|
|
7637
|
-
},
|
|
7638
|
-
isInnerMode(content, dragBounds, dragBoundsType, sideType) {
|
|
7639
|
-
return dragBoundsType === "inner" || dragBoundsType === "auto" && content[sideType] > dragBounds[sideType];
|
|
7640
|
-
},
|
|
7641
|
-
getValidMove(content, dragBounds, dragBoundsType, move, change) {
|
|
7642
|
-
const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
|
|
7643
|
-
const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
|
|
7644
|
-
if (!change) move = Object.assign({}, move);
|
|
7645
|
-
if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
7646
|
-
if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
|
|
7647
|
-
} else {
|
|
7648
|
-
if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
|
|
7649
|
-
}
|
|
7650
|
-
if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
7651
|
-
if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
|
|
7652
|
-
} else {
|
|
7653
|
-
if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
|
|
7654
|
-
}
|
|
7655
|
-
move.x = float$1(move.x);
|
|
7656
|
-
move.y = float$1(move.y);
|
|
7657
|
-
return move;
|
|
7658
|
-
},
|
|
7659
|
-
getValidScaleOf(content, dragBounds, dragBoundsType, origin, scale, change) {
|
|
7660
|
-
if (!change) scale = Object.assign({}, scale);
|
|
7661
|
-
let fitScaleX, fitScaleY;
|
|
7662
|
-
tempContent.set(content).scaleOf(origin, scale.x, scale.y).unsign();
|
|
7663
|
-
tempMerge.set(tempContent).add(dragBounds);
|
|
7664
|
-
tempIntersect.set(tempContent).intersect(dragBounds);
|
|
7665
|
-
if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
7666
|
-
fitScaleX = tempMerge.width / tempContent.width;
|
|
7667
|
-
} else {
|
|
7668
|
-
fitScaleX = tempIntersect.width / tempContent.width;
|
|
7669
|
-
}
|
|
7670
|
-
if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
7671
|
-
fitScaleY = tempMerge.height / tempContent.height;
|
|
7672
|
-
} else {
|
|
7673
|
-
fitScaleY = tempIntersect.height / tempContent.height;
|
|
7674
|
-
}
|
|
7675
|
-
scale.x = float$1(tempIntersect.width) ? scale.x * fitScaleX : 1;
|
|
7676
|
-
scale.y = float$1(tempIntersect.height) ? scale.y * fitScaleY : 1;
|
|
7677
|
-
return scale;
|
|
7626
|
+
return box ? max$4(box.__updateRenderSpread(), spread) : spread;
|
|
7678
7627
|
}
|
|
7679
7628
|
};
|
|
7680
|
-
const D$2 = DragBoundsHelper;
|
|
7681
7629
|
const {stintSet: stintSet$1} = DataHelper;
|
|
7682
7630
|
const UIRender = {
|
|
7683
7631
|
__updateChange() {
|
|
@@ -9134,6 +9082,98 @@ var LeaferUI = function(exports) {
|
|
|
9134
9082
|
EventCreator.changeName(oldName, newName);
|
|
9135
9083
|
}
|
|
9136
9084
|
}
|
|
9085
|
+
const {float: float$1, sign: sign$2} = MathHelper, {min: min, max: max$3, abs: abs$7} = Math;
|
|
9086
|
+
const tempContent = new Bounds, tempDragBounds = new Bounds;
|
|
9087
|
+
const DragBoundsHelper = {
|
|
9088
|
+
limitMove(leaf, move) {
|
|
9089
|
+
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
9090
|
+
if (dragBounds) D$2.getValidMove(leaf.__localBoxBounds, D$2.getDragBounds(leaf), dragBoundsType, move, true);
|
|
9091
|
+
D$2.axisMove(leaf, move);
|
|
9092
|
+
},
|
|
9093
|
+
limitScaleOf(leaf, origin, scale, lockRatio) {
|
|
9094
|
+
const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
|
|
9095
|
+
if (dragBounds) D$2.getValidScaleOf(leaf.__localBoxBounds, D$2.getDragBounds(leaf), dragBoundsType, leaf.getLocalPointByInner(leaf.getInnerPointByBox(origin)), scale, lockRatio, true);
|
|
9096
|
+
},
|
|
9097
|
+
axisMove(leaf, move) {
|
|
9098
|
+
const {draggable: draggable} = leaf;
|
|
9099
|
+
if (draggable === "x") move.y = 0;
|
|
9100
|
+
if (draggable === "y") move.x = 0;
|
|
9101
|
+
},
|
|
9102
|
+
getDragBounds(leaf) {
|
|
9103
|
+
const {dragBounds: dragBounds} = leaf;
|
|
9104
|
+
return dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds;
|
|
9105
|
+
},
|
|
9106
|
+
isInnerMode(content, dragBounds, dragBoundsType, sideType) {
|
|
9107
|
+
return dragBoundsType === "inner" || dragBoundsType === "auto" && content[sideType] > dragBounds[sideType];
|
|
9108
|
+
},
|
|
9109
|
+
getValidMove(content, dragBounds, dragBoundsType, move, change) {
|
|
9110
|
+
const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
|
|
9111
|
+
const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
|
|
9112
|
+
if (!change) move = Object.assign({}, move);
|
|
9113
|
+
if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
9114
|
+
if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
|
|
9115
|
+
} else {
|
|
9116
|
+
if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
|
|
9117
|
+
}
|
|
9118
|
+
if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
9119
|
+
if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
|
|
9120
|
+
} else {
|
|
9121
|
+
if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
|
|
9122
|
+
}
|
|
9123
|
+
move.x = float$1(move.x);
|
|
9124
|
+
move.y = float$1(move.y);
|
|
9125
|
+
return move;
|
|
9126
|
+
},
|
|
9127
|
+
getValidScaleOf(content, dragBounds, dragBoundsType, origin, scale, lockRatio, change) {
|
|
9128
|
+
if (!change) scale = Object.assign({}, scale);
|
|
9129
|
+
tempDragBounds.set(dragBounds);
|
|
9130
|
+
tempContent.set(content).scaleOf(origin, scale.x, scale.y);
|
|
9131
|
+
const originLeftScale = (origin.x - content.x) / content.width, originRightScale = 1 - originLeftScale;
|
|
9132
|
+
const originTopScale = (origin.y - content.y) / content.height, originBottomScale = 1 - originTopScale;
|
|
9133
|
+
let correctScaleX, correctScaleY, aScale, bScale, aSize, bSize;
|
|
9134
|
+
if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
9135
|
+
correctScaleX = scale.x < 0 ? 1 / scale.x : 1;
|
|
9136
|
+
if (scale.x < 0) tempContent.scaleOf(origin, correctScaleX, 1);
|
|
9137
|
+
aSize = float$1(tempContent.minX - tempDragBounds.minX);
|
|
9138
|
+
bSize = float$1(tempDragBounds.maxX - tempContent.maxX);
|
|
9139
|
+
aScale = originLeftScale && aSize > 0 ? 1 + aSize / (originLeftScale * tempContent.width) : 1;
|
|
9140
|
+
bScale = originRightScale && bSize > 0 ? 1 + bSize / (originRightScale * tempContent.width) : 1;
|
|
9141
|
+
correctScaleX *= max$3(aScale, bScale);
|
|
9142
|
+
} else {
|
|
9143
|
+
if (scale.x < 0) tempContent.unsign();
|
|
9144
|
+
aSize = float$1(tempDragBounds.minX - tempContent.minX);
|
|
9145
|
+
bSize = float$1(tempContent.maxX - tempDragBounds.maxX);
|
|
9146
|
+
aScale = originLeftScale && aSize > 0 ? 1 - aSize / (originLeftScale * tempContent.width) : 1;
|
|
9147
|
+
bScale = originRightScale && bSize > 0 ? 1 - bSize / (originRightScale * tempContent.width) : 1;
|
|
9148
|
+
correctScaleX = min(aScale, bScale);
|
|
9149
|
+
}
|
|
9150
|
+
if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
9151
|
+
correctScaleY = scale.y < 0 ? 1 / scale.y : 1;
|
|
9152
|
+
if (scale.y < 0) tempContent.scaleOf(origin, 1, correctScaleY);
|
|
9153
|
+
aSize = float$1(tempContent.minY - tempDragBounds.minY);
|
|
9154
|
+
bSize = float$1(tempDragBounds.maxY - tempContent.maxY);
|
|
9155
|
+
aScale = originTopScale && aSize > 0 ? 1 + aSize / (originTopScale * tempContent.height) : 1;
|
|
9156
|
+
bScale = originBottomScale && bSize > 0 ? 1 + bSize / (originBottomScale * tempContent.height) : 1;
|
|
9157
|
+
correctScaleY *= max$3(aScale, bScale);
|
|
9158
|
+
if (lockRatio) {
|
|
9159
|
+
aScale = max$3(abs$7(correctScaleX), abs$7(correctScaleY));
|
|
9160
|
+
correctScaleX = sign$2(correctScaleX) * aScale;
|
|
9161
|
+
correctScaleY = sign$2(correctScaleY) * aScale;
|
|
9162
|
+
}
|
|
9163
|
+
} else {
|
|
9164
|
+
if (scale.y < 0) tempContent.unsign();
|
|
9165
|
+
aSize = float$1(tempDragBounds.minY - tempContent.minY);
|
|
9166
|
+
bSize = float$1(tempContent.maxY - tempDragBounds.maxY);
|
|
9167
|
+
aScale = originTopScale && aSize > 0 ? 1 - aSize / (originTopScale * tempContent.height) : 1;
|
|
9168
|
+
bScale = originBottomScale && bSize > 0 ? 1 - bSize / (originBottomScale * tempContent.height) : 1;
|
|
9169
|
+
correctScaleY = min(aScale, bScale);
|
|
9170
|
+
}
|
|
9171
|
+
scale.x *= isFinite(correctScaleX) ? correctScaleX : 1;
|
|
9172
|
+
scale.y *= isFinite(correctScaleY) ? correctScaleY : 1;
|
|
9173
|
+
return scale;
|
|
9174
|
+
}
|
|
9175
|
+
};
|
|
9176
|
+
const D$2 = DragBoundsHelper;
|
|
9137
9177
|
exports.PointerEvent = class PointerEvent extends UIEvent {};
|
|
9138
9178
|
exports.PointerEvent.POINTER = "pointer";
|
|
9139
9179
|
exports.PointerEvent.BEFORE_DOWN = "pointer.before_down";
|
|
@@ -10545,7 +10585,13 @@ var LeaferUI = function(exports) {
|
|
|
10545
10585
|
shape: shape
|
|
10546
10586
|
};
|
|
10547
10587
|
let origin$1 = {}, tempMatrix$1 = getMatrixData();
|
|
10548
|
-
const {get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent: multiplyParent, scale: scaleHelper, rotate: rotate$2, skew: skewHelper} = MatrixHelper;
|
|
10588
|
+
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;
|
|
10589
|
+
function stretchMode(data, box, scaleX, scaleY) {
|
|
10590
|
+
const transform = get$3();
|
|
10591
|
+
translate$1(transform, box.x, box.y);
|
|
10592
|
+
if (scaleX) scaleHelper(transform, scaleX, scaleY);
|
|
10593
|
+
data.transform = transform;
|
|
10594
|
+
}
|
|
10549
10595
|
function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
10550
10596
|
const transform = get$3();
|
|
10551
10597
|
translate$1(transform, box.x + x, box.y + y);
|
|
@@ -10560,8 +10606,11 @@ var LeaferUI = function(exports) {
|
|
|
10560
10606
|
const transform = get$3();
|
|
10561
10607
|
layout$3(transform, box, x, y, scaleX, scaleY, rotation, skew);
|
|
10562
10608
|
if (clipScaleX) {
|
|
10563
|
-
|
|
10564
|
-
|
|
10609
|
+
if (rotation || skew) {
|
|
10610
|
+
set(tempMatrix$1);
|
|
10611
|
+
scaleOfOuter$1(tempMatrix$1, box, clipScaleX, clipScaleY);
|
|
10612
|
+
multiplyParent(transform, tempMatrix$1);
|
|
10613
|
+
} else scaleOfOuter$1(transform, box, clipScaleX, clipScaleY);
|
|
10565
10614
|
}
|
|
10566
10615
|
data.transform = transform;
|
|
10567
10616
|
}
|
|
@@ -10649,7 +10698,10 @@ var LeaferUI = function(exports) {
|
|
|
10649
10698
|
if (offset) PointHelper.move(tempImage, offset);
|
|
10650
10699
|
switch (mode) {
|
|
10651
10700
|
case "stretch":
|
|
10652
|
-
if (!sameBox)
|
|
10701
|
+
if (!sameBox) {
|
|
10702
|
+
scaleX = box.width / width, scaleY = box.height / height;
|
|
10703
|
+
stretchMode(data, box, scaleX, scaleY);
|
|
10704
|
+
}
|
|
10653
10705
|
break;
|
|
10654
10706
|
|
|
10655
10707
|
case "normal":
|
|
@@ -10658,7 +10710,7 @@ var LeaferUI = function(exports) {
|
|
|
10658
10710
|
let clipScaleX, clipScaleY;
|
|
10659
10711
|
if (clipSize) clipScaleX = box.width / clipSize.width, clipScaleY = box.height / clipSize.height;
|
|
10660
10712
|
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, clipScaleX, clipScaleY);
|
|
10661
|
-
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX :
|
|
10713
|
+
if (clipScaleX) scaleX = scaleX ? scaleX * clipScaleX : clipScaleX, scaleY = scaleY ? scaleY * clipScaleY : clipScaleY;
|
|
10662
10714
|
}
|
|
10663
10715
|
break;
|
|
10664
10716
|
|
|
@@ -10675,17 +10727,14 @@ var LeaferUI = function(exports) {
|
|
|
10675
10727
|
if (scaleX) fillOrFitMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
10676
10728
|
}
|
|
10677
10729
|
if (!data.transform) {
|
|
10678
|
-
if (box.x || box.y)
|
|
10679
|
-
data.transform = get$2();
|
|
10680
|
-
translate(data.transform, box.x, box.y);
|
|
10681
|
-
}
|
|
10730
|
+
if (box.x || box.y) translate(data.transform = get$2(), box.x, box.y);
|
|
10682
10731
|
}
|
|
10683
|
-
|
|
10732
|
+
data.width = width;
|
|
10733
|
+
data.height = height;
|
|
10734
|
+
if (scaleX) {
|
|
10684
10735
|
data.scaleX = scaleX;
|
|
10685
10736
|
data.scaleY = scaleY;
|
|
10686
10737
|
}
|
|
10687
|
-
data.width = width;
|
|
10688
|
-
data.height = height;
|
|
10689
10738
|
if (opacity) data.opacity = opacity;
|
|
10690
10739
|
if (filters) data.filters = filters;
|
|
10691
10740
|
if (repeat) data.repeat = isString(repeat) ? repeat === "x" ? "repeat-x" : "repeat-y" : "repeat";
|
|
@@ -10804,7 +10853,7 @@ var LeaferUI = function(exports) {
|
|
|
10804
10853
|
if (leafer && leafer.viewReady) leafer.renderer.ignore = value;
|
|
10805
10854
|
}
|
|
10806
10855
|
const {get: get$1, scale: scale$2, copy: copy$4} = MatrixHelper;
|
|
10807
|
-
const {floor: floor$1, ceil: ceil$1, max: max$2, abs: abs$
|
|
10856
|
+
const {floor: floor$1, ceil: ceil$1, max: max$2, abs: abs$6} = Math;
|
|
10808
10857
|
function createPattern(ui, paint, pixelRatio) {
|
|
10809
10858
|
let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
10810
10859
|
const id = scaleX + "-" + scaleY + "-" + pixelRatio;
|
|
@@ -10814,8 +10863,8 @@ var LeaferUI = function(exports) {
|
|
|
10814
10863
|
scaleX *= pixelRatio;
|
|
10815
10864
|
scaleY *= pixelRatio;
|
|
10816
10865
|
if (sx) {
|
|
10817
|
-
sx = abs$
|
|
10818
|
-
sy = abs$
|
|
10866
|
+
sx = abs$6(sx);
|
|
10867
|
+
sy = abs$6(sy);
|
|
10819
10868
|
imageMatrix = get$1();
|
|
10820
10869
|
copy$4(imageMatrix, transform);
|
|
10821
10870
|
scale$2(imageMatrix, 1 / sx, 1 / sy);
|
|
@@ -10953,6 +11002,7 @@ var LeaferUI = function(exports) {
|
|
|
10953
11002
|
recycleImage: recycleImage,
|
|
10954
11003
|
createData: createData,
|
|
10955
11004
|
getPatternData: getPatternData,
|
|
11005
|
+
stretchMode: stretchMode,
|
|
10956
11006
|
fillOrFitMode: fillOrFitMode,
|
|
10957
11007
|
clipMode: clipMode,
|
|
10958
11008
|
repeatMode: repeatMode
|
|
@@ -11044,7 +11094,7 @@ var LeaferUI = function(exports) {
|
|
|
11044
11094
|
conicGradient: conicGradient,
|
|
11045
11095
|
getTransform: getTransform
|
|
11046
11096
|
};
|
|
11047
|
-
const {copy: copy$3, move: move$6, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max$1} = Math;
|
|
11097
|
+
const {copy: copy$3, move: move$6, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max$1, abs: abs$5} = Math;
|
|
11048
11098
|
const tempBounds = {}, tempMatrix = new Matrix;
|
|
11049
11099
|
const offsetOutBounds$1 = {};
|
|
11050
11100
|
function shadow$1(ui, current, shape) {
|
|
@@ -11061,8 +11111,8 @@ var LeaferUI = function(exports) {
|
|
|
11061
11111
|
const sx = Math.abs(nowWorld.scaleX);
|
|
11062
11112
|
if (sx > 1) otherScale = 1 / sx;
|
|
11063
11113
|
}
|
|
11064
|
-
other.setWorldShadow(offsetOutBounds$1.offsetX + item.x * scaleX * otherScale, offsetOutBounds$1.offsetY + item.y * scaleY * otherScale, item.blur * scaleX * otherScale, ColorConvert.string(item.color));
|
|
11065
|
-
transform = getShadowTransform(ui, other, shape, item, offsetOutBounds$1, otherScale);
|
|
11114
|
+
other.setWorldShadow(offsetOutBounds$1.offsetX + (item.x || 0) * scaleX * otherScale, offsetOutBounds$1.offsetY + (item.y || 0) * scaleY * otherScale, (item.blur || 0) * scaleX * otherScale, ColorConvert.string(item.color));
|
|
11115
|
+
transform = Effect.getShadowTransform(ui, other, shape, item, offsetOutBounds$1, otherScale);
|
|
11066
11116
|
if (transform) other.setTransform(transform);
|
|
11067
11117
|
drawWorldShadow(other, offsetOutBounds$1, shape);
|
|
11068
11118
|
if (transform) other.resetTransform();
|
|
@@ -11084,7 +11134,7 @@ var LeaferUI = function(exports) {
|
|
|
11084
11134
|
function getShadowRenderSpread(_ui, shadow) {
|
|
11085
11135
|
let top = 0, right = 0, bottom = 0, left = 0, x, y, spread, blur;
|
|
11086
11136
|
shadow.forEach(item => {
|
|
11087
|
-
x = item.x || 0, y = item.y || 0,
|
|
11137
|
+
x = item.x || 0, y = item.y || 0, blur = (item.blur || 0) * 1.5, spread = abs$5(item.spread || 0);
|
|
11088
11138
|
top = max$1(top, spread + blur - y);
|
|
11089
11139
|
right = max$1(right, spread + blur + x);
|
|
11090
11140
|
bottom = max$1(bottom, spread + blur + y);
|
|
@@ -11132,8 +11182,8 @@ var LeaferUI = function(exports) {
|
|
|
11132
11182
|
if (sx > 1) otherScale = 1 / sx;
|
|
11133
11183
|
}
|
|
11134
11184
|
other.save();
|
|
11135
|
-
other.setWorldShadow(offsetOutBounds.offsetX + item.x * scaleX * otherScale, offsetOutBounds.offsetY + item.y * scaleY * otherScale, item.blur * scaleX * otherScale);
|
|
11136
|
-
transform = getShadowTransform(ui, other, shape, item, offsetOutBounds, otherScale, true);
|
|
11185
|
+
other.setWorldShadow(offsetOutBounds.offsetX + (item.x || 0) * scaleX * otherScale, offsetOutBounds.offsetY + (item.y || 0) * scaleY * otherScale, (item.blur || 0) * scaleX * otherScale);
|
|
11186
|
+
transform = Effect.getShadowTransform(ui, other, shape, item, offsetOutBounds, otherScale, true);
|
|
11137
11187
|
if (transform) other.setTransform(transform);
|
|
11138
11188
|
drawWorldShadow(other, offsetOutBounds, shape);
|
|
11139
11189
|
other.restore();
|
|
@@ -11707,6 +11757,7 @@ var LeaferUI = function(exports) {
|
|
|
11707
11757
|
getDrawData: getDrawData$1
|
|
11708
11758
|
};
|
|
11709
11759
|
function string(color, opacity) {
|
|
11760
|
+
if (!color) return "#000";
|
|
11710
11761
|
const doOpacity = isNumber(opacity) && opacity < 1;
|
|
11711
11762
|
if (isString(color)) {
|
|
11712
11763
|
if (doOpacity && ColorConvert.object) color = ColorConvert.object(color); else return color;
|
|
@@ -11775,7 +11826,10 @@ var LeaferUI = function(exports) {
|
|
|
11775
11826
|
t.setDimOthers(false);
|
|
11776
11827
|
t.setBright(false);
|
|
11777
11828
|
if (isArray(value) && value.length > 1 && value[0].locked) value.splice(0, 1);
|
|
11778
|
-
if (t.single)
|
|
11829
|
+
if (t.single) {
|
|
11830
|
+
delete t.element.syncEventer;
|
|
11831
|
+
delete t.element.__world.ignorePixelSnap;
|
|
11832
|
+
}
|
|
11779
11833
|
}
|
|
11780
11834
|
const type = isSelect ? EditorEvent.BEFORE_SELECT : EditorEvent.BEFORE_HOVER;
|
|
11781
11835
|
if (this.hasEvent(type)) this.emitEvent(new EditorEvent(type, {
|
|
@@ -11795,7 +11849,15 @@ var LeaferUI = function(exports) {
|
|
|
11795
11849
|
defineKey(target, key, {
|
|
11796
11850
|
get() {
|
|
11797
11851
|
const {config: config, element: element, dragPoint: dragPoint, editBox: editBox, app: app} = this, mergeConfig = Object.assign({}, config);
|
|
11798
|
-
if (element && element.editConfig)
|
|
11852
|
+
if (element && element.editConfig) {
|
|
11853
|
+
let {editConfig: editConfig} = element;
|
|
11854
|
+
if (editConfig.hover || editConfig.hoverStyle) {
|
|
11855
|
+
editConfig = Object.assign({}, editConfig);
|
|
11856
|
+
delete editConfig.hover;
|
|
11857
|
+
delete editConfig.hoverStyle;
|
|
11858
|
+
}
|
|
11859
|
+
Object.assign(mergeConfig, editConfig);
|
|
11860
|
+
}
|
|
11799
11861
|
if (editBox.config) Object.assign(mergeConfig, editBox.config);
|
|
11800
11862
|
if (dragPoint) {
|
|
11801
11863
|
if (dragPoint.editConfig) Object.assign(mergeConfig, dragPoint.editConfig);
|
|
@@ -11811,7 +11873,7 @@ var LeaferUI = function(exports) {
|
|
|
11811
11873
|
});
|
|
11812
11874
|
};
|
|
11813
11875
|
}
|
|
11814
|
-
const {abs: abs$
|
|
11876
|
+
const {abs: abs$4} = Math;
|
|
11815
11877
|
const {copy: copy$2, scale: scale$1} = MatrixHelper;
|
|
11816
11878
|
const {setListWithFn: setListWithFn} = BoundsHelper;
|
|
11817
11879
|
const {worldBounds: worldBounds} = LeafBoundsHelper;
|
|
@@ -11848,7 +11910,7 @@ var LeaferUI = function(exports) {
|
|
|
11848
11910
|
leaf = list[i];
|
|
11849
11911
|
const {worldTransform: worldTransform, worldRenderBounds: worldRenderBounds} = leaf;
|
|
11850
11912
|
if (worldRenderBounds.width && worldRenderBounds.height && (!bounds || bounds.hit(worldRenderBounds, options.matrix))) {
|
|
11851
|
-
const aScaleX = abs$
|
|
11913
|
+
const aScaleX = abs$4(worldTransform.scaleX), aScaleY = abs$4(worldTransform.scaleY);
|
|
11852
11914
|
copy$2(matrix$1, worldTransform);
|
|
11853
11915
|
matrix$1.half = strokeWidth % 2;
|
|
11854
11916
|
if (aScaleX !== aScaleY) {
|
|
@@ -11862,7 +11924,7 @@ var LeaferUI = function(exports) {
|
|
|
11862
11924
|
canvas.setWorld(matrix$1, options.matrix);
|
|
11863
11925
|
canvas.beginPath();
|
|
11864
11926
|
if (leaf.__.__useArrow) leaf.__drawPath(canvas); else leaf.__.__pathForRender ? leaf.__drawRenderPath(canvas) : leaf.__drawPathByBox(canvas);
|
|
11865
|
-
data.strokeWidth = strokeWidth / abs$
|
|
11927
|
+
data.strokeWidth = strokeWidth / abs$4(worldTransform.scaleX);
|
|
11866
11928
|
}
|
|
11867
11929
|
if (stroke) isString(stroke) ? Paint.stroke(stroke, this, canvas) : Paint.strokes(stroke, this, canvas);
|
|
11868
11930
|
if (fill) isString(fill) ? Paint.fill(fill, this, canvas) : Paint.fills(fill, this, canvas);
|
|
@@ -11967,8 +12029,10 @@ var LeaferUI = function(exports) {
|
|
|
11967
12029
|
onHover() {
|
|
11968
12030
|
const {editor: editor} = this;
|
|
11969
12031
|
if (this.running && !this.dragging && !editor.dragging) {
|
|
11970
|
-
const {
|
|
11971
|
-
|
|
12032
|
+
const {hoverTarget: hoverTarget, mergeConfig: mergeConfig} = editor, config = Object.assign({}, mergeConfig);
|
|
12033
|
+
if (hoverTarget && hoverTarget.editConfig) Object.assign(config, hoverTarget.editConfig);
|
|
12034
|
+
const {stroke: stroke, strokeWidth: strokeWidth, hover: hover, hoverStyle: hoverStyle} = config;
|
|
12035
|
+
this.hoverStroker.setTarget(hover ? hoverTarget : null, Object.assign({
|
|
11972
12036
|
stroke: stroke,
|
|
11973
12037
|
strokeWidth: strokeWidth
|
|
11974
12038
|
}, hoverStyle || {}));
|
|
@@ -12146,11 +12210,10 @@ var LeaferUI = function(exports) {
|
|
|
12146
12210
|
}
|
|
12147
12211
|
}
|
|
12148
12212
|
const {topLeft: topLeft$1, top: top$1, topRight: topRight$1, right: right$2, bottomRight: bottomRight, bottom: bottom$1, bottomLeft: bottomLeft, left: left$2} = exports.Direction9;
|
|
12149
|
-
const {toPoint: toPoint} = AroundHelper;
|
|
12150
|
-
const {within: within$3, sign: sign$1} = MathHelper;
|
|
12213
|
+
const {toPoint: toPoint} = AroundHelper, {within: within$3, sign: sign$1} = MathHelper, {abs: abs$3} = Math;
|
|
12151
12214
|
const EditDataHelper = {
|
|
12152
12215
|
getScaleData(target, startBounds, direction, totalMoveOrScale, lockRatio, around, flipable, scaleMode) {
|
|
12153
|
-
let align, origin = {}, scaleX = 1, scaleY = 1;
|
|
12216
|
+
let align, origin = {}, scaleX = 1, scaleY = 1, lockScale;
|
|
12154
12217
|
const {boxBounds: boxBounds, widthRange: widthRange, heightRange: heightRange, dragBounds: dragBounds, worldBoxBounds: worldBoxBounds} = target;
|
|
12155
12218
|
const {width: width, height: height} = startBounds;
|
|
12156
12219
|
const originChangedScaleX = target.scaleX / startBounds.scaleX;
|
|
@@ -12220,23 +12283,22 @@ var LeaferUI = function(exports) {
|
|
|
12220
12283
|
if (lockRatio === "corner" && direction % 2) {
|
|
12221
12284
|
lockRatio = false;
|
|
12222
12285
|
} else {
|
|
12223
|
-
let scale;
|
|
12224
12286
|
switch (direction) {
|
|
12225
12287
|
case top$1:
|
|
12226
12288
|
case bottom$1:
|
|
12227
|
-
|
|
12289
|
+
scaleX = scaleY;
|
|
12228
12290
|
break;
|
|
12229
12291
|
|
|
12230
12292
|
case left$2:
|
|
12231
12293
|
case right$2:
|
|
12232
|
-
|
|
12294
|
+
scaleY = scaleX;
|
|
12233
12295
|
break;
|
|
12234
12296
|
|
|
12235
12297
|
default:
|
|
12236
|
-
|
|
12298
|
+
lockScale = Math.sqrt(abs$3(scaleX * scaleY));
|
|
12299
|
+
scaleX = sign$1(scaleX) * lockScale;
|
|
12300
|
+
scaleY = sign$1(scaleY) * lockScale;
|
|
12237
12301
|
}
|
|
12238
|
-
scaleX = scaleX < 0 ? -scale : scale;
|
|
12239
|
-
scaleY = scaleY < 0 ? -scale : scale;
|
|
12240
12302
|
}
|
|
12241
12303
|
}
|
|
12242
12304
|
}
|
|
@@ -12254,7 +12316,7 @@ var LeaferUI = function(exports) {
|
|
|
12254
12316
|
x: scaleX,
|
|
12255
12317
|
y: scaleY
|
|
12256
12318
|
};
|
|
12257
|
-
DragBoundsHelper.limitScaleOf(target, origin, scaleData);
|
|
12319
|
+
DragBoundsHelper.limitScaleOf(target, origin, scaleData, lockRatio);
|
|
12258
12320
|
scaleX = scaleData.x;
|
|
12259
12321
|
scaleY = scaleData.y;
|
|
12260
12322
|
}
|
|
@@ -12266,9 +12328,13 @@ var LeaferUI = function(exports) {
|
|
|
12266
12328
|
const nowHeight = boxBounds.height * target.scaleY;
|
|
12267
12329
|
scaleY = within$3(nowHeight * scaleY, heightRange) / nowHeight;
|
|
12268
12330
|
}
|
|
12269
|
-
if (useScaleX &&
|
|
12270
|
-
if (useScaleY &&
|
|
12271
|
-
if (lockRatio && scaleX !== scaleY)
|
|
12331
|
+
if (useScaleX && abs$3(scaleX * worldBoxBounds.width) < 1) scaleX = sign$1(scaleX) / worldBoxBounds.width;
|
|
12332
|
+
if (useScaleY && abs$3(scaleY * worldBoxBounds.height) < 1) scaleY = sign$1(scaleY) / worldBoxBounds.height;
|
|
12333
|
+
if (lockRatio && scaleX !== scaleY) {
|
|
12334
|
+
lockScale = Math.min(abs$3(scaleX), abs$3(scaleY));
|
|
12335
|
+
scaleX = sign$1(scaleX) * lockScale;
|
|
12336
|
+
scaleY = sign$1(scaleY) * lockScale;
|
|
12337
|
+
}
|
|
12272
12338
|
return {
|
|
12273
12339
|
origin: origin,
|
|
12274
12340
|
scaleX: scaleX,
|
|
@@ -12511,7 +12577,7 @@ var LeaferUI = function(exports) {
|
|
|
12511
12577
|
return this.scaleX * this.scaleY < 0;
|
|
12512
12578
|
}
|
|
12513
12579
|
get canUse() {
|
|
12514
|
-
return this.visible && this.view.visible;
|
|
12580
|
+
return this.app && this.visible && this.view.visible;
|
|
12515
12581
|
}
|
|
12516
12582
|
get canGesture() {
|
|
12517
12583
|
if (!this.canUse) return false;
|
|
@@ -12592,7 +12658,7 @@ var LeaferUI = function(exports) {
|
|
|
12592
12658
|
}
|
|
12593
12659
|
load() {
|
|
12594
12660
|
const {target: target, mergeConfig: mergeConfig, single: single, rect: rect, circle: circle, resizePoints: resizePoints, resizeLines: resizeLines} = this;
|
|
12595
|
-
const {stroke: stroke, strokeWidth: strokeWidth, resizeLine: resizeLine} = mergeConfig;
|
|
12661
|
+
const {stroke: stroke, strokeWidth: strokeWidth, resizeLine: resizeLine, ignorePixelSnap: ignorePixelSnap} = mergeConfig;
|
|
12596
12662
|
const pointsStyle = this.getPointsStyle();
|
|
12597
12663
|
const middlePointsStyle = this.getMiddlePointsStyle();
|
|
12598
12664
|
this.visible = !target.locked;
|
|
@@ -12612,16 +12678,16 @@ var LeaferUI = function(exports) {
|
|
|
12612
12678
|
strokeWidth: strokeWidth,
|
|
12613
12679
|
editConfig: editConfig
|
|
12614
12680
|
}, mergeConfig.rect || {}));
|
|
12615
|
-
const
|
|
12616
|
-
rect.hittable = !
|
|
12617
|
-
|
|
12618
|
-
if (syncEventer) {
|
|
12681
|
+
const rectThrough = isNull(mergeConfig.rectThrough) ? single : mergeConfig.rectThrough;
|
|
12682
|
+
rect.hittable = !rectThrough;
|
|
12683
|
+
if (rectThrough) {
|
|
12619
12684
|
target.syncEventer = rect;
|
|
12620
12685
|
this.app.interaction.bottomList = [ {
|
|
12621
12686
|
target: rect,
|
|
12622
12687
|
proxy: target
|
|
12623
12688
|
} ];
|
|
12624
12689
|
}
|
|
12690
|
+
if (single) DataHelper.stintSet(target.__world, "ignorePixelSnap", ignorePixelSnap);
|
|
12625
12691
|
updateMoveCursor(this);
|
|
12626
12692
|
}
|
|
12627
12693
|
update() {
|
|
@@ -15194,6 +15260,68 @@ var LeaferUI = function(exports) {
|
|
|
15194
15260
|
this.__htmlChanged = true;
|
|
15195
15261
|
}
|
|
15196
15262
|
}
|
|
15263
|
+
const unicodeEntities = {
|
|
15264
|
+
lt: "<",
|
|
15265
|
+
gt: ">",
|
|
15266
|
+
amp: "&",
|
|
15267
|
+
quot: '"',
|
|
15268
|
+
apos: "'",
|
|
15269
|
+
nbsp: " ",
|
|
15270
|
+
ensp: " ",
|
|
15271
|
+
emsp: " ",
|
|
15272
|
+
thinsp: " ",
|
|
15273
|
+
ndash: "–",
|
|
15274
|
+
mdash: "—",
|
|
15275
|
+
hellip: "…",
|
|
15276
|
+
middot: "·",
|
|
15277
|
+
bull: "•",
|
|
15278
|
+
laquo: "«",
|
|
15279
|
+
raquo: "»",
|
|
15280
|
+
lsquo: "‘",
|
|
15281
|
+
rsquo: "’",
|
|
15282
|
+
ldquo: "“",
|
|
15283
|
+
rdquo: "”",
|
|
15284
|
+
cent: "¢",
|
|
15285
|
+
pound: "£",
|
|
15286
|
+
yen: "¥",
|
|
15287
|
+
euro: "€",
|
|
15288
|
+
times: "×",
|
|
15289
|
+
divide: "÷",
|
|
15290
|
+
plusmn: "±",
|
|
15291
|
+
minus: "−",
|
|
15292
|
+
frac12: "½",
|
|
15293
|
+
frac14: "¼",
|
|
15294
|
+
frac34: "¾",
|
|
15295
|
+
sup2: "²",
|
|
15296
|
+
sup3: "³",
|
|
15297
|
+
deg: "°",
|
|
15298
|
+
reg: "®",
|
|
15299
|
+
copy: "©",
|
|
15300
|
+
trade: "™",
|
|
15301
|
+
section: "§",
|
|
15302
|
+
para: "¶",
|
|
15303
|
+
dagger: "†",
|
|
15304
|
+
Dagger: "‡",
|
|
15305
|
+
larr: "←",
|
|
15306
|
+
uarr: "↑",
|
|
15307
|
+
rarr: "→",
|
|
15308
|
+
darr: "↓",
|
|
15309
|
+
harr: "↔",
|
|
15310
|
+
alpha: "α",
|
|
15311
|
+
beta: "β",
|
|
15312
|
+
gamma: "γ",
|
|
15313
|
+
delta: "δ",
|
|
15314
|
+
pi: "π",
|
|
15315
|
+
sigma: "σ",
|
|
15316
|
+
omega: "ω",
|
|
15317
|
+
Omega: "Ω",
|
|
15318
|
+
micro: "µ",
|
|
15319
|
+
infinity: "∞",
|
|
15320
|
+
not: "¬",
|
|
15321
|
+
equiv: "≡",
|
|
15322
|
+
le: "≤",
|
|
15323
|
+
ge: "≥"
|
|
15324
|
+
};
|
|
15197
15325
|
exports.HTMLText = class HTMLText extends exports.Image {
|
|
15198
15326
|
get __tag() {
|
|
15199
15327
|
return "HTMLText";
|
|
@@ -15213,7 +15341,7 @@ var LeaferUI = function(exports) {
|
|
|
15213
15341
|
document.body.appendChild(div);
|
|
15214
15342
|
const {width: width, height: height} = div.getBoundingClientRect();
|
|
15215
15343
|
const realWidth = width + 10;
|
|
15216
|
-
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>`;
|
|
15344
|
+
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>`;
|
|
15217
15345
|
data.__setImageFill("data:image/svg+xml," + encodeURIComponent(svg));
|
|
15218
15346
|
data.__naturalWidth = realWidth / data.pixelRatio;
|
|
15219
15347
|
data.__naturalHeight = height / data.pixelRatio;
|
|
@@ -15226,6 +15354,29 @@ var LeaferUI = function(exports) {
|
|
|
15226
15354
|
if (this.textEditing && !options.exporting) return;
|
|
15227
15355
|
super.__draw(canvas, options, originCanvas);
|
|
15228
15356
|
}
|
|
15357
|
+
decodeText(text) {
|
|
15358
|
+
if (!text.includes("&")) return text;
|
|
15359
|
+
let result = "", i = 0, entity, value;
|
|
15360
|
+
while (i < text.length) {
|
|
15361
|
+
if (text[i] === "&") {
|
|
15362
|
+
const semicolonIndex = text.indexOf(";", i + 1);
|
|
15363
|
+
if (semicolonIndex > i + 1) {
|
|
15364
|
+
entity = text.slice(i + 1, semicolonIndex);
|
|
15365
|
+
value = unicodeEntities[entity];
|
|
15366
|
+
if (value !== undefined) {
|
|
15367
|
+
result += value;
|
|
15368
|
+
i = semicolonIndex + 1;
|
|
15369
|
+
continue;
|
|
15370
|
+
}
|
|
15371
|
+
}
|
|
15372
|
+
}
|
|
15373
|
+
result += text[i++];
|
|
15374
|
+
}
|
|
15375
|
+
return result;
|
|
15376
|
+
}
|
|
15377
|
+
static addUnicodeEntity(entity, unicode) {
|
|
15378
|
+
if (isString(entity)) unicodeEntities[entity] = unicode; else Object.assign(unicodeEntities, entity);
|
|
15379
|
+
}
|
|
15229
15380
|
};
|
|
15230
15381
|
__decorate([ dataProcessor(HTMLTextData) ], exports.HTMLText.prototype, "__", void 0);
|
|
15231
15382
|
__decorate([ boundsType("") ], exports.HTMLText.prototype, "text", void 0);
|