@leafer-ui/text 1.3.0 → 1.3.2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer-ui/text",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
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": "1.3.0"
25
+ "@leafer/core": "1.3.2"
26
26
  },
27
27
  "devDependencies": {
28
- "@leafer/interface": "1.3.0",
29
- "@leafer-ui/interface": "1.3.0"
28
+ "@leafer/interface": "1.3.2",
29
+ "@leafer-ui/interface": "1.3.2"
30
30
  }
31
31
  }
package/src/CharLayout.ts CHANGED
@@ -15,7 +15,7 @@ export function layoutChar(drawData: ITextDrawData, style: ITextData, width: num
15
15
  if (row.words) {
16
16
 
17
17
  indentWidth = paraIndent && row.paraStart ? paraIndent : 0
18
- addWordWidth = (width && textAlign === 'justify' && row.words.length > 1) ? (width - row.width - indentWidth) / (row.words.length - 1) : 0
18
+ addWordWidth = (width && (textAlign === 'justify' || textAlign === 'both') && row.words.length > 1) ? (width - row.width - indentWidth) / (row.words.length - 1) : 0
19
19
  mode = (letterSpacing || row.isOverflow) ? CharMode : (addWordWidth > 0.01 ? WordMode : TextMode)
20
20
  if (row.isOverflow && !letterSpacing) row.textMode = true
21
21
 
@@ -44,7 +44,7 @@ export function layoutChar(drawData: ITextDrawData, style: ITextData, width: num
44
44
 
45
45
  }
46
46
 
47
- if (!row.paraEnd && addWordWidth) {
47
+ if (addWordWidth && (!row.paraEnd || textAlign === 'both')) {
48
48
  charX += addWordWidth
49
49
  row.width += addWordWidth
50
50
  }