@leafer-draw/node 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/node.cjs +31 -12
- package/dist/node.cjs.map +1 -1
- package/dist/node.esm.js +31 -12
- package/dist/node.esm.js.map +1 -1
- package/dist/node.esm.min.js +1 -1
- package/dist/node.esm.min.js.map +1 -1
- package/dist/node.min.cjs +1 -1
- package/dist/node.min.cjs.map +1 -1
- package/package.json +8 -8
package/dist/node.cjs
CHANGED
|
@@ -691,16 +691,20 @@ Object.assign(core.Creator, {
|
|
|
691
691
|
core.Platform.layout = Layouter.fullLayout;
|
|
692
692
|
|
|
693
693
|
function fillText(ui, canvas) {
|
|
694
|
-
let row;
|
|
695
|
-
const { rows, decorationY
|
|
694
|
+
let row, data = ui.__.__textDrawData;
|
|
695
|
+
const { rows, decorationY } = data;
|
|
696
696
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
697
697
|
row = rows[i];
|
|
698
698
|
if (row.text)
|
|
699
699
|
canvas.fillText(row.text, row.x, row.y);
|
|
700
700
|
else if (row.data)
|
|
701
701
|
row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
|
|
702
|
-
|
|
703
|
-
|
|
702
|
+
}
|
|
703
|
+
if (decorationY) {
|
|
704
|
+
const { decorationColor, decorationHeight } = data;
|
|
705
|
+
if (decorationColor)
|
|
706
|
+
canvas.fillStyle = decorationColor;
|
|
707
|
+
rows.forEach(row => decorationY.forEach(value => canvas.fillRect(row.x, row.y + value, row.width, decorationHeight)));
|
|
704
708
|
}
|
|
705
709
|
}
|
|
706
710
|
|
|
@@ -771,16 +775,18 @@ function drawAlignStroke(align, stroke, isStrokes, ui, canvas) {
|
|
|
771
775
|
out.recycle(ui.__nowWorld);
|
|
772
776
|
}
|
|
773
777
|
function drawTextStroke(ui, canvas) {
|
|
774
|
-
let row;
|
|
775
|
-
const { rows, decorationY
|
|
778
|
+
let row, data = ui.__.__textDrawData;
|
|
779
|
+
const { rows, decorationY } = data;
|
|
776
780
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
777
781
|
row = rows[i];
|
|
778
782
|
if (row.text)
|
|
779
783
|
canvas.strokeText(row.text, row.x, row.y);
|
|
780
784
|
else if (row.data)
|
|
781
785
|
row.data.forEach(charData => { canvas.strokeText(charData.char, charData.x, row.y); });
|
|
782
|
-
|
|
783
|
-
|
|
786
|
+
}
|
|
787
|
+
if (decorationY) {
|
|
788
|
+
const { decorationHeight } = data;
|
|
789
|
+
rows.forEach(row => decorationY.forEach(value => canvas.strokeRect(row.x, row.y + value, row.width, decorationHeight)));
|
|
784
790
|
}
|
|
785
791
|
}
|
|
786
792
|
function drawStrokesStyle(strokes, isText, ui, canvas) {
|
|
@@ -1346,6 +1352,8 @@ function recycleImage(attrName, data) {
|
|
|
1346
1352
|
}
|
|
1347
1353
|
image.unload(paints[i].loadId, !input.some((item) => item.url === url));
|
|
1348
1354
|
}
|
|
1355
|
+
else
|
|
1356
|
+
paints[i].style = null;
|
|
1349
1357
|
}
|
|
1350
1358
|
}
|
|
1351
1359
|
return recycleMap;
|
|
@@ -2078,14 +2086,25 @@ function toTextChar(row) {
|
|
|
2078
2086
|
}
|
|
2079
2087
|
|
|
2080
2088
|
function decorationText(drawData, style) {
|
|
2081
|
-
|
|
2089
|
+
let type;
|
|
2090
|
+
const { fontSize, textDecoration } = style;
|
|
2082
2091
|
drawData.decorationHeight = fontSize / 11;
|
|
2083
|
-
|
|
2092
|
+
if (typeof textDecoration === 'object') {
|
|
2093
|
+
type = textDecoration.type;
|
|
2094
|
+
if (textDecoration.color)
|
|
2095
|
+
drawData.decorationColor = draw.ColorConvert.string(textDecoration.color);
|
|
2096
|
+
}
|
|
2097
|
+
else
|
|
2098
|
+
type = textDecoration;
|
|
2099
|
+
switch (type) {
|
|
2084
2100
|
case 'under':
|
|
2085
|
-
drawData.decorationY = fontSize * 0.15;
|
|
2101
|
+
drawData.decorationY = [fontSize * 0.15];
|
|
2086
2102
|
break;
|
|
2087
2103
|
case 'delete':
|
|
2088
|
-
drawData.decorationY = -fontSize * 0.35;
|
|
2104
|
+
drawData.decorationY = [-fontSize * 0.35];
|
|
2105
|
+
break;
|
|
2106
|
+
case 'under-delete':
|
|
2107
|
+
drawData.decorationY = [fontSize * 0.15, -fontSize * 0.35];
|
|
2089
2108
|
}
|
|
2090
2109
|
}
|
|
2091
2110
|
|