@leafer-draw/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.cjs +7 -3
- package/dist/worker.esm.js +7 -3
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.esm.min.js.map +1 -1
- package/dist/worker.js +37 -26
- package/dist/worker.min.cjs +1 -1
- package/dist/worker.min.cjs.map +1 -1
- 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 +7 -7
package/dist/worker.module.js
CHANGED
|
@@ -3048,7 +3048,7 @@ const PathConvert = {
|
|
|
3048
3048
|
current.length = PathCommandLengthMap[char];
|
|
3049
3049
|
current.index = 0;
|
|
3050
3050
|
pushData(data, current.name);
|
|
3051
|
-
if (!needConvert && convertCommand[char]) needConvert = true;
|
|
3051
|
+
if (char === "m") current.name = PathCommandMap["l"]; else if (char === "M") current.name = PathCommandMap["L"]; else if (!needConvert && convertCommand[char]) needConvert = true;
|
|
3052
3052
|
} else {
|
|
3053
3053
|
if (char === "-" || char === "+") {
|
|
3054
3054
|
if (lastChar === "e" || lastChar === "E") {
|
|
@@ -3070,7 +3070,7 @@ const PathConvert = {
|
|
|
3070
3070
|
return needConvert ? PathConvert.toCanvasData(data, curveMode) : data;
|
|
3071
3071
|
},
|
|
3072
3072
|
toCanvasData(old, curveMode) {
|
|
3073
|
-
let x = 0, y = 0, x1 = 0, y1 = 0, i = 0, len = old.length, controlX, controlY, command, lastCommand, smooth;
|
|
3073
|
+
let x = 0, y = 0, x1 = 0, y1 = 0, startX = 0, startY = 0, i = 0, len = old.length, controlX, controlY, command, lastCommand, smooth;
|
|
3074
3074
|
const data = [];
|
|
3075
3075
|
while (i < len) {
|
|
3076
3076
|
command = old[i];
|
|
@@ -3080,9 +3080,9 @@ const PathConvert = {
|
|
|
3080
3080
|
old[i + 2] += y;
|
|
3081
3081
|
|
|
3082
3082
|
case M$4:
|
|
3083
|
-
x = old[i + 1];
|
|
3084
|
-
y = old[i + 2];
|
|
3085
|
-
data.push(
|
|
3083
|
+
x = startX = old[i + 1];
|
|
3084
|
+
y = startY = old[i + 2];
|
|
3085
|
+
data.push(M$4, x, y);
|
|
3086
3086
|
i += 3;
|
|
3087
3087
|
break;
|
|
3088
3088
|
|
|
@@ -3197,6 +3197,8 @@ const PathConvert = {
|
|
|
3197
3197
|
case z:
|
|
3198
3198
|
case Z$4:
|
|
3199
3199
|
data.push(Z$4);
|
|
3200
|
+
x = startX;
|
|
3201
|
+
y = startY;
|
|
3200
3202
|
i++;
|
|
3201
3203
|
break;
|
|
3202
3204
|
|
|
@@ -6081,39 +6083,45 @@ const LeafBounds = {
|
|
|
6081
6083
|
this.__updateRenderPath();
|
|
6082
6084
|
this.__updateBoxBounds();
|
|
6083
6085
|
layout.resized = "inner";
|
|
6084
|
-
if (data.__strokeGeometry) data.__strokeGeometry = undefined;
|
|
6085
6086
|
}
|
|
6086
6087
|
if (layout.localBoxChanged) {
|
|
6087
6088
|
if (this.__local) this.__updateLocalBoxBounds();
|
|
6088
6089
|
layout.localBoxChanged = undefined;
|
|
6089
|
-
if (layout.strokeSpread) layout.strokeChanged = true;
|
|
6090
|
-
if (layout.renderSpread) layout.renderChanged = true;
|
|
6090
|
+
if (layout.strokeSpread && !layout.strokeChanged) layout.strokeChanged = layout.boxChanged ? true : 2;
|
|
6091
|
+
if (layout.renderSpread && !layout.renderChanged) layout.renderChanged = layout.boxChanged ? true : 2;
|
|
6091
6092
|
if (this.parent) this.parent.__layout.boxChange();
|
|
6092
6093
|
}
|
|
6093
6094
|
layout.boxChanged = undefined;
|
|
6094
6095
|
if (layout.strokeChanged) {
|
|
6095
|
-
layout.
|
|
6096
|
-
if (layout.strokeSpread) {
|
|
6097
|
-
if (layout.strokeBounds === layout.boxBounds) layout.spreadStroke();
|
|
6098
|
-
this.__updateStrokeBounds();
|
|
6096
|
+
if (layout.strokeChanged === 2) {
|
|
6099
6097
|
this.__updateLocalStrokeBounds();
|
|
6100
6098
|
} else {
|
|
6101
|
-
layout.
|
|
6099
|
+
layout.strokeSpread = this.__updateStrokeSpread();
|
|
6100
|
+
if (layout.strokeSpread) {
|
|
6101
|
+
if (layout.strokeBounds === layout.boxBounds) layout.spreadStroke();
|
|
6102
|
+
this.__updateStrokeBounds();
|
|
6103
|
+
this.__updateLocalStrokeBounds();
|
|
6104
|
+
} else {
|
|
6105
|
+
layout.spreadStrokeCancel();
|
|
6106
|
+
}
|
|
6107
|
+
layout.resized = "inner";
|
|
6108
|
+
if (layout.renderSpread || layout.strokeSpread !== layout.strokeBoxSpread) layout.renderChanged = true;
|
|
6102
6109
|
}
|
|
6103
6110
|
layout.strokeChanged = undefined;
|
|
6104
|
-
if (layout.renderSpread || layout.strokeSpread !== layout.strokeBoxSpread) layout.renderChanged = true;
|
|
6105
6111
|
if (this.parent) this.parent.__layout.strokeChange();
|
|
6106
|
-
layout.resized = "inner";
|
|
6107
|
-
if (data.__strokeGeometry) data.__strokeGeometry = undefined;
|
|
6108
6112
|
}
|
|
6109
6113
|
if (layout.renderChanged) {
|
|
6110
|
-
layout.
|
|
6111
|
-
if (layout.renderSpread) {
|
|
6112
|
-
if (layout.renderBounds === layout.boxBounds || layout.renderBounds === layout.strokeBounds) layout.spreadRender();
|
|
6113
|
-
this.__updateRenderBounds();
|
|
6114
|
+
if (layout.renderChanged === 2) {
|
|
6114
6115
|
this.__updateLocalRenderBounds();
|
|
6115
6116
|
} else {
|
|
6116
|
-
layout.
|
|
6117
|
+
layout.renderSpread = this.__updateRenderSpread();
|
|
6118
|
+
if (layout.renderSpread) {
|
|
6119
|
+
if (layout.renderBounds === layout.boxBounds || layout.renderBounds === layout.strokeBounds) layout.spreadRender();
|
|
6120
|
+
this.__updateRenderBounds();
|
|
6121
|
+
this.__updateLocalRenderBounds();
|
|
6122
|
+
} else {
|
|
6123
|
+
layout.spreadRenderCancel();
|
|
6124
|
+
}
|
|
6117
6125
|
}
|
|
6118
6126
|
layout.renderChanged = undefined;
|
|
6119
6127
|
if (this.parent) this.parent.__layout.renderChange();
|
|
@@ -7081,7 +7089,7 @@ class LeafLevelList {
|
|
|
7081
7089
|
}
|
|
7082
7090
|
}
|
|
7083
7091
|
|
|
7084
|
-
const version = "2.1.
|
|
7092
|
+
const version = "2.1.3";
|
|
7085
7093
|
|
|
7086
7094
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
7087
7095
|
get allowBackgroundColor() {
|
|
@@ -9518,7 +9526,6 @@ let Text = class Text extends UI {
|
|
|
9518
9526
|
const {fontSize: fontSize, italic: italic, padding: padding, __autoWidth: autoWidth, __autoHeight: autoHeight} = data;
|
|
9519
9527
|
this.__updateTextDrawData();
|
|
9520
9528
|
const {bounds: contentBounds} = data.__textDrawData;
|
|
9521
|
-
console.log(contentBounds);
|
|
9522
9529
|
const b = layout.boxBounds;
|
|
9523
9530
|
layout.contentBounds = contentBounds;
|
|
9524
9531
|
if (data.__lineHeight < fontSize) layout.renderChanged = true;
|
|
@@ -10166,7 +10173,7 @@ function checkSizeAndCreateData(ui, attrName, paint, image, leafPaint, boxBounds
|
|
|
10166
10173
|
needUpdate = false;
|
|
10167
10174
|
}
|
|
10168
10175
|
}
|
|
10169
|
-
if (paint.mode === "brush") PaintImage.brush(leafPaint);
|
|
10176
|
+
if (paint.mode === "brush") PaintImage.brush(leafPaint, ui);
|
|
10170
10177
|
if (!leafPaint.data) {
|
|
10171
10178
|
PaintImage.createData(leafPaint, image, paint, boxBounds);
|
|
10172
10179
|
const {transform: transform} = leafPaint.data, {opacity: opacity} = paint;
|
|
@@ -10423,8 +10430,12 @@ function createPattern(paint, ui, canvas, renderOptions) {
|
|
|
10423
10430
|
scale(imageMatrix, 1 / scaleX, 1 / scaleY);
|
|
10424
10431
|
}
|
|
10425
10432
|
const imageCanvas = image.getCanvas(width, height, opacity, undefined, xGap, yGap, ui.leafer && ui.leafer.config.smooth, data.interlace);
|
|
10426
|
-
|
|
10427
|
-
|
|
10433
|
+
if (brush) {
|
|
10434
|
+
paint.style = imageCanvas;
|
|
10435
|
+
PaintImage.cacheBrush(paint, ui, canvas, renderOptions);
|
|
10436
|
+
} else {
|
|
10437
|
+
paint.style = image.getPattern(imageCanvas, data.repeat || (Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
|
|
10438
|
+
}
|
|
10428
10439
|
paint.patternId = id;
|
|
10429
10440
|
}
|
|
10430
10441
|
}
|