leafer-ui 1.4.2 → 1.5.1
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 +15 -7
- package/dist/web.cjs +8 -7
- package/dist/web.cjs.map +1 -1
- package/dist/web.esm.js +8 -7
- 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 +29 -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 +29 -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
|
-
<
|
|
18
|
-
|
|
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" />
|
|
19
20
|
</a>
|
|
21
|
+
<a target="_blank" href="https://github.com/leaferjs/leafer-ui" aria-label="github" rel="noopener">
|
|
22
|
+
<img width="120" title="github" src="https://www.leaferjs.com/svg/github-stars.svg?d=0324" />
|
|
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.1
|
|
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.1
|
|
97
102
|
|
|
98
103
|
#LeaferJS (点击知乎提问框底部的 # 号,可绑定话题)
|
|
99
104
|
```
|
|
@@ -122,7 +127,7 @@ LeaferJS 致力于实现一套简洁、开放、现代化的 UI 绘图语言标
|
|
|
122
127
|
|
|
123
128
|
通过不断革新的图形渲染技术、配套支持, 吸引更多的开发者加入使用,建立起一个开放的生态环境,沟通有无,互相从中受益,推动行业的快速发展,并诞生出更多有创意的技术和产品。
|
|
124
129
|
|
|
125
|
-
|
|
130
|
+
我们的目标不仅是打造最前沿的 2D 和未来的 3D 引擎技术,更要创造一套简洁、开放、现代化的 UI 绘图标准。我们希望为开发者带来极致的开发体验,助力他们快速构建 AI 时代的网页、应用、设计、画布、游戏和动画等可视化生产力工具,推动下一代本地优先的 Figma、Miro、Notion、Unity、Adobe、Canva、Webflow 等创新产品的诞生。
|
|
126
131
|
|
|
127
132
|

|
|
128
133
|
|
|
@@ -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
|
@@ -124,7 +124,7 @@ class LeaferCanvas extends core.LeaferCanvasBase {
|
|
|
124
124
|
else {
|
|
125
125
|
window.addEventListener('resize', this.windowListener = () => {
|
|
126
126
|
const pixelRatio = core.Platform.devicePixelRatio;
|
|
127
|
-
if (this.pixelRatio !== pixelRatio) {
|
|
127
|
+
if (!this.config.pixelRatio && this.pixelRatio !== pixelRatio) {
|
|
128
128
|
const { width, height } = this;
|
|
129
129
|
this.emitResize({ width, height, pixelRatio });
|
|
130
130
|
}
|
|
@@ -141,7 +141,7 @@ class LeaferCanvas extends core.LeaferCanvasBase {
|
|
|
141
141
|
checkAutoBounds(parentSize) {
|
|
142
142
|
const view = this.view;
|
|
143
143
|
const { x, y, width, height } = this.autoBounds.getBoundsFrom(parentSize);
|
|
144
|
-
const size = { width, height, pixelRatio: core.Platform.devicePixelRatio };
|
|
144
|
+
const size = { width, height, pixelRatio: this.config.pixelRatio ? this.pixelRatio : core.Platform.devicePixelRatio };
|
|
145
145
|
if (!this.isSameSize(size)) {
|
|
146
146
|
const { style } = view;
|
|
147
147
|
style.marginLeft = x + 'px';
|
|
@@ -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;
|