@leafer-ui/text 1.8.0 → 1.9.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer-ui/text",
3
- "version": "1.8.0",
3
+ "version": "1.9.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": "1.8.0"
25
+ "@leafer/core": "1.9.0"
26
26
  },
27
27
  "devDependencies": {
28
- "@leafer/interface": "1.8.0",
29
- "@leafer-ui/interface": "1.8.0"
28
+ "@leafer/interface": "1.9.0",
29
+ "@leafer-ui/interface": "1.9.0"
30
30
  }
31
31
  }
@@ -1,4 +1,4 @@
1
- import { Platform, Direction4 } from '@leafer/core'
1
+ import { Platform, Direction4, isString } from '@leafer/core'
2
2
 
3
3
  import { ITextData, ITextDrawData } from '@leafer-ui/interface'
4
4
 
@@ -13,7 +13,7 @@ const { top, right, bottom, left } = Direction4
13
13
 
14
14
  export function getDrawData(content: string | number, style: ITextData): ITextDrawData {
15
15
 
16
- if (typeof content !== 'string') content = String(content)
16
+ if (!isString(content)) content = String(content)
17
17
 
18
18
  let x = 0, y = 0
19
19
 
@@ -1,5 +1,6 @@
1
- import { ITextData, ITextDecorationType, ITextDrawData } from '@leafer-ui/interface'
1
+ import { isObject } from '@leafer/core'
2
2
 
3
+ import { ITextData, ITextDecorationType, ITextDrawData } from '@leafer-ui/interface'
3
4
  import { ColorConvert } from '@leafer-ui/draw'
4
5
 
5
6
 
@@ -7,7 +8,7 @@ export function decorationText(drawData: ITextDrawData, style: ITextData): void
7
8
  let type: ITextDecorationType
8
9
  const { fontSize, textDecoration } = style
9
10
  drawData.decorationHeight = fontSize / 11
10
- if (typeof textDecoration === 'object') {
11
+ if (isObject(textDecoration)) {
11
12
  type = textDecoration.type
12
13
  if (textDecoration.color) drawData.decorationColor = ColorConvert.string(textDecoration.color)
13
14
  } else type = textDecoration