@leafer-draw/worker 1.5.0 → 1.5.2
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 +31 -12
- package/dist/worker.cjs.map +1 -1
- package/dist/worker.esm.js +31 -12
- package/dist/worker.esm.js.map +1 -1
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.esm.min.js.map +1 -1
- package/dist/worker.js +109 -57
- package/dist/worker.js.map +1 -1
- 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 +109 -58
- package/dist/worker.module.js.map +1 -1
- 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.esm.js
CHANGED
|
@@ -679,16 +679,20 @@ Object.assign(Creator, {
|
|
|
679
679
|
Platform.layout = Layouter.fullLayout;
|
|
680
680
|
|
|
681
681
|
function fillText(ui, canvas) {
|
|
682
|
-
let row;
|
|
683
|
-
const { rows, decorationY
|
|
682
|
+
let row, data = ui.__.__textDrawData;
|
|
683
|
+
const { rows, decorationY } = data;
|
|
684
684
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
685
685
|
row = rows[i];
|
|
686
686
|
if (row.text)
|
|
687
687
|
canvas.fillText(row.text, row.x, row.y);
|
|
688
688
|
else if (row.data)
|
|
689
689
|
row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
|
|
690
|
-
|
|
691
|
-
|
|
690
|
+
}
|
|
691
|
+
if (decorationY) {
|
|
692
|
+
const { decorationColor, decorationHeight } = data;
|
|
693
|
+
if (decorationColor)
|
|
694
|
+
canvas.fillStyle = decorationColor;
|
|
695
|
+
rows.forEach(row => decorationY.forEach(value => canvas.fillRect(row.x, row.y + value, row.width, decorationHeight)));
|
|
692
696
|
}
|
|
693
697
|
}
|
|
694
698
|
|
|
@@ -759,16 +763,18 @@ function drawAlignStroke(align, stroke, isStrokes, ui, canvas) {
|
|
|
759
763
|
out.recycle(ui.__nowWorld);
|
|
760
764
|
}
|
|
761
765
|
function drawTextStroke(ui, canvas) {
|
|
762
|
-
let row;
|
|
763
|
-
const { rows, decorationY
|
|
766
|
+
let row, data = ui.__.__textDrawData;
|
|
767
|
+
const { rows, decorationY } = data;
|
|
764
768
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
765
769
|
row = rows[i];
|
|
766
770
|
if (row.text)
|
|
767
771
|
canvas.strokeText(row.text, row.x, row.y);
|
|
768
772
|
else if (row.data)
|
|
769
773
|
row.data.forEach(charData => { canvas.strokeText(charData.char, charData.x, row.y); });
|
|
770
|
-
|
|
771
|
-
|
|
774
|
+
}
|
|
775
|
+
if (decorationY) {
|
|
776
|
+
const { decorationHeight } = data;
|
|
777
|
+
rows.forEach(row => decorationY.forEach(value => canvas.strokeRect(row.x, row.y + value, row.width, decorationHeight)));
|
|
772
778
|
}
|
|
773
779
|
}
|
|
774
780
|
function drawStrokesStyle(strokes, isText, ui, canvas) {
|
|
@@ -1366,6 +1372,8 @@ function recycleImage(attrName, data) {
|
|
|
1366
1372
|
}
|
|
1367
1373
|
image.unload(paints[i].loadId, !input.some((item) => item.url === url));
|
|
1368
1374
|
}
|
|
1375
|
+
else
|
|
1376
|
+
paints[i].style = null;
|
|
1369
1377
|
}
|
|
1370
1378
|
}
|
|
1371
1379
|
return recycleMap;
|
|
@@ -2098,14 +2106,25 @@ function toTextChar(row) {
|
|
|
2098
2106
|
}
|
|
2099
2107
|
|
|
2100
2108
|
function decorationText(drawData, style) {
|
|
2101
|
-
|
|
2109
|
+
let type;
|
|
2110
|
+
const { fontSize, textDecoration } = style;
|
|
2102
2111
|
drawData.decorationHeight = fontSize / 11;
|
|
2103
|
-
|
|
2112
|
+
if (typeof textDecoration === 'object') {
|
|
2113
|
+
type = textDecoration.type;
|
|
2114
|
+
if (textDecoration.color)
|
|
2115
|
+
drawData.decorationColor = ColorConvert.string(textDecoration.color);
|
|
2116
|
+
}
|
|
2117
|
+
else
|
|
2118
|
+
type = textDecoration;
|
|
2119
|
+
switch (type) {
|
|
2104
2120
|
case 'under':
|
|
2105
|
-
drawData.decorationY = fontSize * 0.15;
|
|
2121
|
+
drawData.decorationY = [fontSize * 0.15];
|
|
2106
2122
|
break;
|
|
2107
2123
|
case 'delete':
|
|
2108
|
-
drawData.decorationY = -fontSize * 0.35;
|
|
2124
|
+
drawData.decorationY = [-fontSize * 0.35];
|
|
2125
|
+
break;
|
|
2126
|
+
case 'under-delete':
|
|
2127
|
+
drawData.decorationY = [fontSize * 0.15, -fontSize * 0.35];
|
|
2109
2128
|
}
|
|
2110
2129
|
}
|
|
2111
2130
|
|