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