leafer-ui 1.4.1 → 1.5.0
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 +13 -5
- package/dist/web.cjs +6 -5
- package/dist/web.cjs.map +1 -1
- package/dist/web.esm.js +6 -5
- 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 +34 -27
- 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 +34 -27
- 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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# leafer-ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
一款革新、好用的 Canvas 引擎, 轻松实现专业图形编辑。适用于图形编辑、小游戏、互动应用、组态软件、生成图片与短视频等场景。
|
|
4
4
|
|
|
5
5
|
[](https://www.leaferjs.com)
|
|
6
6
|
|
|
@@ -14,9 +14,14 @@
|
|
|
14
14
|
|
|
15
15
|
如果你觉得不错,请帮我们点个 [Star](https://github.com/leaferjs/leafer-ui) 🌟 ,让这个库被更多的人看见 ✨ ✨ ✨
|
|
16
16
|
|
|
17
|
-
<
|
|
17
|
+
<div style="display:flex; gap: 12px">
|
|
18
|
+
<a href="https://gitee.com/leaferjs/leafer-ui" aria-label="gitee" target="_blank" rel="noopener" >
|
|
19
|
+
<img width="98" titel="gitee" src="https://www.leaferjs.com/svg/gitee-stars.svg" />
|
|
20
|
+
</a>
|
|
21
|
+
<a target="_blank" href="https://github.com/leaferjs/leafer-ui" aria-label="github" rel="noopener">
|
|
18
22
|
<img width="120" title="github" src="https://www.leaferjs.com/svg/github-stars.svg" />
|
|
19
23
|
</a>
|
|
24
|
+
</div>
|
|
20
25
|
|
|
21
26
|
## 快速入门
|
|
22
27
|
|
|
@@ -73,7 +78,7 @@ LeaferJS 试行 [4 天工作制](https://www.leaferjs.com/ui/blog/2025-02-06.htm
|
|
|
73
78
|
|
|
74
79
|
【Bug/建议】xxxxxxxxxxx 标题 xxxxxxxxxxxxxx
|
|
75
80
|
|
|
76
|
-
环境:电脑 + window 11 + chrome 131 + leaferjs 1.
|
|
81
|
+
环境:电脑 + window 11 + chrome 131 + leaferjs 1.5.0
|
|
77
82
|
|
|
78
83
|
复现步骤:请提供详细的复现逻辑及可直接运行的代码,以便更快解决问题。
|
|
79
84
|
```
|
|
@@ -93,7 +98,7 @@ LeaferJS 试行 [4 天工作制](https://www.leaferjs.com/ui/blog/2025-02-06.htm
|
|
|
93
98
|
|
|
94
99
|
【leaferjs】xxxxxxxxxxx 标题 xxxxxxxxxxxxxx
|
|
95
100
|
|
|
96
|
-
环境:电脑 + window 11 + chrome 131 + leaferjs 1.
|
|
101
|
+
环境:电脑 + window 11 + chrome 131 + leaferjs 1.5.0
|
|
97
102
|
|
|
98
103
|
#LeaferJS (点击知乎提问框底部的 # 号,可绑定话题)
|
|
99
104
|
```
|
|
@@ -194,9 +199,12 @@ LeaferJS 致力于实现一套简洁、开放、现代化的 UI 绘图语言标
|
|
|
194
199
|
</p>
|
|
195
200
|
<p><h3 align="center">银牌赞助</h3></p>
|
|
196
201
|
<p style="display: flex;flex-wrap: wrap;justify-content: center;gap: 5px;">
|
|
197
|
-
<a target="_blank" href="https://www.u-tools.cn/plugins/detail/%E6%88%AA%E5%9B%BE%E5%B7%A5%E5%85%B7%20Plus/index.html">
|
|
202
|
+
<a target="_blank" href="https://www.u-tools.cn/plugins/detail/%E6%88%AA%E5%9B%BE%E5%B7%A5%E5%85%B7%20Plus/index.html">
|
|
198
203
|
<img width="40" title="截图工具 Plus" src="https://www.leaferjs.com/image/sponsor/user/135.png" loading="lazy" />
|
|
199
204
|
</a>
|
|
205
|
+
<a target="_blank" href="">
|
|
206
|
+
<img width="40" title="dev_chen" src="https://www.leaferjs.com/image/sponsor/user/137.jpg" loading="lazy" />
|
|
207
|
+
</a>
|
|
200
208
|
<a target="_blank" href="https://frameelf.com/">
|
|
201
209
|
<img width="40" title="边框水印精灵" src="https://www.leaferjs.com/image/sponsor/user/134.jpg" loading="lazy" />
|
|
202
210
|
</a>
|
package/dist/web.cjs
CHANGED
|
@@ -2633,13 +2633,14 @@ function toChar(data, charX, rowData, isOverflow) {
|
|
|
2633
2633
|
}
|
|
2634
2634
|
|
|
2635
2635
|
function layoutText(drawData, style) {
|
|
2636
|
-
const { rows, bounds } = drawData;
|
|
2636
|
+
const { rows, bounds } = drawData, countRows = rows.length;
|
|
2637
2637
|
const { __lineHeight, __baseLine, __letterSpacing, __clipText, textAlign, verticalAlign, paraSpacing, autoSizeAlign } = style;
|
|
2638
|
-
let { x, y, width, height } = bounds, realHeight = __lineHeight *
|
|
2638
|
+
let { x, y, width, height } = bounds, realHeight = __lineHeight * countRows + (paraSpacing ? paraSpacing * (drawData.paraNumber - 1) : 0);
|
|
2639
2639
|
let starY = __baseLine;
|
|
2640
2640
|
if (__clipText && realHeight > height) {
|
|
2641
2641
|
realHeight = Math.max(height, __lineHeight);
|
|
2642
|
-
|
|
2642
|
+
if (countRows > 1)
|
|
2643
|
+
drawData.overflow = countRows;
|
|
2643
2644
|
}
|
|
2644
2645
|
else if (height || autoSizeAlign) {
|
|
2645
2646
|
switch (verticalAlign) {
|
|
@@ -2651,7 +2652,7 @@ function layoutText(drawData, style) {
|
|
|
2651
2652
|
}
|
|
2652
2653
|
starY += y;
|
|
2653
2654
|
let row, rowX, rowWidth, layoutWidth = (width || autoSizeAlign) ? width : drawData.maxWidth;
|
|
2654
|
-
for (let i = 0, len =
|
|
2655
|
+
for (let i = 0, len = countRows; i < len; i++) {
|
|
2655
2656
|
row = rows[i];
|
|
2656
2657
|
row.x = x;
|
|
2657
2658
|
if (row.width < width || (row.width > width && !__clipText)) {
|
|
@@ -2720,7 +2721,7 @@ function clipText(drawData, style, x, width) {
|
|
|
2720
2721
|
if (i === end && charRight < right) {
|
|
2721
2722
|
break;
|
|
2722
2723
|
}
|
|
2723
|
-
else if (charRight < right && char.char !== ' ') {
|
|
2724
|
+
else if ((charRight < right && char.char !== ' ') || !i) {
|
|
2724
2725
|
row.data.splice(i + 1);
|
|
2725
2726
|
row.width -= char.width;
|
|
2726
2727
|
break;
|