@leafer-ui/text 1.0.0-rc.22 → 1.0.0-rc.23

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.
Files changed (2) hide show
  1. package/package.json +4 -4
  2. package/src/TextClip.ts +4 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer-ui/text",
3
- "version": "1.0.0-rc.22",
3
+ "version": "1.0.0-rc.23",
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.0.0-rc.22"
25
+ "@leafer/core": "1.0.0-rc.23"
26
26
  },
27
27
  "devDependencies": {
28
- "@leafer/interface": "1.0.0-rc.22",
29
- "@leafer-ui/interface": "1.0.0-rc.22"
28
+ "@leafer/interface": "1.0.0-rc.23",
29
+ "@leafer-ui/interface": "1.0.0-rc.23"
30
30
  }
31
31
  }
package/src/TextClip.ts CHANGED
@@ -9,12 +9,12 @@ export function clipText(drawData: ITextDrawData, style: ITextData): void {
9
9
  let { textOverflow } = style
10
10
  rows.splice(overflow)
11
11
 
12
-
13
- if (textOverflow !== 'hide') {
14
- if (textOverflow === 'ellipsis') textOverflow = '...'
12
+ if (textOverflow && textOverflow !== 'show') {
13
+ if (textOverflow === 'hide') textOverflow = ''
14
+ else if (textOverflow === 'ellipsis') textOverflow = '...'
15
15
 
16
16
  let char: ITextCharData, charRight: number
17
- const ellipsisWidth = Platform.canvas.measureText(textOverflow).width
17
+ const ellipsisWidth = textOverflow ? Platform.canvas.measureText(textOverflow).width : 0
18
18
  const right = style.x + style.width - ellipsisWidth
19
19
  const list = style.textWrap === 'none' ? rows : [rows[overflow - 1]]
20
20