@leafer/worker 1.9.10 → 1.9.11
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 +58 -48
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +58 -48
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +23 -23
package/dist/worker.module.js
CHANGED
|
@@ -3840,7 +3840,12 @@ class TaskProcessor {
|
|
|
3840
3840
|
runTask() {
|
|
3841
3841
|
const task = this.list[this.index];
|
|
3842
3842
|
if (!task) {
|
|
3843
|
-
this.nextTask();
|
|
3843
|
+
this.timer = setTimeout(() => this.nextTask());
|
|
3844
|
+
return;
|
|
3845
|
+
}
|
|
3846
|
+
if (task.isCancel) {
|
|
3847
|
+
this.index++;
|
|
3848
|
+
this.runTask();
|
|
3844
3849
|
return;
|
|
3845
3850
|
}
|
|
3846
3851
|
task.run().then(() => {
|
|
@@ -3871,16 +3876,15 @@ class TaskProcessor {
|
|
|
3871
3876
|
}
|
|
3872
3877
|
setParallelList() {
|
|
3873
3878
|
let task;
|
|
3879
|
+
const {config: config, list: list, index: index} = this;
|
|
3874
3880
|
this.parallelList = [];
|
|
3875
3881
|
this.parallelSuccessNumber = 0;
|
|
3876
|
-
let end =
|
|
3877
|
-
if (end >
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
this.parallelList.push(task);
|
|
3882
|
-
} else {
|
|
3883
|
-
break;
|
|
3882
|
+
let end = index + config.parallel;
|
|
3883
|
+
if (end > list.length) end = list.length;
|
|
3884
|
+
if (config.parallel > 1) {
|
|
3885
|
+
for (let i = index; i < end; i++) {
|
|
3886
|
+
task = list[i];
|
|
3887
|
+
if (task.parallel) this.parallelList.push(task); else break;
|
|
3884
3888
|
}
|
|
3885
3889
|
}
|
|
3886
3890
|
}
|
|
@@ -6815,7 +6819,7 @@ class LeafLevelList {
|
|
|
6815
6819
|
}
|
|
6816
6820
|
}
|
|
6817
6821
|
|
|
6818
|
-
const version = "1.9.
|
|
6822
|
+
const version = "1.9.11";
|
|
6819
6823
|
|
|
6820
6824
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6821
6825
|
get allowBackgroundColor() {
|
|
@@ -9772,7 +9776,7 @@ class UIEvent extends Event {
|
|
|
9772
9776
|
}
|
|
9773
9777
|
}
|
|
9774
9778
|
|
|
9775
|
-
const {float: float$1, sign: sign$2} = MathHelper, {
|
|
9779
|
+
const {min: min, max: max$3, abs: abs$7} = Math, {float: float$1, sign: sign$2} = MathHelper, {minX: minX, maxX: maxX, minY: minY, maxY: maxY} = BoundsHelper;
|
|
9776
9780
|
|
|
9777
9781
|
const tempContent = new Bounds, tempDragBounds = new Bounds;
|
|
9778
9782
|
|
|
@@ -9822,26 +9826,27 @@ const DragBoundsHelper = {
|
|
|
9822
9826
|
tempContent.set(content).scaleOf(origin, scale.x, scale.y);
|
|
9823
9827
|
const originLeftScale = (origin.x - content.x) / content.width, originRightScale = 1 - originLeftScale;
|
|
9824
9828
|
const originTopScale = (origin.y - content.y) / content.height, originBottomScale = 1 - originTopScale;
|
|
9825
|
-
let correctScaleX, correctScaleY, aScale, bScale, aSize, bSize;
|
|
9829
|
+
let correctScaleX = 1, correctScaleY = 1, aScale, bScale, aSize, bSize;
|
|
9826
9830
|
if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
|
|
9827
|
-
|
|
9828
|
-
if (scale.x < 0) tempContent.scaleOf(origin, correctScaleX, 1);
|
|
9831
|
+
if (scale.x < 0) tempContent.scaleOf(origin, correctScaleX = 1 / scale.x, 1);
|
|
9829
9832
|
aSize = float$1(tempContent.minX - tempDragBounds.minX);
|
|
9830
9833
|
bSize = float$1(tempDragBounds.maxX - tempContent.maxX);
|
|
9831
9834
|
aScale = originLeftScale && aSize > 0 ? 1 + aSize / (originLeftScale * tempContent.width) : 1;
|
|
9832
9835
|
bScale = originRightScale && bSize > 0 ? 1 + bSize / (originRightScale * tempContent.width) : 1;
|
|
9833
9836
|
correctScaleX *= max$3(aScale, bScale);
|
|
9834
9837
|
} else {
|
|
9835
|
-
if (scale.x < 0)
|
|
9838
|
+
if (scale.x < 0) {
|
|
9839
|
+
if (float$1(minX(content) - minX(dragBounds)) <= 0 || float$1(maxX(dragBounds) - maxX(content)) <= 0) tempContent.scaleOf(origin, correctScaleX = 1 / scale.x, 1);
|
|
9840
|
+
tempContent.unsign();
|
|
9841
|
+
}
|
|
9836
9842
|
aSize = float$1(tempDragBounds.minX - tempContent.minX);
|
|
9837
9843
|
bSize = float$1(tempContent.maxX - tempDragBounds.maxX);
|
|
9838
9844
|
aScale = originLeftScale && aSize > 0 ? 1 - aSize / (originLeftScale * tempContent.width) : 1;
|
|
9839
9845
|
bScale = originRightScale && bSize > 0 ? 1 - bSize / (originRightScale * tempContent.width) : 1;
|
|
9840
|
-
correctScaleX
|
|
9846
|
+
correctScaleX *= min(aScale, bScale);
|
|
9841
9847
|
}
|
|
9842
9848
|
if (D$2.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
|
|
9843
|
-
|
|
9844
|
-
if (scale.y < 0) tempContent.scaleOf(origin, 1, correctScaleY);
|
|
9849
|
+
if (scale.y < 0) tempContent.scaleOf(origin, 1, correctScaleY = 1 / scale.y);
|
|
9845
9850
|
aSize = float$1(tempContent.minY - tempDragBounds.minY);
|
|
9846
9851
|
bSize = float$1(tempDragBounds.maxY - tempContent.maxY);
|
|
9847
9852
|
aScale = originTopScale && aSize > 0 ? 1 + aSize / (originTopScale * tempContent.height) : 1;
|
|
@@ -9853,12 +9858,15 @@ const DragBoundsHelper = {
|
|
|
9853
9858
|
correctScaleY = sign$2(correctScaleY) * aScale;
|
|
9854
9859
|
}
|
|
9855
9860
|
} else {
|
|
9856
|
-
if (scale.y < 0)
|
|
9861
|
+
if (scale.y < 0) {
|
|
9862
|
+
if (float$1(minY(content) - minY(dragBounds)) <= 0 || float$1(maxY(dragBounds) - maxY(content)) <= 0) tempContent.scaleOf(origin, 1, correctScaleY = 1 / scale.y);
|
|
9863
|
+
tempContent.unsign();
|
|
9864
|
+
}
|
|
9857
9865
|
aSize = float$1(tempDragBounds.minY - tempContent.minY);
|
|
9858
9866
|
bSize = float$1(tempContent.maxY - tempDragBounds.maxY);
|
|
9859
9867
|
aScale = originTopScale && aSize > 0 ? 1 - aSize / (originTopScale * tempContent.height) : 1;
|
|
9860
9868
|
bScale = originBottomScale && bSize > 0 ? 1 - bSize / (originBottomScale * tempContent.height) : 1;
|
|
9861
|
-
correctScaleY
|
|
9869
|
+
correctScaleY *= min(aScale, bScale);
|
|
9862
9870
|
}
|
|
9863
9871
|
scale.x *= isFinite(correctScaleX) ? correctScaleX : 1;
|
|
9864
9872
|
scale.y *= isFinite(correctScaleY) ? correctScaleY : 1;
|
|
@@ -10938,9 +10946,9 @@ const ui$5 = UI.prototype;
|
|
|
10938
10946
|
|
|
10939
10947
|
ui$5.__updateHitCanvas = function() {
|
|
10940
10948
|
if (this.__box) this.__box.__updateHitCanvas();
|
|
10941
|
-
const
|
|
10942
|
-
if (!
|
|
10943
|
-
const data = this.__
|
|
10949
|
+
const {hitCanvasManager: hitCanvasManager} = this.leafer || this.parent && this.parent.leafer || {};
|
|
10950
|
+
if (!hitCanvasManager) return;
|
|
10951
|
+
const data = this.__;
|
|
10944
10952
|
const isHitPixelFill = (data.__isAlphaPixelFill || data.__isCanvas) && data.hitFill === "pixel";
|
|
10945
10953
|
const isHitPixelStroke = data.__isAlphaPixelStroke && data.hitStroke === "pixel";
|
|
10946
10954
|
const isHitPixel = isHitPixelFill || isHitPixelStroke;
|
|
@@ -12024,11 +12032,11 @@ function getShadowRenderSpread(_ui, shadow) {
|
|
|
12024
12032
|
|
|
12025
12033
|
function getShadowTransform(ui, canvas, _shape, shadow, outBounds, otherScale, isInnerShaodw) {
|
|
12026
12034
|
if (shadow.spread) {
|
|
12027
|
-
const
|
|
12035
|
+
const spread = shadow.spread * 2 * otherScale * (isInnerShaodw ? -1 : 1), {width: width, height: height} = ui.__layout.strokeBounds;
|
|
12028
12036
|
tempMatrix.set().scaleOfOuter({
|
|
12029
12037
|
x: (outBounds.x + outBounds.width / 2) * canvas.pixelRatio,
|
|
12030
12038
|
y: (outBounds.y + outBounds.height / 2) * canvas.pixelRatio
|
|
12031
|
-
},
|
|
12039
|
+
}, 1 + spread / width, 1 + spread / height);
|
|
12032
12040
|
return tempMatrix;
|
|
12033
12041
|
}
|
|
12034
12042
|
return undefined;
|
|
@@ -13565,7 +13573,7 @@ class EditBox extends Group {
|
|
|
13565
13573
|
return this.scaleX * this.scaleY < 0;
|
|
13566
13574
|
}
|
|
13567
13575
|
get canUse() {
|
|
13568
|
-
return this.app && this.
|
|
13576
|
+
return this.app && this.editor.editing;
|
|
13569
13577
|
}
|
|
13570
13578
|
get canGesture() {
|
|
13571
13579
|
if (!this.canUse) return false;
|
|
@@ -13839,29 +13847,25 @@ class EditBox extends Group {
|
|
|
13839
13847
|
this.dragPoint = null;
|
|
13840
13848
|
}
|
|
13841
13849
|
onTransformStart(e) {
|
|
13842
|
-
if (this.
|
|
13843
|
-
|
|
13844
|
-
|
|
13845
|
-
|
|
13846
|
-
|
|
13847
|
-
|
|
13848
|
-
|
|
13849
|
-
|
|
13850
|
-
|
|
13851
|
-
|
|
13852
|
-
|
|
13853
|
-
|
|
13854
|
-
dragStartData.rotation = target.rotation;
|
|
13855
|
-
}
|
|
13850
|
+
if (this.moving) this.editor.opacity = this.mergedConfig.hideOnMove ? 0 : 1;
|
|
13851
|
+
if (this.resizing) ResizeEvent.resizingKeys = this.editor.leafList.keys;
|
|
13852
|
+
const {dragStartData: dragStartData, target: target} = this;
|
|
13853
|
+
dragStartData.x = e.x;
|
|
13854
|
+
dragStartData.y = e.y;
|
|
13855
|
+
dragStartData.totalOffset = getPointData();
|
|
13856
|
+
dragStartData.point = {
|
|
13857
|
+
x: target.x,
|
|
13858
|
+
y: target.y
|
|
13859
|
+
};
|
|
13860
|
+
dragStartData.bounds = Object.assign({}, target.getLayoutBounds("box", "local"));
|
|
13861
|
+
dragStartData.rotation = target.rotation;
|
|
13856
13862
|
}
|
|
13857
13863
|
onTransformEnd(e) {
|
|
13858
|
-
if (this.
|
|
13859
|
-
|
|
13860
|
-
|
|
13861
|
-
|
|
13862
|
-
|
|
13863
|
-
this.update();
|
|
13864
|
-
}
|
|
13864
|
+
if (this.canDragLimitAnimate && (e instanceof DragEvent || e instanceof MoveEvent)) this.transformTool.onMove(e);
|
|
13865
|
+
if (this.resizing) ResizeEvent.resizingKeys = null;
|
|
13866
|
+
this.dragging = this.gesturing = this.moving = this.resizing = this.rotating = this.skewing = false;
|
|
13867
|
+
this.editor.opacity = 1;
|
|
13868
|
+
this.editor.update();
|
|
13865
13869
|
}
|
|
13866
13870
|
onMove(e) {
|
|
13867
13871
|
if (this.canGesture && e.moveType !== "drag") {
|
|
@@ -13890,6 +13894,12 @@ class EditBox extends Group {
|
|
|
13890
13894
|
}
|
|
13891
13895
|
}
|
|
13892
13896
|
}
|
|
13897
|
+
onGestureStart(e) {
|
|
13898
|
+
if (this.canGesture && e.moveType !== "drag") this.onTransformStart(e);
|
|
13899
|
+
}
|
|
13900
|
+
onGestureEnd(e) {
|
|
13901
|
+
if (this.canGesture && e.moveType !== "drag") this.onTransformEnd(e);
|
|
13902
|
+
}
|
|
13893
13903
|
isHoldRotateKey(e) {
|
|
13894
13904
|
const {rotateKey: rotateKey} = this.mergedConfig;
|
|
13895
13905
|
if (rotateKey) return e.isHoldKeys(rotateKey);
|
|
@@ -13959,7 +13969,7 @@ class EditBox extends Group {
|
|
|
13959
13969
|
const {rect: rect, editor: editor, __eventIds: events} = this;
|
|
13960
13970
|
events.push(rect.on_([ [ PointerEvent.DOUBLE_TAP, this.onDoubleTap, this ], [ PointerEvent.LONG_PRESS, this.onLongPress, this ] ]));
|
|
13961
13971
|
this.waitLeafer(() => {
|
|
13962
|
-
events.push(editor.app.on_([ [ [ KeyEvent.HOLD, KeyEvent.UP ], this.onKey, this ], [ KeyEvent.DOWN, this.onArrow, this ], [
|
|
13972
|
+
events.push(editor.app.on_([ [ [ KeyEvent.HOLD, KeyEvent.UP ], this.onKey, this ], [ KeyEvent.DOWN, this.onArrow, this ], [ MoveEvent.BEFORE_MOVE, this.onMove, this, true ], [ ZoomEvent.BEFORE_ZOOM, this.onScale, this, true ], [ RotateEvent.BEFORE_ROTATE, this.onRotate, this, true ], [ [ MoveEvent.START, ZoomEvent.START, RotateEvent.START ], this.onGestureStart, this ], [ [ MoveEvent.END, ZoomEvent.END, RotateEvent.END ], this.onGestureEnd, this ] ]));
|
|
13963
13973
|
});
|
|
13964
13974
|
}
|
|
13965
13975
|
__removeListenEvents() {
|