leafer-ui 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/README.md +2 -2
- 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 +12 -12
package/README.md
CHANGED
|
@@ -78,7 +78,7 @@ LeaferJS 试行 [4 天工作制](https://www.leaferjs.com/ui/blog/2025-02-06.htm
|
|
|
78
78
|
|
|
79
79
|
【Bug/建议】xxxxxxxxxxx 标题 xxxxxxxxxxxxxx
|
|
80
80
|
|
|
81
|
-
环境:电脑 + window 11 + chrome 131 + leaferjs 1.5.
|
|
81
|
+
环境:电脑 + window 11 + chrome 131 + leaferjs 1.5.2
|
|
82
82
|
|
|
83
83
|
复现步骤:请提供详细的复现逻辑及可直接运行的代码,以便更快解决问题。
|
|
84
84
|
```
|
|
@@ -98,7 +98,7 @@ LeaferJS 试行 [4 天工作制](https://www.leaferjs.com/ui/blog/2025-02-06.htm
|
|
|
98
98
|
|
|
99
99
|
【leaferjs】xxxxxxxxxxx 标题 xxxxxxxxxxxxxx
|
|
100
100
|
|
|
101
|
-
环境:电脑 + window 11 + chrome 131 + leaferjs 1.5.
|
|
101
|
+
环境:电脑 + window 11 + chrome 131 + leaferjs 1.5.2
|
|
102
102
|
|
|
103
103
|
#LeaferJS (点击知乎提问框底部的 # 号,可绑定话题)
|
|
104
104
|
```
|
package/dist/web.cjs
CHANGED
|
@@ -1326,16 +1326,20 @@ class Interaction extends core$1.InteractionBase {
|
|
|
1326
1326
|
}
|
|
1327
1327
|
|
|
1328
1328
|
function fillText(ui, canvas) {
|
|
1329
|
-
let row;
|
|
1330
|
-
const { rows, decorationY
|
|
1329
|
+
let row, data = ui.__.__textDrawData;
|
|
1330
|
+
const { rows, decorationY } = data;
|
|
1331
1331
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
1332
1332
|
row = rows[i];
|
|
1333
1333
|
if (row.text)
|
|
1334
1334
|
canvas.fillText(row.text, row.x, row.y);
|
|
1335
1335
|
else if (row.data)
|
|
1336
1336
|
row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
|
|
1337
|
-
|
|
1338
|
-
|
|
1337
|
+
}
|
|
1338
|
+
if (decorationY) {
|
|
1339
|
+
const { decorationColor, decorationHeight } = data;
|
|
1340
|
+
if (decorationColor)
|
|
1341
|
+
canvas.fillStyle = decorationColor;
|
|
1342
|
+
rows.forEach(row => decorationY.forEach(value => canvas.fillRect(row.x, row.y + value, row.width, decorationHeight)));
|
|
1339
1343
|
}
|
|
1340
1344
|
}
|
|
1341
1345
|
|
|
@@ -1406,16 +1410,18 @@ function drawAlignStroke(align, stroke, isStrokes, ui, canvas) {
|
|
|
1406
1410
|
out.recycle(ui.__nowWorld);
|
|
1407
1411
|
}
|
|
1408
1412
|
function drawTextStroke(ui, canvas) {
|
|
1409
|
-
let row;
|
|
1410
|
-
const { rows, decorationY
|
|
1413
|
+
let row, data = ui.__.__textDrawData;
|
|
1414
|
+
const { rows, decorationY } = data;
|
|
1411
1415
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
1412
1416
|
row = rows[i];
|
|
1413
1417
|
if (row.text)
|
|
1414
1418
|
canvas.strokeText(row.text, row.x, row.y);
|
|
1415
1419
|
else if (row.data)
|
|
1416
1420
|
row.data.forEach(charData => { canvas.strokeText(charData.char, charData.x, row.y); });
|
|
1417
|
-
|
|
1418
|
-
|
|
1421
|
+
}
|
|
1422
|
+
if (decorationY) {
|
|
1423
|
+
const { decorationHeight } = data;
|
|
1424
|
+
rows.forEach(row => decorationY.forEach(value => canvas.strokeRect(row.x, row.y + value, row.width, decorationHeight)));
|
|
1419
1425
|
}
|
|
1420
1426
|
}
|
|
1421
1427
|
function drawStrokesStyle(strokes, isText, ui, canvas) {
|
|
@@ -2013,6 +2019,8 @@ function recycleImage(attrName, data) {
|
|
|
2013
2019
|
}
|
|
2014
2020
|
image.unload(paints[i].loadId, !input.some((item) => item.url === url));
|
|
2015
2021
|
}
|
|
2022
|
+
else
|
|
2023
|
+
paints[i].style = null;
|
|
2016
2024
|
}
|
|
2017
2025
|
}
|
|
2018
2026
|
return recycleMap;
|
|
@@ -2745,14 +2753,25 @@ function toTextChar(row) {
|
|
|
2745
2753
|
}
|
|
2746
2754
|
|
|
2747
2755
|
function decorationText(drawData, style) {
|
|
2748
|
-
|
|
2756
|
+
let type;
|
|
2757
|
+
const { fontSize, textDecoration } = style;
|
|
2749
2758
|
drawData.decorationHeight = fontSize / 11;
|
|
2750
|
-
|
|
2759
|
+
if (typeof textDecoration === 'object') {
|
|
2760
|
+
type = textDecoration.type;
|
|
2761
|
+
if (textDecoration.color)
|
|
2762
|
+
drawData.decorationColor = draw.ColorConvert.string(textDecoration.color);
|
|
2763
|
+
}
|
|
2764
|
+
else
|
|
2765
|
+
type = textDecoration;
|
|
2766
|
+
switch (type) {
|
|
2751
2767
|
case 'under':
|
|
2752
|
-
drawData.decorationY = fontSize * 0.15;
|
|
2768
|
+
drawData.decorationY = [fontSize * 0.15];
|
|
2753
2769
|
break;
|
|
2754
2770
|
case 'delete':
|
|
2755
|
-
drawData.decorationY = -fontSize * 0.35;
|
|
2771
|
+
drawData.decorationY = [-fontSize * 0.35];
|
|
2772
|
+
break;
|
|
2773
|
+
case 'under-delete':
|
|
2774
|
+
drawData.decorationY = [fontSize * 0.15, -fontSize * 0.35];
|
|
2756
2775
|
}
|
|
2757
2776
|
}
|
|
2758
2777
|
|