leafer-draw 1.5.1 → 1.5.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/web.cjs +31 -12
- package/dist/web.cjs.map +1 -1
- package/dist/web.esm.js +31 -12
- package/dist/web.esm.js.map +1 -1
- package/dist/web.esm.min.js +1 -1
- package/dist/web.esm.min.js.map +1 -1
- package/dist/web.js +106 -50
- package/dist/web.js.map +1 -1
- package/dist/web.min.cjs +1 -1
- package/dist/web.min.cjs.map +1 -1
- package/dist/web.min.js +1 -1
- package/dist/web.min.js.map +1 -1
- package/dist/web.module.js +106 -51
- package/dist/web.module.js.map +1 -1
- package/dist/web.module.min.js +1 -1
- package/dist/web.module.min.js.map +1 -1
- package/package.json +2 -2
package/dist/web.cjs
CHANGED
|
@@ -859,16 +859,20 @@ Object.assign(core.Creator, {
|
|
|
859
859
|
core.Platform.layout = Layouter.fullLayout;
|
|
860
860
|
|
|
861
861
|
function fillText(ui, canvas) {
|
|
862
|
-
let row;
|
|
863
|
-
const { rows, decorationY
|
|
862
|
+
let row, data = ui.__.__textDrawData;
|
|
863
|
+
const { rows, decorationY } = data;
|
|
864
864
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
865
865
|
row = rows[i];
|
|
866
866
|
if (row.text)
|
|
867
867
|
canvas.fillText(row.text, row.x, row.y);
|
|
868
868
|
else if (row.data)
|
|
869
869
|
row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
|
|
870
|
-
|
|
871
|
-
|
|
870
|
+
}
|
|
871
|
+
if (decorationY) {
|
|
872
|
+
const { decorationColor, decorationHeight } = data;
|
|
873
|
+
if (decorationColor)
|
|
874
|
+
canvas.fillStyle = decorationColor;
|
|
875
|
+
rows.forEach(row => decorationY.forEach(value => canvas.fillRect(row.x, row.y + value, row.width, decorationHeight)));
|
|
872
876
|
}
|
|
873
877
|
}
|
|
874
878
|
|
|
@@ -939,16 +943,18 @@ function drawAlignStroke(align, stroke, isStrokes, ui, canvas) {
|
|
|
939
943
|
out.recycle(ui.__nowWorld);
|
|
940
944
|
}
|
|
941
945
|
function drawTextStroke(ui, canvas) {
|
|
942
|
-
let row;
|
|
943
|
-
const { rows, decorationY
|
|
946
|
+
let row, data = ui.__.__textDrawData;
|
|
947
|
+
const { rows, decorationY } = data;
|
|
944
948
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
945
949
|
row = rows[i];
|
|
946
950
|
if (row.text)
|
|
947
951
|
canvas.strokeText(row.text, row.x, row.y);
|
|
948
952
|
else if (row.data)
|
|
949
953
|
row.data.forEach(charData => { canvas.strokeText(charData.char, charData.x, row.y); });
|
|
950
|
-
|
|
951
|
-
|
|
954
|
+
}
|
|
955
|
+
if (decorationY) {
|
|
956
|
+
const { decorationHeight } = data;
|
|
957
|
+
rows.forEach(row => decorationY.forEach(value => canvas.strokeRect(row.x, row.y + value, row.width, decorationHeight)));
|
|
952
958
|
}
|
|
953
959
|
}
|
|
954
960
|
function drawStrokesStyle(strokes, isText, ui, canvas) {
|
|
@@ -1546,6 +1552,8 @@ function recycleImage(attrName, data) {
|
|
|
1546
1552
|
}
|
|
1547
1553
|
image.unload(paints[i].loadId, !input.some((item) => item.url === url));
|
|
1548
1554
|
}
|
|
1555
|
+
else
|
|
1556
|
+
paints[i].style = null;
|
|
1549
1557
|
}
|
|
1550
1558
|
}
|
|
1551
1559
|
return recycleMap;
|
|
@@ -2278,14 +2286,25 @@ function toTextChar(row) {
|
|
|
2278
2286
|
}
|
|
2279
2287
|
|
|
2280
2288
|
function decorationText(drawData, style) {
|
|
2281
|
-
|
|
2289
|
+
let type;
|
|
2290
|
+
const { fontSize, textDecoration } = style;
|
|
2282
2291
|
drawData.decorationHeight = fontSize / 11;
|
|
2283
|
-
|
|
2292
|
+
if (typeof textDecoration === 'object') {
|
|
2293
|
+
type = textDecoration.type;
|
|
2294
|
+
if (textDecoration.color)
|
|
2295
|
+
drawData.decorationColor = draw.ColorConvert.string(textDecoration.color);
|
|
2296
|
+
}
|
|
2297
|
+
else
|
|
2298
|
+
type = textDecoration;
|
|
2299
|
+
switch (type) {
|
|
2284
2300
|
case 'under':
|
|
2285
|
-
drawData.decorationY = fontSize * 0.15;
|
|
2301
|
+
drawData.decorationY = [fontSize * 0.15];
|
|
2286
2302
|
break;
|
|
2287
2303
|
case 'delete':
|
|
2288
|
-
drawData.decorationY = -fontSize * 0.35;
|
|
2304
|
+
drawData.decorationY = [-fontSize * 0.35];
|
|
2305
|
+
break;
|
|
2306
|
+
case 'under-delete':
|
|
2307
|
+
drawData.decorationY = [fontSize * 0.15, -fontSize * 0.35];
|
|
2289
2308
|
}
|
|
2290
2309
|
}
|
|
2291
2310
|
|