leafer-ui 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/README.md CHANGED
@@ -63,62 +63,6 @@
63
63
 
64
64
  [docs](https://github.com/leaferjs/docs) 在线文档仓库。
65
65
 
66
- ## 社区提问指南
67
-
68
- ### ⏰ 每周 4 天工作制
69
-
70
- LeaferJS 试行 [4 天工作制](https://www.leaferjs.com/ui/blog/2025-02-06.html)(周一、二、四、五),寻求支持请留意时间,感谢你的支持与理解。
71
-
72
- ### 一. 反馈 Bug 与建议
73
-
74
- 发现 Bug 或有改进建议?欢迎在 GitHub 上 [提交 issue](https://github.com/leaferjs/leafer-ui/issues),你的贡献能让 LeaferJS 变得更强大!
75
-
76
- ```
77
- 提交模版
78
-
79
- 【Bug/建议】xxxxxxxxxxx 标题 xxxxxxxxxxxxxx
80
-
81
- 环境:电脑 + window 11 + chrome 131 + leaferjs 1.5.1
82
-
83
- 复现步骤:请提供详细的复现逻辑及可直接运行的代码,以便更快解决问题。
84
- ```
85
-
86
- ### 二. 求助使用问题?
87
-
88
- 使用过程中遇到不懂的问题或缺失功能?我们提供了多种求助渠道,同时也招募社区管理员参与。
89
-
90
- #### 1. 社区支持(推荐)
91
-
92
- 为让更多的人可以参与解答,同时让搜索引擎收录问题(避免重复劳动),请公开求助你的问题。
93
-
94
- [前往知乎](https://www.zhihu.com/topic/736459154/unanswered) 创建一个问题并绑定话题 [#LeaferJS](https://www.zhihu.com/topic/736459154/unanswered):
95
-
96
- ```
97
- 提交模版
98
-
99
- 【leaferjs】xxxxxxxxxxx 标题 xxxxxxxxxxxxxx
100
-
101
- 环境:电脑 + window 11 + chrome 131 + leaferjs 1.5.1
102
-
103
- #LeaferJS (点击知乎提问框底部的 # 号,可绑定话题)
104
- ```
105
-
106
- 我和社区管理员们会安排固定的时间查看、回复大家的问题,也可将链接转发到 [LeaferJS 技术交流群](https://leaferjs.com/#contact) 里。多次有效回答问题即视为有意愿成为 LeaferJS 社区管理员,可 [联系我们](https://leaferjs.com/#contact) 进管理群。
107
-
108
- #### 2. 官方支持
109
-
110
- 由于资源有限,我们优先为 [金牌以上赞助用户](https://www.leaferjs.com/ui/sponsor/#%E5%BC%80%E5%8F%91%E8%B5%9E%E5%8A%A9) 和社区管理员提供支持(如优先修复 Bug、补充缺失功能)。随着资源增加,我们将招募更多专业人员,并开发系统化的 LeaferJS 场景教程。
111
-
112
- #### 3. 询问 AI (即将上线)
113
-
114
- 我们计划训练、对接外部 AI 助手,预计 **未来几个月内** 上线,可自动解答 LeaferJS 相关问题。
115
-
116
- ### 三、技术交流
117
-
118
- 欢迎加入 [LeaferJS 技术交流群](https://leaferjs.com/#contact),与社区开发者交流、分享经验、改进产品。
119
-
120
- 偶尔还有 **福利活动**,不容错过!
121
-
122
66
  ## 使命与愿景
123
67
 
124
68
  LeaferJS 致力于实现一套简洁、开放、现代化的 UI 绘图语言标准,表现力丰富,便于 AI 理解,人类可视化使用,并为数字化产品开发提供跨平台、轻量化、高性能的运行时。
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, decorationHeight } = ui.__.__textDrawData;
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
- if (decorationY)
1338
- canvas.fillRect(row.x, row.y + decorationY, row.width, decorationHeight);
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, decorationHeight } = ui.__.__textDrawData;
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
- if (decorationY)
1418
- canvas.strokeRect(row.x, row.y + decorationY, row.width, decorationHeight);
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
- const { fontSize } = style;
2756
+ let type;
2757
+ const { fontSize, textDecoration } = style;
2749
2758
  drawData.decorationHeight = fontSize / 11;
2750
- switch (style.textDecoration) {
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