@leafer/worker 2.0.7 → 2.0.8
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 +64 -40
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +65 -40
- 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.8";
|
|
7083
7083
|
|
|
7084
7084
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
7085
7085
|
get allowBackgroundColor() {
|
|
@@ -10093,7 +10093,7 @@ class UIEvent extends Event {
|
|
|
10093
10093
|
}
|
|
10094
10094
|
}
|
|
10095
10095
|
|
|
10096
|
-
const {min: min$1, max: max$3, abs: abs$
|
|
10096
|
+
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
10097
|
|
|
10098
10098
|
const tempContent = new Bounds, tempDragBounds = new Bounds;
|
|
10099
10099
|
|
|
@@ -10170,7 +10170,7 @@ const DragBoundsHelper = {
|
|
|
10170
10170
|
bScale = originBottomScale && bSize > 0 ? 1 + bSize / (originBottomScale * tempContent.height) : 1;
|
|
10171
10171
|
correctScaleY *= max$3(aScale, bScale);
|
|
10172
10172
|
if (lockRatio) {
|
|
10173
|
-
aScale = max$3(abs$
|
|
10173
|
+
aScale = max$3(abs$8(correctScaleX), abs$8(correctScaleY));
|
|
10174
10174
|
correctScaleX = sign$2(correctScaleX) * aScale;
|
|
10175
10175
|
correctScaleY = sign$2(correctScaleY) * aScale;
|
|
10176
10176
|
}
|
|
@@ -11771,12 +11771,12 @@ const PaintModule = {
|
|
|
11771
11771
|
|
|
11772
11772
|
let cache$1, box$2 = new Bounds;
|
|
11773
11773
|
|
|
11774
|
-
const {isSame: isSame$
|
|
11774
|
+
const {isSame: isSame$2} = BoundsHelper;
|
|
11775
11775
|
|
|
11776
11776
|
function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
11777
11777
|
let leafPaint, event;
|
|
11778
11778
|
const image = ImageManager.get(paint, paint.type);
|
|
11779
|
-
if (cache$1 && paint === cache$1.paint && isSame$
|
|
11779
|
+
if (cache$1 && paint === cache$1.paint && isSame$2(boxBounds, cache$1.boxBounds)) {
|
|
11780
11780
|
leafPaint = cache$1.leafPaint;
|
|
11781
11781
|
} else {
|
|
11782
11782
|
leafPaint = {
|
|
@@ -12067,7 +12067,7 @@ function layout$3(transform, box, x, y, scaleX, scaleY, rotation, skew) {
|
|
|
12067
12067
|
|
|
12068
12068
|
const {get: get$1, scale: scale$2, copy: copy$4} = MatrixHelper;
|
|
12069
12069
|
|
|
12070
|
-
const {getFloorScale: getFloorScale} = MathHelper, {abs: abs$
|
|
12070
|
+
const {getFloorScale: getFloorScale} = MathHelper, {abs: abs$7} = Math;
|
|
12071
12071
|
|
|
12072
12072
|
function createPatternTask(paint, ui, canvas, renderOptions) {
|
|
12073
12073
|
if (!paint.patternTask) {
|
|
@@ -12091,8 +12091,8 @@ function createPattern(paint, ui, canvas, renderOptions) {
|
|
|
12091
12091
|
width *= scaleX;
|
|
12092
12092
|
height *= scaleY;
|
|
12093
12093
|
if (gap) {
|
|
12094
|
-
xGap = gap.x * scaleX / abs$
|
|
12095
|
-
yGap = gap.y * scaleY / abs$
|
|
12094
|
+
xGap = gap.x * scaleX / abs$7(data.scaleX || 1);
|
|
12095
|
+
yGap = gap.y * scaleY / abs$7(data.scaleY || 1);
|
|
12096
12096
|
}
|
|
12097
12097
|
if (transform || scaleX !== 1 || scaleY !== 1) {
|
|
12098
12098
|
scaleX *= getFloorScale(width + (xGap || 0));
|
|
@@ -12329,7 +12329,7 @@ const PaintGradientModule = {
|
|
|
12329
12329
|
getTransform: getTransform
|
|
12330
12330
|
};
|
|
12331
12331
|
|
|
12332
|
-
const {copy: copy$3, move: move$6, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max$2, abs: abs$
|
|
12332
|
+
const {copy: copy$3, move: move$6, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max$2, abs: abs$6} = Math;
|
|
12333
12333
|
|
|
12334
12334
|
const tempBounds$1 = {}, tempMatrix = new Matrix;
|
|
12335
12335
|
|
|
@@ -12373,7 +12373,7 @@ function shadow$1(ui, current, shape) {
|
|
|
12373
12373
|
function getShadowRenderSpread(_ui, shadow) {
|
|
12374
12374
|
let top = 0, right = 0, bottom = 0, left = 0, x, y, spread, blur;
|
|
12375
12375
|
shadow.forEach(item => {
|
|
12376
|
-
x = item.x || 0, y = item.y || 0, blur = (item.blur || 0) * 1.5, spread = abs$
|
|
12376
|
+
x = item.x || 0, y = item.y || 0, blur = (item.blur || 0) * 1.5, spread = abs$6(item.spread || 0);
|
|
12377
12377
|
top = max$2(top, spread + blur - y);
|
|
12378
12378
|
right = max$2(right, spread + blur + x);
|
|
12379
12379
|
bottom = max$2(bottom, spread + blur + y);
|
|
@@ -13208,7 +13208,7 @@ function mergeConfigAttr() {
|
|
|
13208
13208
|
};
|
|
13209
13209
|
}
|
|
13210
13210
|
|
|
13211
|
-
const {abs: abs$
|
|
13211
|
+
const {abs: abs$5} = Math;
|
|
13212
13212
|
|
|
13213
13213
|
const {copy: copy$2} = MatrixHelper;
|
|
13214
13214
|
|
|
@@ -13251,7 +13251,7 @@ class Stroker extends UI {
|
|
|
13251
13251
|
leaf = list[i];
|
|
13252
13252
|
const {worldTransform: worldTransform, worldRenderBounds: worldRenderBounds} = leaf;
|
|
13253
13253
|
if (worldRenderBounds.width && worldRenderBounds.height && (!bounds || bounds.hit(worldRenderBounds, options.matrix))) {
|
|
13254
|
-
const aScaleX = abs$
|
|
13254
|
+
const aScaleX = abs$5(worldTransform.scaleX), aScaleY = abs$5(worldTransform.scaleY);
|
|
13255
13255
|
copy$2(matrix$1, worldTransform);
|
|
13256
13256
|
matrix$1.half = strokeWidth % 2;
|
|
13257
13257
|
canvas.setWorld(matrix$1, options.matrix);
|
|
@@ -13564,7 +13564,7 @@ class EditSelect extends Group {
|
|
|
13564
13564
|
|
|
13565
13565
|
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
13566
|
|
|
13567
|
-
const {toPoint: toPoint} = AroundHelper, {within: within$3, sign: sign$1} = MathHelper, {abs: abs$
|
|
13567
|
+
const {toPoint: toPoint} = AroundHelper, {within: within$3, sign: sign$1} = MathHelper, {abs: abs$4} = Math;
|
|
13568
13568
|
|
|
13569
13569
|
const EditDataHelper = {
|
|
13570
13570
|
getScaleData(target, startBounds, direction, totalMoveOrScale, lockRatio, around, flipable, scaleMode) {
|
|
@@ -13650,7 +13650,7 @@ const EditDataHelper = {
|
|
|
13650
13650
|
break;
|
|
13651
13651
|
|
|
13652
13652
|
default:
|
|
13653
|
-
lockScale = Math.sqrt(abs$
|
|
13653
|
+
lockScale = Math.sqrt(abs$4(scaleX * scaleY));
|
|
13654
13654
|
scaleX = sign$1(scaleX) * lockScale;
|
|
13655
13655
|
scaleY = sign$1(scaleY) * lockScale;
|
|
13656
13656
|
}
|
|
@@ -13683,10 +13683,10 @@ const EditDataHelper = {
|
|
|
13683
13683
|
const nowHeight = boxBounds.height * target.scaleY;
|
|
13684
13684
|
scaleY = within$3(nowHeight * scaleY, heightRange) / nowHeight;
|
|
13685
13685
|
}
|
|
13686
|
-
if (useScaleX && abs$
|
|
13687
|
-
if (useScaleY && abs$
|
|
13686
|
+
if (useScaleX && abs$4(scaleX * worldBoxBounds.width) < 1) scaleX = sign$1(scaleX) / worldBoxBounds.width;
|
|
13687
|
+
if (useScaleY && abs$4(scaleY * worldBoxBounds.height) < 1) scaleY = sign$1(scaleY) / worldBoxBounds.height;
|
|
13688
13688
|
if (lockRatio && scaleX !== scaleY) {
|
|
13689
|
-
lockScale = Math.min(abs$
|
|
13689
|
+
lockScale = Math.min(abs$4(scaleX), abs$4(scaleY));
|
|
13690
13690
|
scaleX = sign$1(scaleX) * lockScale;
|
|
13691
13691
|
scaleY = sign$1(scaleY) * lockScale;
|
|
13692
13692
|
}
|
|
@@ -16297,7 +16297,7 @@ const MultiTouchHelper = {
|
|
|
16297
16297
|
|
|
16298
16298
|
const M$4 = MultiTouchHelper;
|
|
16299
16299
|
|
|
16300
|
-
const {abs: abs$
|
|
16300
|
+
const {abs: abs$3, max: max$1} = Math, {sign: sign, within: within$2} = MathHelper;
|
|
16301
16301
|
|
|
16302
16302
|
const WheelEventHelper = {
|
|
16303
16303
|
getMove(event, config) {
|
|
@@ -16307,7 +16307,7 @@ const WheelEventHelper = {
|
|
|
16307
16307
|
deltaX = deltaY;
|
|
16308
16308
|
deltaY = 0;
|
|
16309
16309
|
}
|
|
16310
|
-
const absX = abs$
|
|
16310
|
+
const absX = abs$3(deltaX), absY = abs$3(deltaY);
|
|
16311
16311
|
if (absX > 50) deltaX = max$1(50, absX / 3) * sign(deltaX);
|
|
16312
16312
|
if (absY > 50) deltaY = max$1(50, absY / 3) * sign(deltaY);
|
|
16313
16313
|
return {
|
|
@@ -16329,7 +16329,7 @@ const WheelEventHelper = {
|
|
|
16329
16329
|
if (zoom) {
|
|
16330
16330
|
zoomSpeed = within$2(zoomSpeed, 0, 1);
|
|
16331
16331
|
const min = event.deltaY ? config.delta.y : config.delta.x;
|
|
16332
|
-
const absScale = within$2(1 - abs$
|
|
16332
|
+
const absScale = within$2(1 - abs$3(delta) / (min * 4) * zoomSpeed, .5, 2);
|
|
16333
16333
|
scale = delta > 0 ? absScale : 1 / absScale;
|
|
16334
16334
|
}
|
|
16335
16335
|
return scale;
|
|
@@ -16568,7 +16568,7 @@ interaction.multiTouch = function(data, list) {
|
|
|
16568
16568
|
|
|
16569
16569
|
const dragger = Dragger.prototype;
|
|
16570
16570
|
|
|
16571
|
-
const {abs: abs$
|
|
16571
|
+
const {abs: abs$2, min: min, max: max, hypot: hypot} = Math;
|
|
16572
16572
|
|
|
16573
16573
|
dragger.checkDragEndAnimate = function(data) {
|
|
16574
16574
|
const {interaction: interaction} = this;
|
|
@@ -16597,7 +16597,7 @@ dragger.checkDragEndAnimate = function(data) {
|
|
|
16597
16597
|
moveX *= boost;
|
|
16598
16598
|
moveY *= boost;
|
|
16599
16599
|
}
|
|
16600
|
-
const maxAbs = max(abs$
|
|
16600
|
+
const maxAbs = max(abs$2(moveX), abs$2(moveY));
|
|
16601
16601
|
if (maxAbs > maxMove) {
|
|
16602
16602
|
s = maxMove / maxAbs;
|
|
16603
16603
|
moveX *= s;
|
|
@@ -16607,7 +16607,7 @@ dragger.checkDragEndAnimate = function(data) {
|
|
|
16607
16607
|
moveX *= inertia;
|
|
16608
16608
|
moveY *= inertia;
|
|
16609
16609
|
data = Object.assign({}, data);
|
|
16610
|
-
if (abs$
|
|
16610
|
+
if (abs$2(moveX) < stopMove && abs$2(moveY) < stopMove) return this.dragEndReal(data);
|
|
16611
16611
|
PointHelper.move(data, moveX, moveY);
|
|
16612
16612
|
this.drag(data);
|
|
16613
16613
|
this.animate(step);
|
|
@@ -17336,7 +17336,7 @@ function getArrowPath(ui, arrow, from, to, size, connectOffset, hasDashPattern)
|
|
|
17336
17336
|
|
|
17337
17337
|
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
17338
|
|
|
17339
|
-
const {copy: copy, copyFrom: copyFrom, getDistancePoint: getDistancePoint, isSame: isSame} = PointHelper;
|
|
17339
|
+
const {copy: copy, copyFrom: copyFrom, getDistancePoint: getDistancePoint, isSame: isSame$1} = PointHelper;
|
|
17340
17340
|
|
|
17341
17341
|
const {stintSet: stintSet$1} = DataHelper;
|
|
17342
17342
|
|
|
@@ -17430,7 +17430,7 @@ const PathArrowModule = {
|
|
|
17430
17430
|
}
|
|
17431
17431
|
count++;
|
|
17432
17432
|
if (count === 1 && command !== M$2) return;
|
|
17433
|
-
if (count === 2 && useStartArrow) copy(second, command === L$2 ? now : isSame(old, first) ? last : old);
|
|
17433
|
+
if (count === 2 && useStartArrow) copy(second, command === L$2 ? now : isSame$1(old, first) ? last : old);
|
|
17434
17434
|
if (i === len) {
|
|
17435
17435
|
const path = uData.__pathForRender = clonePathForArrow ? [ ...data ] : data;
|
|
17436
17436
|
if (useStartArrow) {
|
|
@@ -17444,7 +17444,7 @@ const PathArrowModule = {
|
|
|
17444
17444
|
}
|
|
17445
17445
|
}
|
|
17446
17446
|
if (endArrow && endArrow !== "none") {
|
|
17447
|
-
if (isSame(last, now)) copy(last, old);
|
|
17447
|
+
if (isSame$1(last, now)) copy(last, old);
|
|
17448
17448
|
endArrowPath = getArrowPath(ui, endArrow, last, now, strokeWidth, connectPoint, !!dashPattern);
|
|
17449
17449
|
singleEndArrow = endArrowPath.fill || dashPattern;
|
|
17450
17450
|
if (!singleEndArrow) path.push(...endArrowPath.data);
|
|
@@ -18060,7 +18060,7 @@ box$1.__updateBoxBounds = function(secondLayout) {
|
|
|
18060
18060
|
}
|
|
18061
18061
|
};
|
|
18062
18062
|
|
|
18063
|
-
const {cos: cos, sin: sin, pow: pow, sqrt: sqrt$1, abs: abs, ceil: ceil, floor: floor, round: round$2, PI: PI} = Math;
|
|
18063
|
+
const {cos: cos, sin: sin, pow: pow, sqrt: sqrt$1, abs: abs$1, ceil: ceil, floor: floor, round: round$2, PI: PI} = Math;
|
|
18064
18064
|
|
|
18065
18065
|
const PIx5 = PI * 5;
|
|
18066
18066
|
|
|
@@ -18098,7 +18098,7 @@ function cubicBezier(x1, y1, x2, y2) {
|
|
|
18098
18098
|
o = 1 - v;
|
|
18099
18099
|
x = bezier(v, x1, x2) - t;
|
|
18100
18100
|
dx = 3 * o * o * x1 + 6 * o * v * (x2 - x1) + 3 * v * v * (1 - x2);
|
|
18101
|
-
if (abs(dx) < 1e-6) break;
|
|
18101
|
+
if (abs$1(dx) < 1e-6) break;
|
|
18102
18102
|
v -= x / dx;
|
|
18103
18103
|
}
|
|
18104
18104
|
return cache[key] = bezier(v, y1, y2);
|
|
@@ -20957,7 +20957,7 @@ function getCorrectT(d, x, y, x1, y1, x2, y2, toX, toY) {
|
|
|
20957
20957
|
return Math.max(0, Math.min(.5, t));
|
|
20958
20958
|
}
|
|
20959
20959
|
|
|
20960
|
-
const {M: M, L: L, C: C, Z: Z} = PathCommandMap;
|
|
20960
|
+
const {M: M, L: L, C: C, Z: Z} = PathCommandMap, {abs: abs} = Math;
|
|
20961
20961
|
|
|
20962
20962
|
const {getCenterX: getCenterX, getCenterY: getCenterY} = PointHelper;
|
|
20963
20963
|
|
|
@@ -20965,7 +20965,7 @@ const {arcTo: arcTo} = PathCommandDataHelper;
|
|
|
20965
20965
|
|
|
20966
20966
|
PathCorner.smooth = function smooth(data, cornerRadius, _cornerSmoothing) {
|
|
20967
20967
|
const radius = data.radius;
|
|
20968
|
-
if (isNeedConvert(data)) data = PathConvert.toCanvasData(data, true);
|
|
20968
|
+
if (isNeedConvert(data)) data = PathConvert.toCanvasData(data, true); else data = [ ...data ];
|
|
20969
20969
|
let command, lastCommand, commandLen;
|
|
20970
20970
|
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
20971
|
if (isArray(cornerRadius)) cornerRadius = cornerRadius[0] || 0;
|
|
@@ -21051,6 +21051,9 @@ PathCorner.smooth = function smooth(data, cornerRadius, _cornerSmoothing) {
|
|
|
21051
21051
|
toX = startX, toY = startY;
|
|
21052
21052
|
setBeforeC(smooth, r, lastX, lastY, x1, y1, x2, y2, x, y, toX, toY, three);
|
|
21053
21053
|
break;
|
|
21054
|
+
|
|
21055
|
+
default:
|
|
21056
|
+
smooth.push(C, x1, y1, x2, y2, x, y);
|
|
21054
21057
|
}
|
|
21055
21058
|
lastX = x;
|
|
21056
21059
|
lastY = y;
|
|
@@ -21140,7 +21143,16 @@ function findEndPoint(data, i) {
|
|
|
21140
21143
|
}
|
|
21141
21144
|
|
|
21142
21145
|
function setAfterC(data, i, cornerRadius, lastX, lastY, fromX, fromY, x1, y1, x2, y2, toX, toY) {
|
|
21143
|
-
|
|
21146
|
+
let targetX = x1, targetY = y1;
|
|
21147
|
+
if (isSame(x1, fromX) && isSame(y1, fromY)) {
|
|
21148
|
+
targetX = x2;
|
|
21149
|
+
targetY = y2;
|
|
21150
|
+
if (isSame(x2, fromX) && isSame(y2, fromY)) {
|
|
21151
|
+
targetX = toX;
|
|
21152
|
+
targetY = toY;
|
|
21153
|
+
}
|
|
21154
|
+
}
|
|
21155
|
+
const d = getTangentDistance(cornerRadius, fromX, fromY, lastX, lastY, targetX, targetY);
|
|
21144
21156
|
const t = getCorrectT(d, fromX, fromY, x1, y1, x2, y2, toX, toY);
|
|
21145
21157
|
const two = BezierHelper.cut(t, fromX, fromY, x1, y1, x2, y2, toX, toY);
|
|
21146
21158
|
const {left: left, right: right} = two;
|
|
@@ -21154,7 +21166,16 @@ function setAfterC(data, i, cornerRadius, lastX, lastY, fromX, fromY, x1, y1, x2
|
|
|
21154
21166
|
}
|
|
21155
21167
|
|
|
21156
21168
|
function setBeforeC(smooth, cornerRadius, fromX, fromY, x1, y1, x2, y2, toX, toY, nextX, nextY, three) {
|
|
21157
|
-
|
|
21169
|
+
let targetX = x2, targetY = y2;
|
|
21170
|
+
if (isSame(targetX, toX) && isSame(targetY, toY)) {
|
|
21171
|
+
targetX = x1;
|
|
21172
|
+
targetY = y1;
|
|
21173
|
+
if (isSame(targetX, toX) && isSame(targetY, toY)) {
|
|
21174
|
+
targetX = fromX;
|
|
21175
|
+
targetY = fromY;
|
|
21176
|
+
}
|
|
21177
|
+
}
|
|
21178
|
+
const d = getTangentDistance(cornerRadius, toX, toY, targetX, targetY, nextX, nextY);
|
|
21158
21179
|
const t = getCorrectT(d, toX, toY, x2, y2, x1, y1, fromX, fromY);
|
|
21159
21180
|
const {left: left, right: right} = BezierHelper.cut(1 - t, fromX, fromY, x1, y1, x2, y2, toX, toY);
|
|
21160
21181
|
if (left && right) {
|
|
@@ -21165,6 +21186,10 @@ function setBeforeC(smooth, cornerRadius, fromX, fromY, x1, y1, x2, y2, toX, toY
|
|
|
21165
21186
|
}
|
|
21166
21187
|
}
|
|
21167
21188
|
|
|
21189
|
+
function isSame(a, b) {
|
|
21190
|
+
return abs(a - b) < .01;
|
|
21191
|
+
}
|
|
21192
|
+
|
|
21168
21193
|
Plugin.add("corner");
|
|
21169
21194
|
|
|
21170
21195
|
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 };
|