@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.js
CHANGED
|
@@ -730,7 +730,7 @@ var LeaferUI = function(exports) {
|
|
|
730
730
|
const M$c = MatrixHelper;
|
|
731
731
|
const {float: float$5} = MathHelper;
|
|
732
732
|
const {toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$3} = MatrixHelper;
|
|
733
|
-
const {sin: sin$5, cos: cos$5, abs: abs$
|
|
733
|
+
const {sin: sin$5, cos: cos$5, abs: abs$b, sqrt: sqrt$4, atan2: atan2$2, min: min$3, round: round$5} = Math;
|
|
734
734
|
const PointHelper = {
|
|
735
735
|
defaultPoint: getPointData(),
|
|
736
736
|
tempPoint: {},
|
|
@@ -827,8 +827,8 @@ var LeaferUI = function(exports) {
|
|
|
827
827
|
return getDistanceFrom(t.x, t.y, point.x, point.y);
|
|
828
828
|
},
|
|
829
829
|
getDistanceFrom(x1, y1, x2, y2) {
|
|
830
|
-
const x = abs$
|
|
831
|
-
const y = abs$
|
|
830
|
+
const x = abs$b(x2 - x1);
|
|
831
|
+
const y = abs$b(y2 - y1);
|
|
832
832
|
return sqrt$4(x * x + y * y);
|
|
833
833
|
},
|
|
834
834
|
getMinDistanceFrom(x1, y1, x2, y2, x3, y3) {
|
|
@@ -2518,7 +2518,7 @@ var LeaferUI = function(exports) {
|
|
|
2518
2518
|
data[0] ? drawer.arcTo(x, y, right, y, data[0]) : drawer.lineTo(x, y);
|
|
2519
2519
|
}
|
|
2520
2520
|
};
|
|
2521
|
-
const {sin: sin$4, cos: cos$4, hypot: hypot$1, atan2: atan2$1, ceil: ceil$1, abs: abs$
|
|
2521
|
+
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;
|
|
2522
2522
|
const {setPoint: setPoint$4, addPoint: addPoint$2} = TwoPointBoundsHelper;
|
|
2523
2523
|
const {set: set$1, toNumberPoints: toNumberPoints$1} = PointHelper;
|
|
2524
2524
|
const {M: M$b, L: L$b, C: C$9, Q: Q$7, Z: Z$9} = PathCommandMap;
|
|
@@ -2590,7 +2590,7 @@ var LeaferUI = function(exports) {
|
|
|
2590
2590
|
const lenCB = hypot$1(CBx, CBy);
|
|
2591
2591
|
let totalRadian = endRadian - startRadian;
|
|
2592
2592
|
if (totalRadian < 0) totalRadian += PI2;
|
|
2593
|
-
if (lenBA < 1e-12 || lenCB < 1e-12 || totalRadian < 1e-12 || abs$
|
|
2593
|
+
if (lenBA < 1e-12 || lenCB < 1e-12 || totalRadian < 1e-12 || abs$a(totalRadian - PI$3) < 1e-12) {
|
|
2594
2594
|
if (data) data.push(L$b, x1, y1);
|
|
2595
2595
|
if (setPointBounds) {
|
|
2596
2596
|
setPoint$4(setPointBounds, fromX, fromY);
|
|
@@ -2623,7 +2623,7 @@ var LeaferUI = function(exports) {
|
|
|
2623
2623
|
let totalRadian = endRadian - startRadian;
|
|
2624
2624
|
if (totalRadian < 0) totalRadian += PI2; else if (totalRadian > PI2) totalRadian -= PI2;
|
|
2625
2625
|
if (anticlockwise) totalRadian -= PI2;
|
|
2626
|
-
const parts = ceil$1(abs$
|
|
2626
|
+
const parts = ceil$1(abs$a(totalRadian / PI_2));
|
|
2627
2627
|
const partRadian = totalRadian / parts;
|
|
2628
2628
|
const partRadian4Sin = sin$4(partRadian / 4);
|
|
2629
2629
|
const control = 8 / 3 * partRadian4Sin * partRadian4Sin / sin$4(partRadian / 2);
|
|
@@ -3114,7 +3114,7 @@ var LeaferUI = function(exports) {
|
|
|
3114
3114
|
const {current: current, pushData: pushData, copyData: copyData} = PathConvert;
|
|
3115
3115
|
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: F$5, O: O$5, P: P$4, U: U$4} = PathCommandMap;
|
|
3116
3116
|
const {getMinDistanceFrom: getMinDistanceFrom, getRadianFrom: getRadianFrom} = PointHelper;
|
|
3117
|
-
const {tan: tan, min: min$2, abs: abs$
|
|
3117
|
+
const {tan: tan, min: min$2, abs: abs$9} = Math;
|
|
3118
3118
|
const startPoint = {};
|
|
3119
3119
|
const PathCommandDataHelper = {
|
|
3120
3120
|
beginPath(data) {
|
|
@@ -3172,7 +3172,7 @@ var LeaferUI = function(exports) {
|
|
|
3172
3172
|
arcTo(data, x1, y1, x2, y2, radius, lastX, lastY, fullRadius) {
|
|
3173
3173
|
if (!isUndefined(lastX)) {
|
|
3174
3174
|
const r = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2) / (fullRadius ? 1 : 2);
|
|
3175
|
-
radius = min$2(radius, min$2(r, r * abs$
|
|
3175
|
+
radius = min$2(radius, min$2(r, r * abs$9(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
|
|
3176
3176
|
}
|
|
3177
3177
|
data.push(U$4, x1, y1, x2, y2, radius);
|
|
3178
3178
|
},
|
|
@@ -6663,7 +6663,7 @@ var LeaferUI = function(exports) {
|
|
|
6663
6663
|
this.levelMap = null;
|
|
6664
6664
|
}
|
|
6665
6665
|
}
|
|
6666
|
-
const version = "2.0.
|
|
6666
|
+
const version = "2.0.8";
|
|
6667
6667
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6668
6668
|
get allowBackgroundColor() {
|
|
6669
6669
|
return true;
|
|
@@ -9392,7 +9392,7 @@ var LeaferUI = function(exports) {
|
|
|
9392
9392
|
EventCreator.changeName(oldName, newName);
|
|
9393
9393
|
}
|
|
9394
9394
|
}
|
|
9395
|
-
const {min: min$1, max: max$3, abs: abs$
|
|
9395
|
+
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;
|
|
9396
9396
|
const tempContent = new Bounds, tempDragBounds = new Bounds;
|
|
9397
9397
|
const DragBoundsHelper = {
|
|
9398
9398
|
limitMove(leaf, move) {
|
|
@@ -9467,7 +9467,7 @@ var LeaferUI = function(exports) {
|
|
|
9467
9467
|
bScale = originBottomScale && bSize > 0 ? 1 + bSize / (originBottomScale * tempContent.height) : 1;
|
|
9468
9468
|
correctScaleY *= max$3(aScale, bScale);
|
|
9469
9469
|
if (lockRatio) {
|
|
9470
|
-
aScale = max$3(abs$
|
|
9470
|
+
aScale = max$3(abs$8(correctScaleX), abs$8(correctScaleY));
|
|
9471
9471
|
correctScaleX = sign$2(correctScaleX) * aScale;
|
|
9472
9472
|
correctScaleY = sign$2(correctScaleY) * aScale;
|
|
9473
9473
|
}
|
|
@@ -10927,11 +10927,11 @@ var LeaferUI = function(exports) {
|
|
|
10927
10927
|
shape: shape
|
|
10928
10928
|
};
|
|
10929
10929
|
let cache$1, box$2 = new Bounds;
|
|
10930
|
-
const {isSame: isSame$
|
|
10930
|
+
const {isSame: isSame$2} = BoundsHelper;
|
|
10931
10931
|
function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
10932
10932
|
let leafPaint, event;
|
|
10933
10933
|
const image = ImageManager.get(paint, paint.type);
|
|
10934
|
-
if (cache$1 && paint === cache$1.paint && isSame$
|
|
10934
|
+
if (cache$1 && paint === cache$1.paint && isSame$2(boxBounds, cache$1.boxBounds)) {
|
|
10935
10935
|
leafPaint = cache$1.leafPaint;
|
|
10936
10936
|
} else {
|
|
10937
10937
|
leafPaint = {
|
|
@@ -11199,7 +11199,7 @@ var LeaferUI = function(exports) {
|
|
|
11199
11199
|
translate(transform, box.x + x, box.y + y);
|
|
11200
11200
|
}
|
|
11201
11201
|
const {get: get$1, scale: scale$2, copy: copy$4} = MatrixHelper;
|
|
11202
|
-
const {getFloorScale: getFloorScale} = MathHelper, {abs: abs$
|
|
11202
|
+
const {getFloorScale: getFloorScale} = MathHelper, {abs: abs$7} = Math;
|
|
11203
11203
|
function createPatternTask(paint, ui, canvas, renderOptions) {
|
|
11204
11204
|
if (!paint.patternTask) {
|
|
11205
11205
|
paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, void 0, void 0, function*() {
|
|
@@ -11221,8 +11221,8 @@ var LeaferUI = function(exports) {
|
|
|
11221
11221
|
width *= scaleX;
|
|
11222
11222
|
height *= scaleY;
|
|
11223
11223
|
if (gap) {
|
|
11224
|
-
xGap = gap.x * scaleX / abs$
|
|
11225
|
-
yGap = gap.y * scaleY / abs$
|
|
11224
|
+
xGap = gap.x * scaleX / abs$7(data.scaleX || 1);
|
|
11225
|
+
yGap = gap.y * scaleY / abs$7(data.scaleY || 1);
|
|
11226
11226
|
}
|
|
11227
11227
|
if (transform || scaleX !== 1 || scaleY !== 1) {
|
|
11228
11228
|
scaleX *= getFloorScale(width + (xGap || 0));
|
|
@@ -11434,7 +11434,7 @@ var LeaferUI = function(exports) {
|
|
|
11434
11434
|
conicGradient: conicGradient,
|
|
11435
11435
|
getTransform: getTransform
|
|
11436
11436
|
};
|
|
11437
|
-
const {copy: copy$3, move: move$6, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max$2, abs: abs$
|
|
11437
|
+
const {copy: copy$3, move: move$6, toOffsetOutBounds: toOffsetOutBounds$1} = BoundsHelper, {max: max$2, abs: abs$6} = Math;
|
|
11438
11438
|
const tempBounds$1 = {}, tempMatrix = new Matrix;
|
|
11439
11439
|
const offsetOutBounds$1 = {};
|
|
11440
11440
|
function shadow$1(ui, current, shape) {
|
|
@@ -11474,7 +11474,7 @@ var LeaferUI = function(exports) {
|
|
|
11474
11474
|
function getShadowRenderSpread(_ui, shadow) {
|
|
11475
11475
|
let top = 0, right = 0, bottom = 0, left = 0, x, y, spread, blur;
|
|
11476
11476
|
shadow.forEach(item => {
|
|
11477
|
-
x = item.x || 0, y = item.y || 0, blur = (item.blur || 0) * 1.5, spread = abs$
|
|
11477
|
+
x = item.x || 0, y = item.y || 0, blur = (item.blur || 0) * 1.5, spread = abs$6(item.spread || 0);
|
|
11478
11478
|
top = max$2(top, spread + blur - y);
|
|
11479
11479
|
right = max$2(right, spread + blur + x);
|
|
11480
11480
|
bottom = max$2(bottom, spread + blur + y);
|
|
@@ -12223,7 +12223,7 @@ var LeaferUI = function(exports) {
|
|
|
12223
12223
|
});
|
|
12224
12224
|
};
|
|
12225
12225
|
}
|
|
12226
|
-
const {abs: abs$
|
|
12226
|
+
const {abs: abs$5} = Math;
|
|
12227
12227
|
const {copy: copy$2} = MatrixHelper;
|
|
12228
12228
|
const {setListWithFn: setListWithFn} = BoundsHelper;
|
|
12229
12229
|
const {worldBounds: worldBounds} = LeafBoundsHelper;
|
|
@@ -12260,7 +12260,7 @@ var LeaferUI = function(exports) {
|
|
|
12260
12260
|
leaf = list[i];
|
|
12261
12261
|
const {worldTransform: worldTransform, worldRenderBounds: worldRenderBounds} = leaf;
|
|
12262
12262
|
if (worldRenderBounds.width && worldRenderBounds.height && (!bounds || bounds.hit(worldRenderBounds, options.matrix))) {
|
|
12263
|
-
const aScaleX = abs$
|
|
12263
|
+
const aScaleX = abs$5(worldTransform.scaleX), aScaleY = abs$5(worldTransform.scaleY);
|
|
12264
12264
|
copy$2(matrix$1, worldTransform);
|
|
12265
12265
|
matrix$1.half = strokeWidth % 2;
|
|
12266
12266
|
canvas.setWorld(matrix$1, options.matrix);
|
|
@@ -12563,7 +12563,7 @@ var LeaferUI = function(exports) {
|
|
|
12563
12563
|
}
|
|
12564
12564
|
}
|
|
12565
12565
|
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;
|
|
12566
|
-
const {toPoint: toPoint} = AroundHelper, {within: within$3, sign: sign$1} = MathHelper, {abs: abs$
|
|
12566
|
+
const {toPoint: toPoint} = AroundHelper, {within: within$3, sign: sign$1} = MathHelper, {abs: abs$4} = Math;
|
|
12567
12567
|
const EditDataHelper = {
|
|
12568
12568
|
getScaleData(target, startBounds, direction, totalMoveOrScale, lockRatio, around, flipable, scaleMode) {
|
|
12569
12569
|
let align, origin = {}, scaleX = 1, scaleY = 1, lockScale;
|
|
@@ -12648,7 +12648,7 @@ var LeaferUI = function(exports) {
|
|
|
12648
12648
|
break;
|
|
12649
12649
|
|
|
12650
12650
|
default:
|
|
12651
|
-
lockScale = Math.sqrt(abs$
|
|
12651
|
+
lockScale = Math.sqrt(abs$4(scaleX * scaleY));
|
|
12652
12652
|
scaleX = sign$1(scaleX) * lockScale;
|
|
12653
12653
|
scaleY = sign$1(scaleY) * lockScale;
|
|
12654
12654
|
}
|
|
@@ -12681,10 +12681,10 @@ var LeaferUI = function(exports) {
|
|
|
12681
12681
|
const nowHeight = boxBounds.height * target.scaleY;
|
|
12682
12682
|
scaleY = within$3(nowHeight * scaleY, heightRange) / nowHeight;
|
|
12683
12683
|
}
|
|
12684
|
-
if (useScaleX && abs$
|
|
12685
|
-
if (useScaleY && abs$
|
|
12684
|
+
if (useScaleX && abs$4(scaleX * worldBoxBounds.width) < 1) scaleX = sign$1(scaleX) / worldBoxBounds.width;
|
|
12685
|
+
if (useScaleY && abs$4(scaleY * worldBoxBounds.height) < 1) scaleY = sign$1(scaleY) / worldBoxBounds.height;
|
|
12686
12686
|
if (lockRatio && scaleX !== scaleY) {
|
|
12687
|
-
lockScale = Math.min(abs$
|
|
12687
|
+
lockScale = Math.min(abs$4(scaleX), abs$4(scaleY));
|
|
12688
12688
|
scaleX = sign$1(scaleX) * lockScale;
|
|
12689
12689
|
scaleY = sign$1(scaleY) * lockScale;
|
|
12690
12690
|
}
|
|
@@ -15170,7 +15170,7 @@ var LeaferUI = function(exports) {
|
|
|
15170
15170
|
}
|
|
15171
15171
|
};
|
|
15172
15172
|
const M$4 = MultiTouchHelper;
|
|
15173
|
-
const {abs: abs$
|
|
15173
|
+
const {abs: abs$3, max: max$1} = Math, {sign: sign, within: within$2} = MathHelper;
|
|
15174
15174
|
const WheelEventHelper = {
|
|
15175
15175
|
getMove(event, config) {
|
|
15176
15176
|
let {moveSpeed: moveSpeed} = config;
|
|
@@ -15179,7 +15179,7 @@ var LeaferUI = function(exports) {
|
|
|
15179
15179
|
deltaX = deltaY;
|
|
15180
15180
|
deltaY = 0;
|
|
15181
15181
|
}
|
|
15182
|
-
const absX = abs$
|
|
15182
|
+
const absX = abs$3(deltaX), absY = abs$3(deltaY);
|
|
15183
15183
|
if (absX > 50) deltaX = max$1(50, absX / 3) * sign(deltaX);
|
|
15184
15184
|
if (absY > 50) deltaY = max$1(50, absY / 3) * sign(deltaY);
|
|
15185
15185
|
return {
|
|
@@ -15201,7 +15201,7 @@ var LeaferUI = function(exports) {
|
|
|
15201
15201
|
if (zoom) {
|
|
15202
15202
|
zoomSpeed = within$2(zoomSpeed, 0, 1);
|
|
15203
15203
|
const min = event.deltaY ? config.delta.y : config.delta.x;
|
|
15204
|
-
const absScale = within$2(1 - abs$
|
|
15204
|
+
const absScale = within$2(1 - abs$3(delta) / (min * 4) * zoomSpeed, .5, 2);
|
|
15205
15205
|
scale = delta > 0 ? absScale : 1 / absScale;
|
|
15206
15206
|
}
|
|
15207
15207
|
return scale;
|
|
@@ -15420,7 +15420,7 @@ var LeaferUI = function(exports) {
|
|
|
15420
15420
|
if (moving) this.move(getMoveEventData(gestureData.move, data));
|
|
15421
15421
|
};
|
|
15422
15422
|
const dragger = Dragger.prototype;
|
|
15423
|
-
const {abs: abs$
|
|
15423
|
+
const {abs: abs$2, min: min, max: max, hypot: hypot} = Math;
|
|
15424
15424
|
dragger.checkDragEndAnimate = function(data) {
|
|
15425
15425
|
const {interaction: interaction} = this;
|
|
15426
15426
|
const dragAnimate = this.canAnimate && this.moving && interaction.m.dragAnimate;
|
|
@@ -15448,7 +15448,7 @@ var LeaferUI = function(exports) {
|
|
|
15448
15448
|
moveX *= boost;
|
|
15449
15449
|
moveY *= boost;
|
|
15450
15450
|
}
|
|
15451
|
-
const maxAbs = max(abs$
|
|
15451
|
+
const maxAbs = max(abs$2(moveX), abs$2(moveY));
|
|
15452
15452
|
if (maxAbs > maxMove) {
|
|
15453
15453
|
s = maxMove / maxAbs;
|
|
15454
15454
|
moveX *= s;
|
|
@@ -15458,7 +15458,7 @@ var LeaferUI = function(exports) {
|
|
|
15458
15458
|
moveX *= inertia;
|
|
15459
15459
|
moveY *= inertia;
|
|
15460
15460
|
data = Object.assign({}, data);
|
|
15461
|
-
if (abs$
|
|
15461
|
+
if (abs$2(moveX) < stopMove && abs$2(moveY) < stopMove) return this.dragEndReal(data);
|
|
15462
15462
|
PointHelper.move(data, moveX, moveY);
|
|
15463
15463
|
this.drag(data);
|
|
15464
15464
|
this.animate(step);
|
|
@@ -16115,7 +16115,7 @@ var LeaferUI = function(exports) {
|
|
|
16115
16115
|
return arrowData;
|
|
16116
16116
|
}
|
|
16117
16117
|
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;
|
|
16118
|
-
const {copy: copy, copyFrom: copyFrom, getDistancePoint: getDistancePoint, isSame: isSame} = PointHelper;
|
|
16118
|
+
const {copy: copy, copyFrom: copyFrom, getDistancePoint: getDistancePoint, isSame: isSame$1} = PointHelper;
|
|
16119
16119
|
const {stintSet: stintSet$1} = DataHelper;
|
|
16120
16120
|
const connectPoint = {};
|
|
16121
16121
|
const first = {}, second = {};
|
|
@@ -16204,7 +16204,7 @@ var LeaferUI = function(exports) {
|
|
|
16204
16204
|
}
|
|
16205
16205
|
count++;
|
|
16206
16206
|
if (count === 1 && command !== M$2) return;
|
|
16207
|
-
if (count === 2 && useStartArrow) copy(second, command === L$2 ? now : isSame(old, first) ? last : old);
|
|
16207
|
+
if (count === 2 && useStartArrow) copy(second, command === L$2 ? now : isSame$1(old, first) ? last : old);
|
|
16208
16208
|
if (i === len) {
|
|
16209
16209
|
const path = uData.__pathForRender = clonePathForArrow ? [ ...data ] : data;
|
|
16210
16210
|
if (useStartArrow) {
|
|
@@ -16218,7 +16218,7 @@ var LeaferUI = function(exports) {
|
|
|
16218
16218
|
}
|
|
16219
16219
|
}
|
|
16220
16220
|
if (endArrow && endArrow !== "none") {
|
|
16221
|
-
if (isSame(last, now)) copy(last, old);
|
|
16221
|
+
if (isSame$1(last, now)) copy(last, old);
|
|
16222
16222
|
endArrowPath = getArrowPath(ui, endArrow, last, now, strokeWidth, connectPoint, !!dashPattern);
|
|
16223
16223
|
singleEndArrow = endArrowPath.fill || dashPattern;
|
|
16224
16224
|
if (!singleEndArrow) path.push(...endArrowPath.data);
|
|
@@ -16774,7 +16774,7 @@ var LeaferUI = function(exports) {
|
|
|
16774
16774
|
this.__updateRectBoxBounds();
|
|
16775
16775
|
}
|
|
16776
16776
|
};
|
|
16777
|
-
const {cos: cos, sin: sin, pow: pow, sqrt: sqrt$1, abs: abs, ceil: ceil, floor: floor, round: round$2, PI: PI} = Math;
|
|
16777
|
+
const {cos: cos, sin: sin, pow: pow, sqrt: sqrt$1, abs: abs$1, ceil: ceil, floor: floor, round: round$2, PI: PI} = Math;
|
|
16778
16778
|
const PIx5 = PI * 5;
|
|
16779
16779
|
const n1$1 = 1.70158;
|
|
16780
16780
|
const n2$1 = 1.70158 * 1.525;
|
|
@@ -16802,7 +16802,7 @@ var LeaferUI = function(exports) {
|
|
|
16802
16802
|
o = 1 - v;
|
|
16803
16803
|
x = bezier(v, x1, x2) - t;
|
|
16804
16804
|
dx = 3 * o * o * x1 + 6 * o * v * (x2 - x1) + 3 * v * v * (1 - x2);
|
|
16805
|
-
if (abs(dx) < 1e-6) break;
|
|
16805
|
+
if (abs$1(dx) < 1e-6) break;
|
|
16806
16806
|
v -= x / dx;
|
|
16807
16807
|
}
|
|
16808
16808
|
return cache[key] = bezier(v, y1, y2);
|
|
@@ -19403,12 +19403,12 @@ var LeaferUI = function(exports) {
|
|
|
19403
19403
|
}
|
|
19404
19404
|
return Math.max(0, Math.min(.5, t));
|
|
19405
19405
|
}
|
|
19406
|
-
const {M: M, L: L, C: C, Z: Z} = PathCommandMap;
|
|
19406
|
+
const {M: M, L: L, C: C, Z: Z} = PathCommandMap, {abs: abs} = Math;
|
|
19407
19407
|
const {getCenterX: getCenterX, getCenterY: getCenterY} = PointHelper;
|
|
19408
19408
|
const {arcTo: arcTo} = PathCommandDataHelper;
|
|
19409
19409
|
PathCorner.smooth = function smooth(data, cornerRadius, _cornerSmoothing) {
|
|
19410
19410
|
const radius = data.radius;
|
|
19411
|
-
if (isNeedConvert(data)) data = PathConvert.toCanvasData(data, true);
|
|
19411
|
+
if (isNeedConvert(data)) data = PathConvert.toCanvasData(data, true); else data = [ ...data ];
|
|
19412
19412
|
let command, lastCommand, commandLen;
|
|
19413
19413
|
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;
|
|
19414
19414
|
if (isArray(cornerRadius)) cornerRadius = cornerRadius[0] || 0;
|
|
@@ -19494,6 +19494,9 @@ var LeaferUI = function(exports) {
|
|
|
19494
19494
|
toX = startX, toY = startY;
|
|
19495
19495
|
setBeforeC(smooth, r, lastX, lastY, x1, y1, x2, y2, x, y, toX, toY, three);
|
|
19496
19496
|
break;
|
|
19497
|
+
|
|
19498
|
+
default:
|
|
19499
|
+
smooth.push(C, x1, y1, x2, y2, x, y);
|
|
19497
19500
|
}
|
|
19498
19501
|
lastX = x;
|
|
19499
19502
|
lastY = y;
|
|
@@ -19580,7 +19583,16 @@ var LeaferUI = function(exports) {
|
|
|
19580
19583
|
return undefined;
|
|
19581
19584
|
}
|
|
19582
19585
|
function setAfterC(data, i, cornerRadius, lastX, lastY, fromX, fromY, x1, y1, x2, y2, toX, toY) {
|
|
19583
|
-
|
|
19586
|
+
let targetX = x1, targetY = y1;
|
|
19587
|
+
if (isSame(x1, fromX) && isSame(y1, fromY)) {
|
|
19588
|
+
targetX = x2;
|
|
19589
|
+
targetY = y2;
|
|
19590
|
+
if (isSame(x2, fromX) && isSame(y2, fromY)) {
|
|
19591
|
+
targetX = toX;
|
|
19592
|
+
targetY = toY;
|
|
19593
|
+
}
|
|
19594
|
+
}
|
|
19595
|
+
const d = getTangentDistance(cornerRadius, fromX, fromY, lastX, lastY, targetX, targetY);
|
|
19584
19596
|
const t = getCorrectT(d, fromX, fromY, x1, y1, x2, y2, toX, toY);
|
|
19585
19597
|
const two = BezierHelper.cut(t, fromX, fromY, x1, y1, x2, y2, toX, toY);
|
|
19586
19598
|
const {left: left, right: right} = two;
|
|
@@ -19593,7 +19605,16 @@ var LeaferUI = function(exports) {
|
|
|
19593
19605
|
return two;
|
|
19594
19606
|
}
|
|
19595
19607
|
function setBeforeC(smooth, cornerRadius, fromX, fromY, x1, y1, x2, y2, toX, toY, nextX, nextY, three) {
|
|
19596
|
-
|
|
19608
|
+
let targetX = x2, targetY = y2;
|
|
19609
|
+
if (isSame(targetX, toX) && isSame(targetY, toY)) {
|
|
19610
|
+
targetX = x1;
|
|
19611
|
+
targetY = y1;
|
|
19612
|
+
if (isSame(targetX, toX) && isSame(targetY, toY)) {
|
|
19613
|
+
targetX = fromX;
|
|
19614
|
+
targetY = fromY;
|
|
19615
|
+
}
|
|
19616
|
+
}
|
|
19617
|
+
const d = getTangentDistance(cornerRadius, toX, toY, targetX, targetY, nextX, nextY);
|
|
19597
19618
|
const t = getCorrectT(d, toX, toY, x2, y2, x1, y1, fromX, fromY);
|
|
19598
19619
|
const {left: left, right: right} = BezierHelper.cut(1 - t, fromX, fromY, x1, y1, x2, y2, toX, toY);
|
|
19599
19620
|
if (left && right) {
|
|
@@ -19603,6 +19624,9 @@ var LeaferUI = function(exports) {
|
|
|
19603
19624
|
smooth.push(C, x1, y1, x2, y2, toX, toY);
|
|
19604
19625
|
}
|
|
19605
19626
|
}
|
|
19627
|
+
function isSame(a, b) {
|
|
19628
|
+
return abs(a - b) < .01;
|
|
19629
|
+
}
|
|
19606
19630
|
Plugin.add("corner");
|
|
19607
19631
|
exports.AlignHelper = AlignHelper;
|
|
19608
19632
|
exports.AnimateEasing = AnimateEasing;
|