@leafer-game/worker 2.1.2 → 2.1.4
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 +60 -50
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +60 -50
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +12 -12
package/dist/worker.module.js
CHANGED
|
@@ -3048,6 +3048,7 @@ const PathConvert = {
|
|
|
3048
3048
|
current.length = PathCommandLengthMap[char];
|
|
3049
3049
|
current.index = 0;
|
|
3050
3050
|
pushData(data, current.name);
|
|
3051
|
+
if (char === "m") current.name = PathCommandMap["l"]; else if (char === "M") current.name = PathCommandMap["L"];
|
|
3051
3052
|
if (!needConvert && convertCommand[char]) needConvert = true;
|
|
3052
3053
|
} else {
|
|
3053
3054
|
if (char === "-" || char === "+") {
|
|
@@ -3080,10 +3081,9 @@ const PathConvert = {
|
|
|
3080
3081
|
old[i + 2] += y;
|
|
3081
3082
|
|
|
3082
3083
|
case M$5:
|
|
3083
|
-
x = old[i + 1];
|
|
3084
|
-
y = old[i + 2];
|
|
3085
|
-
|
|
3086
|
-
startY = y;
|
|
3084
|
+
x = startX = old[i + 1];
|
|
3085
|
+
y = startY = old[i + 2];
|
|
3086
|
+
data.push(M$5, x, y);
|
|
3087
3087
|
i += 3;
|
|
3088
3088
|
break;
|
|
3089
3089
|
|
|
@@ -3125,8 +3125,8 @@ const PathConvert = {
|
|
|
3125
3125
|
|
|
3126
3126
|
case S:
|
|
3127
3127
|
smooth = lastCommand === C$4 || lastCommand === S;
|
|
3128
|
-
x1 = smooth ? x * 2 - controlX :
|
|
3129
|
-
y1 = smooth ? y * 2 - controlY :
|
|
3128
|
+
x1 = smooth ? x * 2 - controlX : x;
|
|
3129
|
+
y1 = smooth ? y * 2 - controlY : y;
|
|
3130
3130
|
controlX = old[i + 1];
|
|
3131
3131
|
controlY = old[i + 2];
|
|
3132
3132
|
x = old[i + 3];
|
|
@@ -3160,8 +3160,8 @@ const PathConvert = {
|
|
|
3160
3160
|
|
|
3161
3161
|
case T:
|
|
3162
3162
|
smooth = lastCommand === Q$3 || lastCommand === T;
|
|
3163
|
-
controlX = smooth ? x * 2 - controlX :
|
|
3164
|
-
controlY = smooth ? y * 2 - controlY :
|
|
3163
|
+
controlX = smooth ? x * 2 - controlX : x;
|
|
3164
|
+
controlY = smooth ? y * 2 - controlY : y;
|
|
3165
3165
|
curveMode ? quadraticCurveTo$1(data, x, y, controlX, controlY, old[i + 1], old[i + 2]) : data.push(Q$3, controlX, controlY, old[i + 1], old[i + 2]);
|
|
3166
3166
|
x = old[i + 1];
|
|
3167
3167
|
y = old[i + 2];
|
|
@@ -4866,10 +4866,10 @@ const LeafHelper = {
|
|
|
4866
4866
|
y: y
|
|
4867
4867
|
}, transition) : (t.x = x, t.y = y);
|
|
4868
4868
|
},
|
|
4869
|
-
zoomOfWorld(t, origin, scaleX, scaleY, resize, transition) {
|
|
4870
|
-
L$1.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY, resize, transition);
|
|
4869
|
+
zoomOfWorld(t, origin, scaleX, scaleY, resize, transition, boundsType) {
|
|
4870
|
+
L$1.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY, resize, transition, boundsType);
|
|
4871
4871
|
},
|
|
4872
|
-
zoomOfLocal(t, origin, scaleX, scaleY = scaleX, resize, transition) {
|
|
4872
|
+
zoomOfLocal(t, origin, scaleX, scaleY = scaleX, resize, transition, boundsType) {
|
|
4873
4873
|
const o = t.__localMatrix;
|
|
4874
4874
|
if (!isNumber(scaleY)) {
|
|
4875
4875
|
if (scaleY) transition = scaleY;
|
|
@@ -4878,7 +4878,7 @@ const LeafHelper = {
|
|
|
4878
4878
|
copy$5(matrix$1, o);
|
|
4879
4879
|
scaleOfOuter$2(matrix$1, origin, scaleX, scaleY);
|
|
4880
4880
|
if (L$1.hasHighPosition(t)) {
|
|
4881
|
-
L$1.setTransform(t, matrix$1, resize, transition);
|
|
4881
|
+
L$1.setTransform(t, matrix$1, resize, transition, boundsType);
|
|
4882
4882
|
} else {
|
|
4883
4883
|
const x = t.x + matrix$1.e - o.e, y = t.y + matrix$1.f - o.f;
|
|
4884
4884
|
if (transition && !resize) t.animate({
|
|
@@ -4886,7 +4886,7 @@ const LeafHelper = {
|
|
|
4886
4886
|
y: y,
|
|
4887
4887
|
scaleX: t.scaleX * scaleX,
|
|
4888
4888
|
scaleY: t.scaleY * scaleY
|
|
4889
|
-
}, transition); else t.x = x, t.y = y, t.scaleResize(scaleX, scaleY, resize !== true);
|
|
4889
|
+
}, transition); else t.x = x, t.y = y, t.scaleResize(scaleX, scaleY, resize !== true, boundsType);
|
|
4890
4890
|
}
|
|
4891
4891
|
},
|
|
4892
4892
|
rotateOfWorld(t, origin, angle, transition) {
|
|
@@ -4910,18 +4910,18 @@ const LeafHelper = {
|
|
|
4910
4910
|
skewOfOuter(matrix$1, origin, skewX, skewY);
|
|
4911
4911
|
L$1.setTransform(t, matrix$1, resize, transition);
|
|
4912
4912
|
},
|
|
4913
|
-
transformWorld(t, transform, resize, transition) {
|
|
4913
|
+
transformWorld(t, transform, resize, transition, boundsType) {
|
|
4914
4914
|
copy$5(matrix$1, t.worldTransform);
|
|
4915
4915
|
multiplyParent$3(matrix$1, transform);
|
|
4916
4916
|
if (t.parent) divideParent(matrix$1, t.parent.scrollWorldTransform);
|
|
4917
|
-
L$1.setTransform(t, matrix$1, resize, transition);
|
|
4917
|
+
L$1.setTransform(t, matrix$1, resize, transition, boundsType);
|
|
4918
4918
|
},
|
|
4919
|
-
transform(t, transform, resize, transition) {
|
|
4919
|
+
transform(t, transform, resize, transition, boundsType) {
|
|
4920
4920
|
copy$5(matrix$1, t.localTransform);
|
|
4921
4921
|
multiplyParent$3(matrix$1, transform);
|
|
4922
|
-
L$1.setTransform(t, matrix$1, resize, transition);
|
|
4922
|
+
L$1.setTransform(t, matrix$1, resize, transition, boundsType);
|
|
4923
4923
|
},
|
|
4924
|
-
setTransform(t, transform, resize, transition) {
|
|
4924
|
+
setTransform(t, transform, resize, transition, boundsType) {
|
|
4925
4925
|
const data = t.__, originPoint = data.origin && L$1.getInnerOrigin(t, data.origin);
|
|
4926
4926
|
const layout = getLayout(transform, originPoint, data.around && L$1.getInnerOrigin(t, data.around));
|
|
4927
4927
|
if (L$1.hasOffset(t)) {
|
|
@@ -4937,7 +4937,7 @@ const LeafHelper = {
|
|
|
4937
4937
|
PointHelper.move(layout, originPoint.x - changedPoint.x, originPoint.y - changedPoint.y);
|
|
4938
4938
|
}
|
|
4939
4939
|
t.set(layout);
|
|
4940
|
-
t.scaleResize(scaleX, scaleY, false);
|
|
4940
|
+
t.scaleResize(scaleX, scaleY, false, boundsType);
|
|
4941
4941
|
} else t.set(layout, transition);
|
|
4942
4942
|
},
|
|
4943
4943
|
getFlipTransform(t, axis) {
|
|
@@ -6084,39 +6084,45 @@ const LeafBounds = {
|
|
|
6084
6084
|
this.__updateRenderPath();
|
|
6085
6085
|
this.__updateBoxBounds();
|
|
6086
6086
|
layout.resized = "inner";
|
|
6087
|
-
if (data.__strokeGeometry) data.__strokeGeometry = undefined;
|
|
6088
6087
|
}
|
|
6089
6088
|
if (layout.localBoxChanged) {
|
|
6090
6089
|
if (this.__local) this.__updateLocalBoxBounds();
|
|
6091
6090
|
layout.localBoxChanged = undefined;
|
|
6092
|
-
if (layout.strokeSpread) layout.strokeChanged = true;
|
|
6093
|
-
if (layout.renderSpread) layout.renderChanged = true;
|
|
6091
|
+
if (layout.strokeSpread && !layout.strokeChanged) layout.strokeChanged = layout.boxChanged ? true : 2;
|
|
6092
|
+
if (layout.renderSpread && !layout.renderChanged) layout.renderChanged = layout.boxChanged ? true : 2;
|
|
6094
6093
|
if (this.parent) this.parent.__layout.boxChange();
|
|
6095
6094
|
}
|
|
6096
6095
|
layout.boxChanged = undefined;
|
|
6097
6096
|
if (layout.strokeChanged) {
|
|
6098
|
-
layout.
|
|
6099
|
-
if (layout.strokeSpread) {
|
|
6100
|
-
if (layout.strokeBounds === layout.boxBounds) layout.spreadStroke();
|
|
6101
|
-
this.__updateStrokeBounds();
|
|
6097
|
+
if (layout.strokeChanged === 2) {
|
|
6102
6098
|
this.__updateLocalStrokeBounds();
|
|
6103
6099
|
} else {
|
|
6104
|
-
layout.
|
|
6100
|
+
layout.strokeSpread = this.__updateStrokeSpread();
|
|
6101
|
+
if (layout.strokeSpread) {
|
|
6102
|
+
if (layout.strokeBounds === layout.boxBounds) layout.spreadStroke();
|
|
6103
|
+
this.__updateStrokeBounds();
|
|
6104
|
+
this.__updateLocalStrokeBounds();
|
|
6105
|
+
} else {
|
|
6106
|
+
layout.spreadStrokeCancel();
|
|
6107
|
+
}
|
|
6108
|
+
layout.resized = "inner";
|
|
6109
|
+
if (layout.renderSpread || layout.strokeSpread !== layout.strokeBoxSpread) layout.renderChanged = true;
|
|
6105
6110
|
}
|
|
6106
6111
|
layout.strokeChanged = undefined;
|
|
6107
|
-
if (layout.renderSpread || layout.strokeSpread !== layout.strokeBoxSpread) layout.renderChanged = true;
|
|
6108
6112
|
if (this.parent) this.parent.__layout.strokeChange();
|
|
6109
|
-
layout.resized = "inner";
|
|
6110
|
-
if (data.__strokeGeometry) data.__strokeGeometry = undefined;
|
|
6111
6113
|
}
|
|
6112
6114
|
if (layout.renderChanged) {
|
|
6113
|
-
layout.
|
|
6114
|
-
if (layout.renderSpread) {
|
|
6115
|
-
if (layout.renderBounds === layout.boxBounds || layout.renderBounds === layout.strokeBounds) layout.spreadRender();
|
|
6116
|
-
this.__updateRenderBounds();
|
|
6115
|
+
if (layout.renderChanged === 2) {
|
|
6117
6116
|
this.__updateLocalRenderBounds();
|
|
6118
6117
|
} else {
|
|
6119
|
-
layout.
|
|
6118
|
+
layout.renderSpread = this.__updateRenderSpread();
|
|
6119
|
+
if (layout.renderSpread) {
|
|
6120
|
+
if (layout.renderBounds === layout.boxBounds || layout.renderBounds === layout.strokeBounds) layout.spreadRender();
|
|
6121
|
+
this.__updateRenderBounds();
|
|
6122
|
+
this.__updateLocalRenderBounds();
|
|
6123
|
+
} else {
|
|
6124
|
+
layout.spreadRenderCancel();
|
|
6125
|
+
}
|
|
6120
6126
|
}
|
|
6121
6127
|
layout.renderChanged = undefined;
|
|
6122
6128
|
if (this.parent) this.parent.__layout.renderChange();
|
|
@@ -6670,11 +6676,11 @@ let Leaf = class Leaf {
|
|
|
6670
6676
|
const layer = this.leafer ? this.leafer.zoomLayer : this;
|
|
6671
6677
|
return layer.getWorldPoint(page, relative, distance, change);
|
|
6672
6678
|
}
|
|
6673
|
-
setTransform(matrix, resize, transition) {
|
|
6674
|
-
setTransform(this, matrix, resize, transition);
|
|
6679
|
+
setTransform(matrix, resize, transition, boundsType) {
|
|
6680
|
+
setTransform(this, matrix, resize, transition, boundsType);
|
|
6675
6681
|
}
|
|
6676
|
-
transform(matrix, resize, transition) {
|
|
6677
|
-
transform(this, matrix, resize, transition);
|
|
6682
|
+
transform(matrix, resize, transition, boundsType) {
|
|
6683
|
+
transform(this, matrix, resize, transition, boundsType);
|
|
6678
6684
|
}
|
|
6679
6685
|
move(x, y, transition) {
|
|
6680
6686
|
moveLocal(this, x, y, transition);
|
|
@@ -6682,8 +6688,8 @@ let Leaf = class Leaf {
|
|
|
6682
6688
|
moveInner(x, y, transition) {
|
|
6683
6689
|
moveWorld(this, x, y, true, transition);
|
|
6684
6690
|
}
|
|
6685
|
-
scaleOf(origin, scaleX, scaleY, resize, transition) {
|
|
6686
|
-
zoomOfLocal(this, getLocalOrigin(this, origin), scaleX, scaleY, resize, transition);
|
|
6691
|
+
scaleOf(origin, scaleX, scaleY, resize, transition, boundsType) {
|
|
6692
|
+
zoomOfLocal(this, getLocalOrigin(this, origin), scaleX, scaleY, resize, transition, boundsType);
|
|
6687
6693
|
}
|
|
6688
6694
|
rotateOf(origin, rotation, transition) {
|
|
6689
6695
|
rotateOfLocal(this, getLocalOrigin(this, origin), rotation, transition);
|
|
@@ -6691,14 +6697,14 @@ let Leaf = class Leaf {
|
|
|
6691
6697
|
skewOf(origin, skewX, skewY, resize, transition) {
|
|
6692
6698
|
skewOfLocal(this, getLocalOrigin(this, origin), skewX, skewY, resize, transition);
|
|
6693
6699
|
}
|
|
6694
|
-
transformWorld(worldTransform, resize, transition) {
|
|
6695
|
-
transformWorld(this, worldTransform, resize, transition);
|
|
6700
|
+
transformWorld(worldTransform, resize, transition, boundsType) {
|
|
6701
|
+
transformWorld(this, worldTransform, resize, transition, boundsType);
|
|
6696
6702
|
}
|
|
6697
6703
|
moveWorld(x, y, transition) {
|
|
6698
6704
|
moveWorld(this, x, y, false, transition);
|
|
6699
6705
|
}
|
|
6700
|
-
scaleOfWorld(worldOrigin, scaleX, scaleY, resize, transition) {
|
|
6701
|
-
zoomOfWorld(this, worldOrigin, scaleX, scaleY, resize, transition);
|
|
6706
|
+
scaleOfWorld(worldOrigin, scaleX, scaleY, resize, transition, boundsType) {
|
|
6707
|
+
zoomOfWorld(this, worldOrigin, scaleX, scaleY, resize, transition, boundsType);
|
|
6702
6708
|
}
|
|
6703
6709
|
rotateOfWorld(worldOrigin, rotation) {
|
|
6704
6710
|
rotateOfWorld(this, worldOrigin, rotation);
|
|
@@ -6709,7 +6715,7 @@ let Leaf = class Leaf {
|
|
|
6709
6715
|
flip(axis, transition) {
|
|
6710
6716
|
transform(this, getFlipTransform(this, axis), false, transition);
|
|
6711
6717
|
}
|
|
6712
|
-
scaleResize(scaleX, scaleY = scaleX, _noResize) {
|
|
6718
|
+
scaleResize(scaleX, scaleY = scaleX, _noResize, _boundsType) {
|
|
6713
6719
|
this.scaleX *= scaleX;
|
|
6714
6720
|
this.scaleY *= scaleY;
|
|
6715
6721
|
}
|
|
@@ -7084,7 +7090,7 @@ class LeafLevelList {
|
|
|
7084
7090
|
}
|
|
7085
7091
|
}
|
|
7086
7092
|
|
|
7087
|
-
const version = "2.1.
|
|
7093
|
+
const version = "2.1.4";
|
|
7088
7094
|
|
|
7089
7095
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
7090
7096
|
get allowBackgroundColor() {
|
|
@@ -11884,7 +11890,7 @@ function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds
|
|
|
11884
11890
|
needUpdate = false;
|
|
11885
11891
|
}
|
|
11886
11892
|
}
|
|
11887
|
-
if (paint.mode === "brush") PaintImage.brush(leafPaint);
|
|
11893
|
+
if (paint.mode === "brush") PaintImage.brush(leafPaint, ui);
|
|
11888
11894
|
if (!leafPaint.data) {
|
|
11889
11895
|
PaintImage.createData(leafPaint, image, paint, boxBounds);
|
|
11890
11896
|
const {transform: transform} = leafPaint.data, {opacity: opacity} = paint;
|
|
@@ -12141,8 +12147,12 @@ function createPattern(paint, ui, canvas, renderOptions) {
|
|
|
12141
12147
|
scale(imageMatrix, 1 / scaleX, 1 / scaleY);
|
|
12142
12148
|
}
|
|
12143
12149
|
const imageCanvas = image.getCanvas(width, height, opacity, undefined, xGap, yGap, ui.leafer && ui.leafer.config.smooth, data.interlace);
|
|
12144
|
-
|
|
12145
|
-
|
|
12150
|
+
if (brush) {
|
|
12151
|
+
paint.style = imageCanvas;
|
|
12152
|
+
PaintImage.cacheBrush(paint, ui, canvas, renderOptions);
|
|
12153
|
+
} else {
|
|
12154
|
+
paint.style = image.getPattern(imageCanvas, data.repeat || (Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
|
|
12155
|
+
}
|
|
12146
12156
|
paint.patternId = id;
|
|
12147
12157
|
}
|
|
12148
12158
|
}
|