@leafer-ui/text 1.0.0-beta.7 → 1.0.0-beta.9
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/package.json +4 -4
- package/src/TextLayout.ts +2 -0
- package/src/TextRows.ts +7 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-ui/text",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.9",
|
|
4
4
|
"description": "@leafer-ui/text",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
"leaferjs"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@leafer-ui/core": "1.0.0-beta.
|
|
22
|
+
"@leafer-ui/core": "1.0.0-beta.9"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@leafer/interface": "1.0.0-beta.
|
|
26
|
-
"@leafer-ui/interface": "1.0.0-beta.
|
|
25
|
+
"@leafer/interface": "1.0.0-beta.9",
|
|
26
|
+
"@leafer-ui/interface": "1.0.0-beta.9"
|
|
27
27
|
}
|
|
28
28
|
}
|
package/src/TextLayout.ts
CHANGED
package/src/TextRows.ts
CHANGED
|
@@ -23,7 +23,7 @@ export function createRows(drawData: ITextDrawData, content: string, style: ITex
|
|
|
23
23
|
const { __letterSpacing, paraIndent, textCase } = style
|
|
24
24
|
const { canvas } = Platform
|
|
25
25
|
const { width, height } = bounds
|
|
26
|
-
const charMode = width || height || __letterSpacing || textCase
|
|
26
|
+
const charMode = width || height || __letterSpacing || (textCase !== 'none')
|
|
27
27
|
|
|
28
28
|
if (charMode) {
|
|
29
29
|
|
|
@@ -74,7 +74,11 @@ export function createRows(drawData: ITextDrawData, content: string, style: ITex
|
|
|
74
74
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
if (
|
|
77
|
+
if (char === ' ' && paraStart !== true && (rowWidth + wordWidth) === 0) {
|
|
78
|
+
|
|
79
|
+
// trim space
|
|
80
|
+
|
|
81
|
+
} else {
|
|
78
82
|
|
|
79
83
|
if (charType === Break) {
|
|
80
84
|
|
|
@@ -136,9 +140,8 @@ function addRow(): void {
|
|
|
136
140
|
paraStart = false
|
|
137
141
|
}
|
|
138
142
|
row.width = rowWidth
|
|
139
|
-
trimRight(row)
|
|
143
|
+
if (bounds.width) trimRight(row)
|
|
140
144
|
rows.push(row)
|
|
141
|
-
if (row.width > bounds.width) bounds.width = row.width
|
|
142
145
|
row = { words: [] }
|
|
143
146
|
rowWidth = 0
|
|
144
147
|
}
|