@leafer-game/worker 2.1.1 → 2.1.3
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 +37 -26
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +37 -26
- 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.js
CHANGED
|
@@ -2850,7 +2850,7 @@ var LeaferUI = function(exports) {
|
|
|
2850
2850
|
current.length = PathCommandLengthMap[char];
|
|
2851
2851
|
current.index = 0;
|
|
2852
2852
|
pushData(data, current.name);
|
|
2853
|
-
if (!needConvert && convertCommand[char]) needConvert = true;
|
|
2853
|
+
if (char === "m") current.name = PathCommandMap["l"]; else if (char === "M") current.name = PathCommandMap["L"]; else if (!needConvert && convertCommand[char]) needConvert = true;
|
|
2854
2854
|
} else {
|
|
2855
2855
|
if (char === "-" || char === "+") {
|
|
2856
2856
|
if (lastChar === "e" || lastChar === "E") {
|
|
@@ -2872,7 +2872,7 @@ var LeaferUI = function(exports) {
|
|
|
2872
2872
|
return needConvert ? PathConvert.toCanvasData(data, curveMode) : data;
|
|
2873
2873
|
},
|
|
2874
2874
|
toCanvasData(old, curveMode) {
|
|
2875
|
-
let x = 0, y = 0, x1 = 0, y1 = 0, i = 0, len = old.length, controlX, controlY, command, lastCommand, smooth;
|
|
2875
|
+
let x = 0, y = 0, x1 = 0, y1 = 0, startX = 0, startY = 0, i = 0, len = old.length, controlX, controlY, command, lastCommand, smooth;
|
|
2876
2876
|
const data = [];
|
|
2877
2877
|
while (i < len) {
|
|
2878
2878
|
command = old[i];
|
|
@@ -2882,9 +2882,9 @@ var LeaferUI = function(exports) {
|
|
|
2882
2882
|
old[i + 2] += y;
|
|
2883
2883
|
|
|
2884
2884
|
case M$5:
|
|
2885
|
-
x = old[i + 1];
|
|
2886
|
-
y = old[i + 2];
|
|
2887
|
-
data.push(
|
|
2885
|
+
x = startX = old[i + 1];
|
|
2886
|
+
y = startY = old[i + 2];
|
|
2887
|
+
data.push(M$5, x, y);
|
|
2888
2888
|
i += 3;
|
|
2889
2889
|
break;
|
|
2890
2890
|
|
|
@@ -2999,6 +2999,8 @@ var LeaferUI = function(exports) {
|
|
|
2999
2999
|
case z:
|
|
3000
3000
|
case Z$5:
|
|
3001
3001
|
data.push(Z$5);
|
|
3002
|
+
x = startX;
|
|
3003
|
+
y = startY;
|
|
3002
3004
|
i++;
|
|
3003
3005
|
break;
|
|
3004
3006
|
|
|
@@ -5686,39 +5688,45 @@ var LeaferUI = function(exports) {
|
|
|
5686
5688
|
this.__updateRenderPath();
|
|
5687
5689
|
this.__updateBoxBounds();
|
|
5688
5690
|
layout.resized = "inner";
|
|
5689
|
-
if (data.__strokeGeometry) data.__strokeGeometry = undefined;
|
|
5690
5691
|
}
|
|
5691
5692
|
if (layout.localBoxChanged) {
|
|
5692
5693
|
if (this.__local) this.__updateLocalBoxBounds();
|
|
5693
5694
|
layout.localBoxChanged = undefined;
|
|
5694
|
-
if (layout.strokeSpread) layout.strokeChanged = true;
|
|
5695
|
-
if (layout.renderSpread) layout.renderChanged = true;
|
|
5695
|
+
if (layout.strokeSpread && !layout.strokeChanged) layout.strokeChanged = layout.boxChanged ? true : 2;
|
|
5696
|
+
if (layout.renderSpread && !layout.renderChanged) layout.renderChanged = layout.boxChanged ? true : 2;
|
|
5696
5697
|
if (this.parent) this.parent.__layout.boxChange();
|
|
5697
5698
|
}
|
|
5698
5699
|
layout.boxChanged = undefined;
|
|
5699
5700
|
if (layout.strokeChanged) {
|
|
5700
|
-
layout.
|
|
5701
|
-
if (layout.strokeSpread) {
|
|
5702
|
-
if (layout.strokeBounds === layout.boxBounds) layout.spreadStroke();
|
|
5703
|
-
this.__updateStrokeBounds();
|
|
5701
|
+
if (layout.strokeChanged === 2) {
|
|
5704
5702
|
this.__updateLocalStrokeBounds();
|
|
5705
5703
|
} else {
|
|
5706
|
-
layout.
|
|
5704
|
+
layout.strokeSpread = this.__updateStrokeSpread();
|
|
5705
|
+
if (layout.strokeSpread) {
|
|
5706
|
+
if (layout.strokeBounds === layout.boxBounds) layout.spreadStroke();
|
|
5707
|
+
this.__updateStrokeBounds();
|
|
5708
|
+
this.__updateLocalStrokeBounds();
|
|
5709
|
+
} else {
|
|
5710
|
+
layout.spreadStrokeCancel();
|
|
5711
|
+
}
|
|
5712
|
+
layout.resized = "inner";
|
|
5713
|
+
if (layout.renderSpread || layout.strokeSpread !== layout.strokeBoxSpread) layout.renderChanged = true;
|
|
5707
5714
|
}
|
|
5708
5715
|
layout.strokeChanged = undefined;
|
|
5709
|
-
if (layout.renderSpread || layout.strokeSpread !== layout.strokeBoxSpread) layout.renderChanged = true;
|
|
5710
5716
|
if (this.parent) this.parent.__layout.strokeChange();
|
|
5711
|
-
layout.resized = "inner";
|
|
5712
|
-
if (data.__strokeGeometry) data.__strokeGeometry = undefined;
|
|
5713
5717
|
}
|
|
5714
5718
|
if (layout.renderChanged) {
|
|
5715
|
-
layout.
|
|
5716
|
-
if (layout.renderSpread) {
|
|
5717
|
-
if (layout.renderBounds === layout.boxBounds || layout.renderBounds === layout.strokeBounds) layout.spreadRender();
|
|
5718
|
-
this.__updateRenderBounds();
|
|
5719
|
+
if (layout.renderChanged === 2) {
|
|
5719
5720
|
this.__updateLocalRenderBounds();
|
|
5720
5721
|
} else {
|
|
5721
|
-
layout.
|
|
5722
|
+
layout.renderSpread = this.__updateRenderSpread();
|
|
5723
|
+
if (layout.renderSpread) {
|
|
5724
|
+
if (layout.renderBounds === layout.boxBounds || layout.renderBounds === layout.strokeBounds) layout.spreadRender();
|
|
5725
|
+
this.__updateRenderBounds();
|
|
5726
|
+
this.__updateLocalRenderBounds();
|
|
5727
|
+
} else {
|
|
5728
|
+
layout.spreadRenderCancel();
|
|
5729
|
+
}
|
|
5722
5730
|
}
|
|
5723
5731
|
layout.renderChanged = undefined;
|
|
5724
5732
|
if (this.parent) this.parent.__layout.renderChange();
|
|
@@ -6665,7 +6673,7 @@ var LeaferUI = function(exports) {
|
|
|
6665
6673
|
this.levelMap = null;
|
|
6666
6674
|
}
|
|
6667
6675
|
}
|
|
6668
|
-
const version = "2.1.
|
|
6676
|
+
const version = "2.1.3";
|
|
6669
6677
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6670
6678
|
get allowBackgroundColor() {
|
|
6671
6679
|
return true;
|
|
@@ -9059,7 +9067,6 @@ var LeaferUI = function(exports) {
|
|
|
9059
9067
|
const {fontSize: fontSize, italic: italic, padding: padding, __autoWidth: autoWidth, __autoHeight: autoHeight} = data;
|
|
9060
9068
|
this.__updateTextDrawData();
|
|
9061
9069
|
const {bounds: contentBounds} = data.__textDrawData;
|
|
9062
|
-
console.log(contentBounds);
|
|
9063
9070
|
const b = layout.boxBounds;
|
|
9064
9071
|
layout.contentBounds = contentBounds;
|
|
9065
9072
|
if (data.__lineHeight < fontSize) layout.renderChanged = true;
|
|
@@ -11034,7 +11041,7 @@ var LeaferUI = function(exports) {
|
|
|
11034
11041
|
needUpdate = false;
|
|
11035
11042
|
}
|
|
11036
11043
|
}
|
|
11037
|
-
if (paint.mode === "brush") PaintImage.brush(leafPaint);
|
|
11044
|
+
if (paint.mode === "brush") PaintImage.brush(leafPaint, ui);
|
|
11038
11045
|
if (!leafPaint.data) {
|
|
11039
11046
|
PaintImage.createData(leafPaint, image, paint, boxBounds);
|
|
11040
11047
|
const {transform: transform} = leafPaint.data, {opacity: opacity} = paint;
|
|
@@ -11267,8 +11274,12 @@ var LeaferUI = function(exports) {
|
|
|
11267
11274
|
scale(imageMatrix, 1 / scaleX, 1 / scaleY);
|
|
11268
11275
|
}
|
|
11269
11276
|
const imageCanvas = image.getCanvas(width, height, opacity, undefined, xGap, yGap, ui.leafer && ui.leafer.config.smooth, data.interlace);
|
|
11270
|
-
|
|
11271
|
-
|
|
11277
|
+
if (brush) {
|
|
11278
|
+
paint.style = imageCanvas;
|
|
11279
|
+
PaintImage.cacheBrush(paint, ui, canvas, renderOptions);
|
|
11280
|
+
} else {
|
|
11281
|
+
paint.style = image.getPattern(imageCanvas, data.repeat || (Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
|
|
11282
|
+
}
|
|
11272
11283
|
paint.patternId = id;
|
|
11273
11284
|
}
|
|
11274
11285
|
}
|