@leafer/worker 2.0.7 → 2.0.9
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.esm.min.js.map +1 -1
- package/dist/worker.js +100 -49
- package/dist/worker.min.cjs.map +1 -1
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +103 -49
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +27 -27
package/dist/worker.module.js
CHANGED
|
@@ -774,7 +774,7 @@ const {float: float$5} = MathHelper;
|
|
|
774
774
|
|
|
775
775
|
const {toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$3} = MatrixHelper;
|
|
776
776
|
|
|
777
|
-
const {sin: sin$5, cos: cos$5, abs: abs$
|
|
777
|
+
const {sin: sin$5, cos: cos$5, abs: abs$b, sqrt: sqrt$4, atan2: atan2$2, min: min$3, round: round$5} = Math;
|
|
778
778
|
|
|
779
779
|
const PointHelper = {
|
|
780
780
|
defaultPoint: getPointData(),
|
|
@@ -872,8 +872,8 @@ const PointHelper = {
|
|
|
872
872
|
return getDistanceFrom(t.x, t.y, point.x, point.y);
|
|
873
873
|
},
|
|
874
874
|
getDistanceFrom(x1, y1, x2, y2) {
|
|
875
|
-
const x = abs$
|
|
876
|
-
const y = abs$
|
|
875
|
+
const x = abs$b(x2 - x1);
|
|
876
|
+
const y = abs$b(y2 - y1);
|
|
877
877
|
return sqrt$4(x * x + y * y);
|
|
878
878
|
},
|
|
879
879
|
getMinDistanceFrom(x1, y1, x2, y2, x3, y3) {
|
|
@@ -2700,7 +2700,7 @@ const RectHelper = {
|
|
|
2700
2700
|
}
|
|
2701
2701
|
};
|
|
2702
2702
|
|
|
2703
|
-
const {sin: sin$4, cos: cos$4, hypot: hypot$1, atan2: atan2$1, ceil: ceil$1, abs: abs$
|
|
2703
|
+
const {sin: sin$4, cos: cos$4, hypot: hypot$1, atan2: atan2$1, ceil: ceil$1, abs: abs$a, PI: PI$3, sqrt: sqrt$3, pow: pow$1} = Math;
|
|
2704
2704
|
|
|
2705
2705
|
const {setPoint: setPoint$4, addPoint: addPoint$2} = TwoPointBoundsHelper;
|
|
2706
2706
|
|
|
@@ -2777,7 +2777,7 @@ const BezierHelper = {
|
|
|
2777
2777
|
const lenCB = hypot$1(CBx, CBy);
|
|
2778
2778
|
let totalRadian = endRadian - startRadian;
|
|
2779
2779
|
if (totalRadian < 0) totalRadian += PI2;
|
|
2780
|
-
if (lenBA < 1e-12 || lenCB < 1e-12 || totalRadian < 1e-12 || abs$
|
|
2780
|
+
if (lenBA < 1e-12 || lenCB < 1e-12 || totalRadian < 1e-12 || abs$a(totalRadian - PI$3) < 1e-12) {
|
|
2781
2781
|
if (data) data.push(L$b, x1, y1);
|
|
2782
2782
|
if (setPointBounds) {
|
|
2783
2783
|
setPoint$4(setPointBounds, fromX, fromY);
|
|
@@ -2810,7 +2810,7 @@ const BezierHelper = {
|
|
|
2810
2810
|
let totalRadian = endRadian - startRadian;
|
|
2811
2811
|
if (totalRadian < 0) totalRadian += PI2; else if (totalRadian > PI2) totalRadian -= PI2;
|
|
2812
2812
|
if (anticlockwise) totalRadian -= PI2;
|
|
2813
|
-
const parts = ceil$1(abs$
|
|
2813
|
+
const parts = ceil$1(abs$a(totalRadian / PI_2));
|
|
2814
2814
|
const partRadian = totalRadian / parts;
|
|
2815
2815
|
const partRadian4Sin = sin$4(partRadian / 4);
|
|
2816
2816
|
const control = 8 / 3 * partRadian4Sin * partRadian4Sin / sin$4(partRadian / 2);
|
|
@@ -3316,7 +3316,7 @@ const {M: M$9, L: L$9, C: C$7, Q: Q$5, Z: Z$7, N: N$4, D: D$5, X: X$4, G: G$4, F
|
|
|
3316
3316
|
|
|
3317
3317
|
const {getMinDistanceFrom: getMinDistanceFrom, getRadianFrom: getRadianFrom} = PointHelper;
|
|
3318
3318
|
|
|
3319
|
-
const {tan: tan, min: min$2, abs: abs$
|
|
3319
|
+
const {tan: tan, min: min$2, abs: abs$9} = Math;
|
|
3320
3320
|
|
|
3321
3321
|
const startPoint = {};
|
|
3322
3322
|
|
|
@@ -3376,7 +3376,7 @@ const PathCommandDataHelper = {
|
|
|
3376
3376
|
arcTo(data, x1, y1, x2, y2, radius, lastX, lastY, fullRadius) {
|
|
3377
3377
|
if (!isUndefined(lastX)) {
|
|
3378
3378
|
const r = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2) / (fullRadius ? 1 : 2);
|
|
3379
|
-
radius = min$2(radius, min$2(r, r * abs$
|
|
3379
|
+
radius = min$2(radius, min$2(r, r * abs$9(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
|
|
3380
3380
|
}
|
|
3381
3381
|
data.push(U$4, x1, y1, x2, y2, radius);
|
|
3382
3382
|
},
|
|
@@ -7079,7 +7079,7 @@ class LeafLevelList {
|
|
|
7079
7079
|
}
|
|
7080
7080
|
}
|
|
7081
7081
|
|
|
7082
|
-
const version = "2.0.
|
|
7082
|
+
const version = "2.0.9";
|
|
7083
7083
|
|
|
7084
7084
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
7085
7085
|
get allowBackgroundColor() {
|
|
@@ -9470,11 +9470,16 @@ let Polygon = class Polygon extends UI {
|
|
|
9470
9470
|
if (data.points) {
|
|
9471
9471
|
drawPoints$1(path, data.points, data.curve, data.closed);
|
|
9472
9472
|
} else {
|
|
9473
|
-
const {width: width, height: height, sides: sides} = data;
|
|
9473
|
+
const {width: width, height: height, sides: sides, startAngle: startAngle} = data;
|
|
9474
9474
|
const rx = width / 2, ry = height / 2;
|
|
9475
|
-
|
|
9475
|
+
let startRadian = 0, radian;
|
|
9476
|
+
if (startAngle) {
|
|
9477
|
+
startRadian = startAngle * OneRadian;
|
|
9478
|
+
moveTo$2(path, rx + rx * sin$2(startRadian), ry - ry * cos$2(startRadian));
|
|
9479
|
+
} else moveTo$2(path, rx, 0);
|
|
9476
9480
|
for (let i = 1; i < sides; i++) {
|
|
9477
|
-
|
|
9481
|
+
radian = i * 2 * PI$2 / sides + startRadian;
|
|
9482
|
+
lineTo$2(path, rx + rx * sin$2(radian), ry - ry * cos$2(radian));
|
|
9478
9483
|
}
|
|
9479
9484
|
closePath$1(path);
|
|
9480
9485
|
}
|
|
@@ -9485,6 +9490,8 @@ __decorate([ dataProcessor(PolygonData) ], Polygon.prototype, "__", void 0);
|
|
|
9485
9490
|
|
|
9486
9491
|
__decorate([ pathType(3) ], Polygon.prototype, "sides", void 0);
|
|
9487
9492
|
|
|
9493
|
+
__decorate([ pathType(0) ], Polygon.prototype, "startAngle", void 0);
|
|
9494
|
+
|
|
9488
9495
|
__decorate([ pathType() ], Polygon.prototype, "points", void 0);
|
|
9489
9496
|
|
|
9490
9497
|
__decorate([ pathType(0) ], Polygon.prototype, "curve", void 0);
|
|
@@ -9500,12 +9507,17 @@ let Star = class Star extends UI {
|
|
|
9500
9507
|
return "Star";
|
|
9501
9508
|
}
|
|
9502
9509
|
__updatePath() {
|
|
9503
|
-
const {width: width, height: height, corners: corners, innerRadius: innerRadius} = this.__;
|
|
9510
|
+
const {width: width, height: height, corners: corners, innerRadius: innerRadius, startAngle: startAngle} = this.__;
|
|
9504
9511
|
const rx = width / 2, ry = height / 2;
|
|
9505
9512
|
const path = this.__.path = [];
|
|
9506
|
-
|
|
9513
|
+
let startRadian = 0, radian;
|
|
9514
|
+
if (startAngle) {
|
|
9515
|
+
startRadian = startAngle * OneRadian;
|
|
9516
|
+
moveTo$1(path, rx + rx * sin$1(startRadian), ry - ry * cos$1(startRadian));
|
|
9517
|
+
} else moveTo$1(path, rx, 0);
|
|
9507
9518
|
for (let i = 1; i < corners * 2; i++) {
|
|
9508
|
-
|
|
9519
|
+
radian = i * PI$1 / corners + startRadian;
|
|
9520
|
+
lineTo$1(path, rx + (i % 2 === 0 ? rx : rx * innerRadius) * sin$1(radian), ry - (i % 2 === 0 ? ry : ry * innerRadius) * cos$1(radian));
|
|
9509
9521
|
}
|
|
9510
9522
|
closePath(path);
|
|
9511
9523
|
}
|
|
@@ -9517,6 +9529,8 @@ __decorate([ pathType(5) ], Star.prototype, "corners", void 0);
|
|
|
9517
9529
|
|
|
9518
9530
|
__decorate([ pathType(.382) ], Star.prototype, "innerRadius", void 0);
|
|
9519
9531
|
|
|
9532
|
+
__decorate([ pathType(0) ], Star.prototype, "startAngle", void 0);
|
|
9533
|
+
|
|
9520
9534
|
Star = __decorate([ registerUI() ], Star);
|
|
9521
9535
|
|
|
9522
9536
|
const {moveTo: moveTo, lineTo: lineTo, drawPoints: drawPoints} = PathCommandDataHelper;
|
|
@@ -9875,7 +9889,8 @@ let Pen = class Pen extends Group {
|
|
|
9875
9889
|
return this;
|
|
9876
9890
|
}
|
|
9877
9891
|
paint() {
|
|
9878
|
-
|
|
9892
|
+
const {pathElement: pathElement} = this;
|
|
9893
|
+
if (!pathElement.__layout.boxChanged) pathElement.forceUpdate("path");
|
|
9879
9894
|
}
|
|
9880
9895
|
};
|
|
9881
9896
|
|
|
@@ -10093,7 +10108,7 @@ class UIEvent extends Event {
|
|
|
10093
10108
|
}
|
|
10094
10109
|
}
|
|
10095
10110
|
|
|
10096
|
-
const {min: min$1, max: max$3, abs: abs$
|
|
10111
|
+
const {min: min$1, max: max$3, abs: abs$8} = Math, {float: float$3, sign: sign$2} = MathHelper, {minX: minX, maxX: maxX, minY: minY, maxY: maxY} = BoundsHelper;
|
|
10097
10112
|
|
|
10098
10113
|
const tempContent = new Bounds, tempDragBounds = new Bounds;
|
|
10099
10114
|
|
|
@@ -10117,7 +10132,7 @@ const DragBoundsHelper = {
|
|
|
10117
10132
|
return dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds;
|
|
10118
10133
|
},
|
|
10119
10134
|
isInnerMode(content, dragBounds, dragBoundsType, sideType) {
|
|
10120
|
-
return dragBoundsType === "inner" || dragBoundsType === "auto" && content[sideType] > dragBounds[sideType];
|
|
10135
|
+
return dragBoundsType === "inner" || dragBoundsType === "auto" && float$3(content[sideType]) > float$3(dragBounds[sideType]);
|
|
10121
10136
|
},
|
|
10122
10137
|
getValidMove(content, dragBounds, dragBoundsType, move, change) {
|
|
10123
10138
|
const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
|
|
@@ -10170,7 +10185,7 @@ const DragBoundsHelper = {
|
|
|
10170
10185
|
bScale = originBottomScale && bSize > 0 ? 1 + bSize / (originBottomScale * tempContent.height) : 1;
|
|
10171
10186
|
correctScaleY *= max$3(aScale, bScale);
|
|
10172
10187
|
if (lockRatio) {
|
|
10173
|
-
aScale = max$3(abs$
|
|
10188
|
+
aScale = max$3(abs$8(correctScaleX), abs$8(correctScaleY));
|
|
10174
10189
|
correctScaleX = sign$2(correctScaleX) * aScale;
|
|
10175
10190
|
correctScaleY = sign$2(correctScaleY) * aScale;
|
|
10176
10191
|
}
|
|
@@ -11475,6 +11490,8 @@ function stroke(stroke, ui, canvas, renderOptions) {
|
|
|
11475
11490
|
if (!data.__strokeWidth) return;
|
|
11476
11491
|
if (data.__font) {
|
|
11477
11492
|
Paint.strokeText(stroke, ui, canvas, renderOptions);
|
|
11493
|
+
} else if (data.__pathForStroke) {
|
|
11494
|
+
Paint.fillStroke(stroke, ui, canvas, renderOptions);
|
|
11478
11495
|
} else {
|
|
11479
11496
|
switch (data.strokeAlign) {
|
|
11480
11497
|
case "center":
|
|
@@ -11771,12 +11788,12 @@ const PaintModule = {
|
|
|
11771
11788
|
|
|
11772
11789
|
let cache$1, box$2 = new Bounds;
|
|
11773
11790
|
|
|
11774
|
-
const {isSame: isSame$
|
|
11791
|
+
const {isSame: isSame$2} = BoundsHelper;
|
|
11775
11792
|
|
|
11776
11793
|
function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
11777
11794
|
let leafPaint, event;
|
|
11778
11795
|
const image = ImageManager.get(paint, paint.type);
|
|
11779
|
-
if (cache$1 && paint === cache$1.paint && isSame$
|
|
11796
|
+
if (cache$1 && paint === cache$1.paint && isSame$2(boxBounds, cache$1.boxBounds)) {
|
|
11780
11797
|
leafPaint = cache$1.leafPaint;
|
|
11781
11798
|
} else {
|
|
11782
11799
|
leafPaint = {
|
|
@@ -12067,7 +12084,7 @@ function layout$3(transform, box, x, y, scaleX, scaleY, rotation, skew) {
|
|
|
12067
12084
|
|
|
12068
12085
|
const {get: get$1, scale: scale$2, copy: copy$4} = MatrixHelper;
|
|
12069
12086
|
|
|
12070
|
-
const {getFloorScale: getFloorScale} = MathHelper, {abs: abs$
|
|
12087
|
+
const {getFloorScale: getFloorScale} = MathHelper, {abs: abs$7} = Math;
|
|
12071
12088
|
|
|
12072
12089
|
function createPatternTask(paint, ui, canvas, renderOptions) {
|
|
12073
12090
|
if (!paint.patternTask) {
|
|
@@ -12091,8 +12108,8 @@ function createPattern(paint, ui, canvas, renderOptions) {
|
|
|
12091
12108
|
width *= scaleX;
|
|
12092
12109
|
height *= scaleY;
|
|
12093
12110
|
if (gap) {
|
|
12094
|
-
xGap = gap.x * scaleX / abs$
|
|
12095
|
-
yGap = gap.y * scaleY / abs$
|
|
12111
|
+
xGap = gap.x * scaleX / abs$7(data.scaleX || 1);
|
|
12112
|
+
yGap = gap.y * scaleY / abs$7(data.scaleY || 1);
|
|
12096
12113
|
}
|
|
12097
12114
|
if (transform || scaleX !== 1 || scaleY !== 1) {
|
|
12098
12115
|
scaleX *= getFloorScale(width + (xGap || 0));
|
|
@@ -12329,7 +12346,7 @@ const PaintGradientModule = {
|
|
|
12329
12346
|
getTransform: getTransform
|
|
12330
12347
|
};
|
|
12331
12348
|
|
|
12332
|
-
const {copy: copy$3, move: move$6, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max$2, abs: abs$
|
|
12349
|
+
const {copy: copy$3, move: move$6, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max$2, abs: abs$6} = Math;
|
|
12333
12350
|
|
|
12334
12351
|
const tempBounds$1 = {}, tempMatrix = new Matrix;
|
|
12335
12352
|
|
|
@@ -12373,7 +12390,7 @@ function shadow$1(ui, current, shape) {
|
|
|
12373
12390
|
function getShadowRenderSpread(_ui, shadow) {
|
|
12374
12391
|
let top = 0, right = 0, bottom = 0, left = 0, x, y, spread, blur;
|
|
12375
12392
|
shadow.forEach(item => {
|
|
12376
|
-
x = item.x || 0, y = item.y || 0, blur = (item.blur || 0) * 1.5, spread = abs$
|
|
12393
|
+
x = item.x || 0, y = item.y || 0, blur = (item.blur || 0) * 1.5, spread = abs$6(item.spread || 0);
|
|
12377
12394
|
top = max$2(top, spread + blur - y);
|
|
12378
12395
|
right = max$2(right, spread + blur + x);
|
|
12379
12396
|
bottom = max$2(bottom, spread + blur + y);
|
|
@@ -13208,7 +13225,7 @@ function mergeConfigAttr() {
|
|
|
13208
13225
|
};
|
|
13209
13226
|
}
|
|
13210
13227
|
|
|
13211
|
-
const {abs: abs$
|
|
13228
|
+
const {abs: abs$5} = Math;
|
|
13212
13229
|
|
|
13213
13230
|
const {copy: copy$2} = MatrixHelper;
|
|
13214
13231
|
|
|
@@ -13251,7 +13268,7 @@ class Stroker extends UI {
|
|
|
13251
13268
|
leaf = list[i];
|
|
13252
13269
|
const {worldTransform: worldTransform, worldRenderBounds: worldRenderBounds} = leaf;
|
|
13253
13270
|
if (worldRenderBounds.width && worldRenderBounds.height && (!bounds || bounds.hit(worldRenderBounds, options.matrix))) {
|
|
13254
|
-
const aScaleX = abs$
|
|
13271
|
+
const aScaleX = abs$5(worldTransform.scaleX), aScaleY = abs$5(worldTransform.scaleY);
|
|
13255
13272
|
copy$2(matrix$1, worldTransform);
|
|
13256
13273
|
matrix$1.half = strokeWidth % 2;
|
|
13257
13274
|
canvas.setWorld(matrix$1, options.matrix);
|
|
@@ -13564,7 +13581,7 @@ class EditSelect extends Group {
|
|
|
13564
13581
|
|
|
13565
13582
|
const {topLeft: topLeft$1, top: top$1, topRight: topRight$1, right: right$2, bottomRight: bottomRight, bottom: bottom$1, bottomLeft: bottomLeft, left: left$2} = Direction9;
|
|
13566
13583
|
|
|
13567
|
-
const {toPoint: toPoint} = AroundHelper, {within: within$3, sign: sign$1} = MathHelper, {abs: abs$
|
|
13584
|
+
const {toPoint: toPoint} = AroundHelper, {within: within$3, sign: sign$1} = MathHelper, {abs: abs$4} = Math;
|
|
13568
13585
|
|
|
13569
13586
|
const EditDataHelper = {
|
|
13570
13587
|
getScaleData(target, startBounds, direction, totalMoveOrScale, lockRatio, around, flipable, scaleMode) {
|
|
@@ -13650,7 +13667,7 @@ const EditDataHelper = {
|
|
|
13650
13667
|
break;
|
|
13651
13668
|
|
|
13652
13669
|
default:
|
|
13653
|
-
lockScale = Math.sqrt(abs$
|
|
13670
|
+
lockScale = Math.sqrt(abs$4(scaleX * scaleY));
|
|
13654
13671
|
scaleX = sign$1(scaleX) * lockScale;
|
|
13655
13672
|
scaleY = sign$1(scaleY) * lockScale;
|
|
13656
13673
|
}
|
|
@@ -13683,10 +13700,10 @@ const EditDataHelper = {
|
|
|
13683
13700
|
const nowHeight = boxBounds.height * target.scaleY;
|
|
13684
13701
|
scaleY = within$3(nowHeight * scaleY, heightRange) / nowHeight;
|
|
13685
13702
|
}
|
|
13686
|
-
if (useScaleX && abs$
|
|
13687
|
-
if (useScaleY && abs$
|
|
13703
|
+
if (useScaleX && abs$4(scaleX * worldBoxBounds.width) < 1) scaleX = sign$1(scaleX) / worldBoxBounds.width;
|
|
13704
|
+
if (useScaleY && abs$4(scaleY * worldBoxBounds.height) < 1) scaleY = sign$1(scaleY) / worldBoxBounds.height;
|
|
13688
13705
|
if (lockRatio && scaleX !== scaleY) {
|
|
13689
|
-
lockScale = Math.min(abs$
|
|
13706
|
+
lockScale = Math.min(abs$4(scaleX), abs$4(scaleY));
|
|
13690
13707
|
scaleX = sign$1(scaleX) * lockScale;
|
|
13691
13708
|
scaleY = sign$1(scaleY) * lockScale;
|
|
13692
13709
|
}
|
|
@@ -15725,10 +15742,22 @@ function scaleResizeFontSize(leaf, scaleX, scaleY, direction) {
|
|
|
15725
15742
|
}
|
|
15726
15743
|
}
|
|
15727
15744
|
leaf.fontSize *= fontScale;
|
|
15728
|
-
const data = leaf.__, {padding: padding} = data;
|
|
15745
|
+
const data = leaf.__, {padding: padding, lineHeight: lineHeight, letterSpacing: letterSpacing} = data;
|
|
15729
15746
|
if (padding) leaf.padding = isArray(padding) ? padding.map(item => item * fontScale) : padding * fontScale;
|
|
15730
15747
|
if (!data.__autoWidth) leaf.width *= fontScale;
|
|
15731
15748
|
if (!data.__autoHeight) leaf.height *= fontScale;
|
|
15749
|
+
if (isObject(lineHeight)) {
|
|
15750
|
+
if (lineHeight.type === "px") data.lineHeight = {
|
|
15751
|
+
type: "px",
|
|
15752
|
+
value: lineHeight.value * fontScale
|
|
15753
|
+
};
|
|
15754
|
+
} else if (lineHeight) data.lineHeight = lineHeight * fontScale;
|
|
15755
|
+
if (isObject(letterSpacing)) {
|
|
15756
|
+
if (letterSpacing.type === "px") data.letterSpacing = {
|
|
15757
|
+
type: "px",
|
|
15758
|
+
value: letterSpacing.value * fontScale
|
|
15759
|
+
};
|
|
15760
|
+
} else if (letterSpacing) data.letterSpacing = letterSpacing * fontScale;
|
|
15732
15761
|
}
|
|
15733
15762
|
|
|
15734
15763
|
function scaleResizePath(leaf, scaleX, scaleY) {
|
|
@@ -16297,7 +16326,7 @@ const MultiTouchHelper = {
|
|
|
16297
16326
|
|
|
16298
16327
|
const M$4 = MultiTouchHelper;
|
|
16299
16328
|
|
|
16300
|
-
const {abs: abs$
|
|
16329
|
+
const {abs: abs$3, max: max$1} = Math, {sign: sign, within: within$2} = MathHelper;
|
|
16301
16330
|
|
|
16302
16331
|
const WheelEventHelper = {
|
|
16303
16332
|
getMove(event, config) {
|
|
@@ -16307,7 +16336,7 @@ const WheelEventHelper = {
|
|
|
16307
16336
|
deltaX = deltaY;
|
|
16308
16337
|
deltaY = 0;
|
|
16309
16338
|
}
|
|
16310
|
-
const absX = abs$
|
|
16339
|
+
const absX = abs$3(deltaX), absY = abs$3(deltaY);
|
|
16311
16340
|
if (absX > 50) deltaX = max$1(50, absX / 3) * sign(deltaX);
|
|
16312
16341
|
if (absY > 50) deltaY = max$1(50, absY / 3) * sign(deltaY);
|
|
16313
16342
|
return {
|
|
@@ -16329,7 +16358,7 @@ const WheelEventHelper = {
|
|
|
16329
16358
|
if (zoom) {
|
|
16330
16359
|
zoomSpeed = within$2(zoomSpeed, 0, 1);
|
|
16331
16360
|
const min = event.deltaY ? config.delta.y : config.delta.x;
|
|
16332
|
-
const absScale = within$2(1 - abs$
|
|
16361
|
+
const absScale = within$2(1 - abs$3(delta) / (min * 4) * zoomSpeed, .5, 2);
|
|
16333
16362
|
scale = delta > 0 ? absScale : 1 / absScale;
|
|
16334
16363
|
}
|
|
16335
16364
|
return scale;
|
|
@@ -16568,7 +16597,7 @@ interaction.multiTouch = function(data, list) {
|
|
|
16568
16597
|
|
|
16569
16598
|
const dragger = Dragger.prototype;
|
|
16570
16599
|
|
|
16571
|
-
const {abs: abs$
|
|
16600
|
+
const {abs: abs$2, min: min, max: max, hypot: hypot} = Math;
|
|
16572
16601
|
|
|
16573
16602
|
dragger.checkDragEndAnimate = function(data) {
|
|
16574
16603
|
const {interaction: interaction} = this;
|
|
@@ -16597,7 +16626,7 @@ dragger.checkDragEndAnimate = function(data) {
|
|
|
16597
16626
|
moveX *= boost;
|
|
16598
16627
|
moveY *= boost;
|
|
16599
16628
|
}
|
|
16600
|
-
const maxAbs = max(abs$
|
|
16629
|
+
const maxAbs = max(abs$2(moveX), abs$2(moveY));
|
|
16601
16630
|
if (maxAbs > maxMove) {
|
|
16602
16631
|
s = maxMove / maxAbs;
|
|
16603
16632
|
moveX *= s;
|
|
@@ -16607,7 +16636,7 @@ dragger.checkDragEndAnimate = function(data) {
|
|
|
16607
16636
|
moveX *= inertia;
|
|
16608
16637
|
moveY *= inertia;
|
|
16609
16638
|
data = Object.assign({}, data);
|
|
16610
|
-
if (abs$
|
|
16639
|
+
if (abs$2(moveX) < stopMove && abs$2(moveY) < stopMove) return this.dragEndReal(data);
|
|
16611
16640
|
PointHelper.move(data, moveX, moveY);
|
|
16612
16641
|
this.drag(data);
|
|
16613
16642
|
this.animate(step);
|
|
@@ -17336,7 +17365,7 @@ function getArrowPath(ui, arrow, from, to, size, connectOffset, hasDashPattern)
|
|
|
17336
17365
|
|
|
17337
17366
|
const {M: M$2, L: L$2, C: C$2, Q: Q, Z: Z$2, N: N, D: D, X: X, G: G, F: F, O: O, P: P, U: U} = PathCommandMap;
|
|
17338
17367
|
|
|
17339
|
-
const {copy: copy, copyFrom: copyFrom, getDistancePoint: getDistancePoint, isSame: isSame} = PointHelper;
|
|
17368
|
+
const {copy: copy, copyFrom: copyFrom, getDistancePoint: getDistancePoint, isSame: isSame$1} = PointHelper;
|
|
17340
17369
|
|
|
17341
17370
|
const {stintSet: stintSet$1} = DataHelper;
|
|
17342
17371
|
|
|
@@ -17430,7 +17459,7 @@ const PathArrowModule = {
|
|
|
17430
17459
|
}
|
|
17431
17460
|
count++;
|
|
17432
17461
|
if (count === 1 && command !== M$2) return;
|
|
17433
|
-
if (count === 2 && useStartArrow) copy(second, command === L$2 ? now : isSame(old, first) ? last : old);
|
|
17462
|
+
if (count === 2 && useStartArrow) copy(second, command === L$2 ? now : isSame$1(old, first) ? last : old);
|
|
17434
17463
|
if (i === len) {
|
|
17435
17464
|
const path = uData.__pathForRender = clonePathForArrow ? [ ...data ] : data;
|
|
17436
17465
|
if (useStartArrow) {
|
|
@@ -17444,7 +17473,7 @@ const PathArrowModule = {
|
|
|
17444
17473
|
}
|
|
17445
17474
|
}
|
|
17446
17475
|
if (endArrow && endArrow !== "none") {
|
|
17447
|
-
if (isSame(last, now)) copy(last, old);
|
|
17476
|
+
if (isSame$1(last, now)) copy(last, old);
|
|
17448
17477
|
endArrowPath = getArrowPath(ui, endArrow, last, now, strokeWidth, connectPoint, !!dashPattern);
|
|
17449
17478
|
singleEndArrow = endArrowPath.fill || dashPattern;
|
|
17450
17479
|
if (!singleEndArrow) path.push(...endArrowPath.data);
|
|
@@ -18060,7 +18089,7 @@ box$1.__updateBoxBounds = function(secondLayout) {
|
|
|
18060
18089
|
}
|
|
18061
18090
|
};
|
|
18062
18091
|
|
|
18063
|
-
const {cos: cos, sin: sin, pow: pow, sqrt: sqrt$1, abs: abs, ceil: ceil, floor: floor, round: round$2, PI: PI} = Math;
|
|
18092
|
+
const {cos: cos, sin: sin, pow: pow, sqrt: sqrt$1, abs: abs$1, ceil: ceil, floor: floor, round: round$2, PI: PI} = Math;
|
|
18064
18093
|
|
|
18065
18094
|
const PIx5 = PI * 5;
|
|
18066
18095
|
|
|
@@ -18098,7 +18127,7 @@ function cubicBezier(x1, y1, x2, y2) {
|
|
|
18098
18127
|
o = 1 - v;
|
|
18099
18128
|
x = bezier(v, x1, x2) - t;
|
|
18100
18129
|
dx = 3 * o * o * x1 + 6 * o * v * (x2 - x1) + 3 * v * v * (1 - x2);
|
|
18101
|
-
if (abs(dx) < 1e-6) break;
|
|
18130
|
+
if (abs$1(dx) < 1e-6) break;
|
|
18102
18131
|
v -= x / dx;
|
|
18103
18132
|
}
|
|
18104
18133
|
return cache[key] = bezier(v, y1, y2);
|
|
@@ -20957,7 +20986,7 @@ function getCorrectT(d, x, y, x1, y1, x2, y2, toX, toY) {
|
|
|
20957
20986
|
return Math.max(0, Math.min(.5, t));
|
|
20958
20987
|
}
|
|
20959
20988
|
|
|
20960
|
-
const {M: M, L: L, C: C, Z: Z} = PathCommandMap;
|
|
20989
|
+
const {M: M, L: L, C: C, Z: Z} = PathCommandMap, {abs: abs} = Math;
|
|
20961
20990
|
|
|
20962
20991
|
const {getCenterX: getCenterX, getCenterY: getCenterY} = PointHelper;
|
|
20963
20992
|
|
|
@@ -20965,7 +20994,7 @@ const {arcTo: arcTo} = PathCommandDataHelper;
|
|
|
20965
20994
|
|
|
20966
20995
|
PathCorner.smooth = function smooth(data, cornerRadius, _cornerSmoothing) {
|
|
20967
20996
|
const radius = data.radius;
|
|
20968
|
-
if (isNeedConvert(data)) data = PathConvert.toCanvasData(data, true);
|
|
20997
|
+
if (isNeedConvert(data)) data = PathConvert.toCanvasData(data, true); else data = [ ...data ];
|
|
20969
20998
|
let command, lastCommand, commandLen;
|
|
20970
20999
|
let i = 0, countCommand = 0, x = 0, y = 0, startX = 0, startY = 0, startR = 0, secondX = 0, secondY = 0, lastX = 0, lastY = 0, r, x1, y1, x2, y2, toX, toY;
|
|
20971
21000
|
if (isArray(cornerRadius)) cornerRadius = cornerRadius[0] || 0;
|
|
@@ -21051,6 +21080,9 @@ PathCorner.smooth = function smooth(data, cornerRadius, _cornerSmoothing) {
|
|
|
21051
21080
|
toX = startX, toY = startY;
|
|
21052
21081
|
setBeforeC(smooth, r, lastX, lastY, x1, y1, x2, y2, x, y, toX, toY, three);
|
|
21053
21082
|
break;
|
|
21083
|
+
|
|
21084
|
+
default:
|
|
21085
|
+
smooth.push(C, x1, y1, x2, y2, x, y);
|
|
21054
21086
|
}
|
|
21055
21087
|
lastX = x;
|
|
21056
21088
|
lastY = y;
|
|
@@ -21140,7 +21172,16 @@ function findEndPoint(data, i) {
|
|
|
21140
21172
|
}
|
|
21141
21173
|
|
|
21142
21174
|
function setAfterC(data, i, cornerRadius, lastX, lastY, fromX, fromY, x1, y1, x2, y2, toX, toY) {
|
|
21143
|
-
|
|
21175
|
+
let targetX = x1, targetY = y1;
|
|
21176
|
+
if (isSame(x1, fromX) && isSame(y1, fromY)) {
|
|
21177
|
+
targetX = x2;
|
|
21178
|
+
targetY = y2;
|
|
21179
|
+
if (isSame(x2, fromX) && isSame(y2, fromY)) {
|
|
21180
|
+
targetX = toX;
|
|
21181
|
+
targetY = toY;
|
|
21182
|
+
}
|
|
21183
|
+
}
|
|
21184
|
+
const d = getTangentDistance(cornerRadius, fromX, fromY, lastX, lastY, targetX, targetY);
|
|
21144
21185
|
const t = getCorrectT(d, fromX, fromY, x1, y1, x2, y2, toX, toY);
|
|
21145
21186
|
const two = BezierHelper.cut(t, fromX, fromY, x1, y1, x2, y2, toX, toY);
|
|
21146
21187
|
const {left: left, right: right} = two;
|
|
@@ -21154,7 +21195,16 @@ function setAfterC(data, i, cornerRadius, lastX, lastY, fromX, fromY, x1, y1, x2
|
|
|
21154
21195
|
}
|
|
21155
21196
|
|
|
21156
21197
|
function setBeforeC(smooth, cornerRadius, fromX, fromY, x1, y1, x2, y2, toX, toY, nextX, nextY, three) {
|
|
21157
|
-
|
|
21198
|
+
let targetX = x2, targetY = y2;
|
|
21199
|
+
if (isSame(targetX, toX) && isSame(targetY, toY)) {
|
|
21200
|
+
targetX = x1;
|
|
21201
|
+
targetY = y1;
|
|
21202
|
+
if (isSame(targetX, toX) && isSame(targetY, toY)) {
|
|
21203
|
+
targetX = fromX;
|
|
21204
|
+
targetY = fromY;
|
|
21205
|
+
}
|
|
21206
|
+
}
|
|
21207
|
+
const d = getTangentDistance(cornerRadius, toX, toY, targetX, targetY, nextX, nextY);
|
|
21158
21208
|
const t = getCorrectT(d, toX, toY, x2, y2, x1, y1, fromX, fromY);
|
|
21159
21209
|
const {left: left, right: right} = BezierHelper.cut(1 - t, fromX, fromY, x1, y1, x2, y2, toX, toY);
|
|
21160
21210
|
if (left && right) {
|
|
@@ -21165,6 +21215,10 @@ function setBeforeC(smooth, cornerRadius, fromX, fromY, x1, y1, x2, y2, toX, toY
|
|
|
21165
21215
|
}
|
|
21166
21216
|
}
|
|
21167
21217
|
|
|
21218
|
+
function isSame(a, b) {
|
|
21219
|
+
return abs(a - b) < .01;
|
|
21220
|
+
}
|
|
21221
|
+
|
|
21168
21222
|
Plugin.add("corner");
|
|
21169
21223
|
|
|
21170
21224
|
export { AlignHelper, Animate, AnimateEasing, AnimateEvent, AnimateList, Answer, App, AroundHelper, Arrow, ArrowData, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, DragEvent, Dragger, DropEvent, EditBox, EditDataHelper, EditPoint, EditSelect, EditSelectHelper, EditTool, EditToolCreator, Editor, EditorEvent, EditorGroupEvent, EditorHelper, EditorMoveEvent, EditorRotateEvent, EditorScaleEvent, EditorSkewEvent, Effect, Ellipse, EllipseBox, EllipseBoxData, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Finder, Flow, FourNumberHelper, Frame, FrameData, Group, GroupData, HTMLText, HTMLTextData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image, ImageBox, ImageBoxData, ImageData, ImageEvent, ImageManager, IncrementId, InnerEditor, InnerEditorEvent, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferFilm, LeaferImage, LeaferTypeCreator, LeaferVideo, Line, LineData, LineEditTool, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, MyDragEvent, MyImage, MyPointerEvent, MyTouchEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathArrowModule, PathBounds, PathBox, PathBoxData, PathCommandDataHelper, PathCommandMap, PathCommandNodeHelper, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathMatrixHelper, PathNodeHandleType, PathNumberCommandLengthMap, PathNumberCommandMap, PathScaler, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonBox, PolygonBoxData, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Robot, RobotData, RotateEvent, Run, ScrollBar, Scroller, SelectArea, Selector, Star, StarBox, StarBoxData, StarData, State, StringNumberMap, Stroker, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TextEditor, TouchEvent, TransformTool, Transformer, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, UnitConvertHelper, WaitHelper, WatchEvent, Watcher, WheelEventHelper, ZoomEvent, addViewport, addViewportConfig, affectRenderBoundsType, affectStrokeBoundsType, arrowType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createAttr, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, dimType, doBoundsType, doStrokeType, effectType, emptyData, eraserType, extraPropertyEventMap, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isArray, isData, isEmptyData, isFinite$1 as isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, motionPathType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerEditTool, registerInnerEditor, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleResize, scaleResizeFontSize, scaleResizeGroup, scaleResizePath, scaleResizePoints, scaleType, scrollType, sortType, stateStyleType, stateType, strokeType, surfaceType, tempBounds$3 as tempBounds, tempMatrix$2 as tempMatrix, tempPoint$4 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
|