@leafer-ui/text 1.12.4 → 2.0.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/package.json +4 -4
- package/src/CharLayout.ts +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-ui/text",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "@leafer-ui/text",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
"leaferjs"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@leafer/core": "
|
|
25
|
+
"@leafer/core": "2.0.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@leafer/interface": "
|
|
29
|
-
"@leafer-ui/interface": "
|
|
28
|
+
"@leafer/interface": "2.0.0",
|
|
29
|
+
"@leafer-ui/interface": "2.0.0"
|
|
30
30
|
}
|
|
31
31
|
}
|
package/src/CharLayout.ts
CHANGED
|
@@ -8,7 +8,7 @@ const TextMode = 2 // text: 'ab c'
|
|
|
8
8
|
export function layoutChar(drawData: ITextDrawData, style: ITextData, width: number, _height: number): void {
|
|
9
9
|
|
|
10
10
|
const { rows } = drawData
|
|
11
|
-
const { textAlign, paraIndent,
|
|
11
|
+
const { textAlign, paraIndent, __letterSpacing } = style
|
|
12
12
|
|
|
13
13
|
const justifyLast = width && textAlign.includes('both') // 最后一行是否两端对齐
|
|
14
14
|
const justify = justifyLast || (width && textAlign.includes('justify')) // 是否两端对齐文本
|
|
@@ -26,8 +26,8 @@ export function layoutChar(drawData: ITextDrawData, style: ITextData, width: num
|
|
|
26
26
|
if (justifyLetter) addLetterWidth = remainingWidth / (row.words.reduce((total, item) => total + item.data.length, 0) - 1) // remainingWidth / (lettersLength - 1)
|
|
27
27
|
else addWordWidth = wordsLength > 1 ? remainingWidth / (wordsLength - 1) : 0
|
|
28
28
|
}
|
|
29
|
-
mode = (
|
|
30
|
-
if (row.isOverflow && !
|
|
29
|
+
mode = (__letterSpacing || row.isOverflow || justifyLetter) ? CharMode : (addWordWidth ? WordMode : TextMode)
|
|
30
|
+
if (row.isOverflow && !__letterSpacing) row.textMode = true
|
|
31
31
|
|
|
32
32
|
if (mode === TextMode) {
|
|
33
33
|
|