@leafer-ui/display 1.0.0-rc.5 → 1.0.0-rc.7

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/display",
3
- "version": "1.0.0-rc.5",
3
+ "version": "1.0.0-rc.7",
4
4
  "description": "@leafer-ui/display",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -22,14 +22,14 @@
22
22
  "leaferjs"
23
23
  ],
24
24
  "dependencies": {
25
- "@leafer/core": "1.0.0-rc.5",
26
- "@leafer-ui/data": "1.0.0-rc.5",
27
- "@leafer-ui/display-module": "1.0.0-rc.5",
28
- "@leafer-ui/decorator": "1.0.0-rc.5",
29
- "@leafer-ui/external": "1.0.0-rc.5"
25
+ "@leafer/core": "1.0.0-rc.7",
26
+ "@leafer-ui/data": "1.0.0-rc.7",
27
+ "@leafer-ui/display-module": "1.0.0-rc.7",
28
+ "@leafer-ui/decorator": "1.0.0-rc.7",
29
+ "@leafer-ui/external": "1.0.0-rc.7"
30
30
  },
31
31
  "devDependencies": {
32
- "@leafer/interface": "1.0.0-rc.5",
33
- "@leafer-ui/interface": "1.0.0-rc.5"
32
+ "@leafer/interface": "1.0.0-rc.7",
33
+ "@leafer-ui/interface": "1.0.0-rc.7"
34
34
  }
35
35
  }
package/src/Box.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ILeaferCanvas, IRenderOptions, IPathDrawer, IBoundsData, IPathCommandData, __Boolean } from '@leafer/interface'
1
+ import { ILeaferCanvas, IRenderOptions, IPathDrawer, IBoundsData, IPathCommandData } from '@leafer/interface'
2
2
  import { rewrite, rewriteAble, registerUI, BoundsHelper, dataProcessor, affectRenderBoundsType } from '@leafer/core'
3
3
 
4
4
  import { IBox, IBoxData, IBoxInputData, IOverflow } from '@leafer-ui/interface'
@@ -25,14 +25,21 @@ export class Box extends Group implements IBox {
25
25
  @affectRenderBoundsType('show')
26
26
  declare public overflow: IOverflow
27
27
 
28
- public get resizeable(): boolean { return true }
29
-
30
28
  constructor(data?: IBoxInputData) {
31
29
  super(data)
32
30
  this.isBranchLeaf = true
33
31
  this.__layout.renderChanged || this.__layout.renderChange()
34
32
  }
35
33
 
34
+ public __scaleResize(scaleX: number, scaleY: number): void {
35
+ if (this.__.__autoBounds && this.children.length) {
36
+ super.__scaleResize(scaleX, scaleY)
37
+ } else {
38
+ this.width *= scaleX
39
+ this.height *= scaleY
40
+ }
41
+ }
42
+
36
43
  @rewrite(rect.__updateStrokeSpread)
37
44
  public __updateStrokeSpread(): number { return 0 }
38
45
 
@@ -48,7 +55,15 @@ export class Box extends Group implements IBox {
48
55
 
49
56
 
50
57
  @rewrite(rect.__updateBoxBounds)
51
- public __updateBoxBounds(): void { }
58
+ public __updateRectBoxBounds(): void { }
59
+
60
+ public __updateBoxBounds(): void {
61
+ if (this.__.__autoBounds && this.children.length) {
62
+ super.__updateBoxBounds()
63
+ } else {
64
+ this.__updateRectBoxBounds()
65
+ }
66
+ }
52
67
 
53
68
  @rewrite(rect.__updateStrokeBounds)
54
69
  public __updateStrokeBounds(): void { }
package/src/Canvas.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ILeaferCanvas, ILeaferCanvasConfig, __String, __Number, IRenderOptions, IPointData, ICanvasContext2D, IScreenSizeData, ISizeData, IHitType } from '@leafer/interface'
1
+ import { ILeaferCanvas, ILeaferCanvasConfig, INumber, IRenderOptions, IPointData, ICanvasContext2D, IScreenSizeData, ISizeData, IHitType } from '@leafer/interface'
2
2
  import { Creator, Matrix, Platform, dataProcessor, registerUI, hitType } from '@leafer/core'
3
3
 
4
4
  import { ICanvas, ICanvasData, ICanvasInputData, IUI } from '@leafer-ui/interface'
@@ -17,13 +17,13 @@ export class Canvas extends Rect implements ICanvas {
17
17
  declare public __: ICanvasData
18
18
 
19
19
  @resizeType(100)
20
- declare public width: __Number
20
+ declare public width: INumber
21
21
 
22
22
  @resizeType(100)
23
- declare public height: __Number
23
+ declare public height: INumber
24
24
 
25
25
  @resizeType(Platform.devicePixelRatio)
26
- public pixelRatio: __Number
26
+ public pixelRatio: INumber
27
27
 
28
28
  @resizeType(true)
29
29
  public smooth: boolean
@@ -43,7 +43,7 @@ export class Canvas extends Rect implements ICanvas {
43
43
  }
44
44
 
45
45
  public draw(ui: IUI, offset?: IPointData, scale?: number | IPointData, rotation?: number): void {
46
- ui.__layout.checkUpdate()
46
+ ui.__layout.update()
47
47
 
48
48
  const matrix = new Matrix(ui.__world)
49
49
  matrix.invert()
@@ -52,7 +52,7 @@ export class Canvas extends Rect implements ICanvas {
52
52
  if (offset) m.translate(offset.x, offset.y)
53
53
  if (scale) typeof scale === 'number' ? m.scale(scale) : m.scale(scale.x, scale.y)
54
54
  if (rotation) m.rotate(rotation)
55
- matrix.preMultiply(m)
55
+ matrix.multiplyParent(m)
56
56
 
57
57
  ui.__render(this.canvas, { matrix })
58
58
  this.paint()
package/src/Ellipse.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { __Number } from '@leafer/interface'
2
- import { PathCommandDataHelper, PathConvert, Platform, dataProcessor, pathType, registerUI } from '@leafer/core'
1
+ import { INumber } from '@leafer/interface'
2
+ import { PathCommandDataHelper, Platform, dataProcessor, pathType, registerUI } from '@leafer/core'
3
3
 
4
4
  import { IEllipse, IEllipseInputData, IEllipseData } from '@leafer-ui/interface'
5
5
  import { EllipseData } from '@leafer-ui/data'
@@ -18,13 +18,13 @@ export class Ellipse extends UI implements IEllipse {
18
18
  declare public __: IEllipseData
19
19
 
20
20
  @pathType(0)
21
- public innerRadius: __Number
21
+ public innerRadius: INumber
22
22
 
23
23
  @pathType(0)
24
- public startAngle: __Number
24
+ public startAngle: INumber
25
25
 
26
26
  @pathType(0)
27
- public endAngle: __Number
27
+ public endAngle: INumber
28
28
 
29
29
  constructor(data?: IEllipseInputData) {
30
30
  super(data)
@@ -52,7 +52,7 @@ export class Ellipse extends UI implements IEllipse {
52
52
  }
53
53
 
54
54
  // fix node
55
- if (Platform.name === 'node') this.__.path = PathConvert.toCanvasData(path, true)
55
+ if (Platform.ellipseToCurve) this.__.path = this.getPath(true)
56
56
 
57
57
  } else {
58
58
 
package/src/Frame.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { __Boolean } from '@leafer/interface'
2
1
  import { dataProcessor, registerUI, affectRenderBoundsType } from '@leafer/core'
3
2
 
4
3
  import { IFrame, IFrameData, IFrameInputData, IOverflow } from '@leafer-ui/interface'
@@ -20,6 +19,7 @@ export class Frame extends Box implements IFrame {
20
19
 
21
20
  constructor(data?: IFrameInputData) {
22
21
  super(data)
22
+ this.isFrame = true
23
23
  if (!this.__.fill) this.__.fill = '#FFFFFF'
24
24
  }
25
25
  }
package/src/Group.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Branch, useModule, dataProcessor, registerUI, UICreator } from '@leafer/core'
1
+ import { Branch, useModule, dataProcessor, registerUI, UICreator, MatrixHelper } from '@leafer/core'
2
2
 
3
3
  import { IGroup, IGroupData, IGroupInputData, IUI, IUIInputData } from '@leafer-ui/interface'
4
4
  import { GroupData } from '@leafer-ui/data'
@@ -6,6 +6,8 @@ import { GroupData } from '@leafer-ui/data'
6
6
  import { UI } from './UI'
7
7
 
8
8
 
9
+ const matrix = MatrixHelper.get()
10
+
9
11
  @useModule(Branch)
10
12
  @registerUI()
11
13
  export class Group extends UI implements IGroup {
@@ -17,8 +19,6 @@ export class Group extends UI implements IGroup {
17
19
 
18
20
  declare public children: IUI[]
19
21
 
20
- public get resizeable(): boolean { return false }
21
-
22
22
  public set mask(child: IUI) {
23
23
  if (this.__hasMask) this.__removeMask()
24
24
  if (child) {
@@ -74,6 +74,15 @@ export class Group extends UI implements IGroup {
74
74
  return data
75
75
  }
76
76
 
77
+ public __scaleResize(scaleX: number, scaleY: number): void {
78
+ const { children } = this
79
+ for (let i = 0; i < children.length; i++) {
80
+ matrix.a = scaleX // must update
81
+ matrix.d = scaleY
82
+ children[i].transform(matrix, true)
83
+ }
84
+ }
85
+
77
86
  // add
78
87
 
79
88
  public addAt(child: IUI, index: number): void {
package/src/Image.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ILeaferImage, __String } from '@leafer/interface'
1
+ import { ILeaferImage, IString } from '@leafer/interface'
2
2
  import { ImageEvent, boundsType, dataProcessor, registerUI } from '@leafer/core'
3
3
 
4
4
  import { IImage, IImageInputData, IImageData, IImagePaint } from '@leafer-ui/interface'
@@ -16,7 +16,7 @@ export class Image extends Rect implements IImage {
16
16
  declare public __: IImageData
17
17
 
18
18
  @boundsType('')
19
- public url: __String
19
+ public url: IString
20
20
 
21
21
  public get ready(): boolean { return this.image ? this.image.ready : false }
22
22
 
package/src/Line.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { IPointData, __Number } from '@leafer/interface'
2
- import { PathBounds, PathCommandDataHelper, PointHelper, boundsType, pathType, affectStrokeBoundsType, dataProcessor, registerUI } from '@leafer/core'
1
+ import { IPointData, INumber } from '@leafer/interface'
2
+ import { PathBounds, PathCommandDataHelper, PointHelper, boundsType, pathType, affectStrokeBoundsType, dataProcessor, registerUI, PathScaler } from '@leafer/core'
3
3
 
4
4
  import { ILine, ILineData, ILineInputData, IStrokeAlign } from '@leafer-ui/interface'
5
5
  import { LineData } from '@leafer-ui/data'
@@ -24,7 +24,7 @@ export class Line extends UI implements ILine {
24
24
  declare public strokeAlign: IStrokeAlign
25
25
 
26
26
  @boundsType(0)
27
- declare public height: __Number
27
+ declare public height: INumber
28
28
 
29
29
  @pathType()
30
30
  public points: number[]
@@ -32,9 +32,6 @@ export class Line extends UI implements ILine {
32
32
  @pathType(0)
33
33
  public curve: boolean | number
34
34
 
35
- public get resizeable(): boolean { return !this.points }
36
-
37
-
38
35
  public get toPoint(): IPointData {
39
36
  const { width, rotation } = this.__
40
37
  const to: IPointData = { x: 0, y: 0 }
@@ -74,7 +71,7 @@ export class Line extends UI implements ILine {
74
71
 
75
72
  public __updateRenderPath(): void {
76
73
  if (this.__.points && this.__.curve) {
77
- drawPoints(this.__.__pathForRender = [], this.__.points, this.__.curve, false)
74
+ drawPoints(this.__.__pathForRender = [], this.__.points, this.__.curve, this.__tag !== 'Line')
78
75
  } else {
79
76
  super.__updateRenderPath()
80
77
  }
@@ -83,10 +80,27 @@ export class Line extends UI implements ILine {
83
80
  public __updateBoxBounds(): void {
84
81
  if (this.points) {
85
82
  toBounds(this.__.__pathForRender, this.__layout.boxBounds)
86
- this.__updateNaturalSize()
87
83
  } else {
88
84
  super.__updateBoxBounds()
89
85
  }
90
86
  }
91
87
 
88
+ public __scaleResize(scaleX: number, scaleY: number): void {
89
+ if (this.points) {
90
+ PathScaler.scalePoints(this.__.points, scaleX, scaleY)
91
+ this.points = this.__.points
92
+ } else {
93
+
94
+ if (this.__tag === 'Line') {
95
+ const point = this.toPoint
96
+ point.x *= scaleX
97
+ point.y *= scaleY
98
+ this.toPoint = point
99
+ } else {
100
+ // Polygon ...
101
+ super.__scaleResize(scaleX, scaleY)
102
+ }
103
+ }
104
+ }
105
+
92
106
  }
package/src/Path.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { IPathCommandData, IWindingRule } from '@leafer/interface'
2
- import { PathBounds, dataProcessor, pathType, affectStrokeBoundsType, registerUI } from '@leafer/core'
2
+ import { PathBounds, dataProcessor, pathType, affectStrokeBoundsType, registerUI, PathScaler } from '@leafer/core'
3
3
 
4
4
  import { IPath, IPathData, IPathInputData, IPathString, IStrokeAlign } from '@leafer-ui/interface'
5
5
  import { PathData } from '@leafer-ui/data'
@@ -26,15 +26,17 @@ export class Path extends UI implements IPath {
26
26
  @affectStrokeBoundsType('center')
27
27
  declare public strokeAlign: IStrokeAlign
28
28
 
29
- public get resizeable(): boolean { return false }
30
-
31
29
  constructor(data?: IPathInputData) {
32
30
  super(data)
33
31
  }
34
32
 
33
+ public __scaleResize(scaleX: number, scaleY: number): void {
34
+ PathScaler.scale(this.__.path, scaleX, scaleY)
35
+ this.path = this.__.path
36
+ }
37
+
35
38
  public __updateBoxBounds(): void {
36
39
  toBounds(this.__.path, this.__layout.boxBounds)
37
- this.__updateNaturalSize()
38
40
  }
39
41
 
40
42
  }
package/src/Polygon.ts CHANGED
@@ -1,16 +1,18 @@
1
- import { __Number } from '@leafer/interface'
2
- import { PathBounds, PathCommandDataHelper, dataProcessor, pathType, registerUI } from '@leafer/core'
1
+ import { INumber } from '@leafer/interface'
2
+ import { PathCommandDataHelper, dataProcessor, pathType, registerUI, rewrite, rewriteAble } from '@leafer/core'
3
3
 
4
4
  import { IPolygon, IPolygonData, IPolygonInputData } from '@leafer-ui/interface'
5
5
  import { PolygonData } from '@leafer-ui/data'
6
6
 
7
7
  import { UI } from './UI'
8
+ import { Line } from './Line'
8
9
 
9
10
 
10
11
  const { sin, cos, PI } = Math
11
12
  const { moveTo, lineTo, closePath, drawPoints } = PathCommandDataHelper
12
- const { toBounds } = PathBounds
13
+ const line = Line.prototype
13
14
 
15
+ @rewriteAble()
14
16
  @registerUI()
15
17
  export class Polygon extends UI implements IPolygon {
16
18
 
@@ -20,7 +22,7 @@ export class Polygon extends UI implements IPolygon {
20
22
  declare public __: IPolygonData
21
23
 
22
24
  @pathType(3)
23
- sides: number
25
+ sides: INumber
24
26
 
25
27
  @pathType()
26
28
  points: number[]
@@ -28,8 +30,6 @@ export class Polygon extends UI implements IPolygon {
28
30
  @pathType(0)
29
31
  curve: boolean | number
30
32
 
31
- public get resizeable(): boolean { return !this.points }
32
-
33
33
  constructor(data?: IPolygonInputData) {
34
34
  super(data)
35
35
  }
@@ -58,22 +58,13 @@ export class Polygon extends UI implements IPolygon {
58
58
  closePath(path)
59
59
  }
60
60
 
61
+ @rewrite(line.__updateRenderPath)
62
+ public __updateRenderPath(): void { }
61
63
 
62
- public __updateRenderPath(): void {
63
- if (this.__.points && this.__.curve) {
64
- drawPoints(this.__.__pathForRender = [], this.__.points, this.__.curve, true)
65
- } else {
66
- super.__updateRenderPath()
67
- }
68
- }
64
+ @rewrite(line.__updateBoxBounds)
65
+ public __updateBoxBounds(): void { }
69
66
 
70
- public __updateBoxBounds(): void {
71
- if (this.__.points) {
72
- toBounds(this.__.__pathForRender, this.__layout.boxBounds)
73
- this.__updateNaturalSize()
74
- } else {
75
- super.__updateBoxBounds()
76
- }
77
- }
67
+ @rewrite(line.__scaleResize)
68
+ public __scaleResize(_scaleX: number, _scaleY: number): void { }
78
69
 
79
70
  }
package/src/Rect.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { IPathDrawer, IPathCommandData, __Number } from '@leafer/interface'
2
- import { dataProcessor, registerUI, useModule } from '@leafer/core'
1
+ import { IPathDrawer, IPathCommandData } from '@leafer/interface'
2
+ import { dataProcessor, registerUI, rewrite, rewriteAble, useModule } from '@leafer/core'
3
3
 
4
4
  import { IRect, IRectInputData, IRectData } from '@leafer-ui/interface'
5
5
  import { RectData } from '@leafer-ui/data'
@@ -9,6 +9,7 @@ import { UI } from './UI'
9
9
 
10
10
 
11
11
  @useModule(RectRender)
12
+ @rewriteAble()
12
13
  @registerUI()
13
14
  export class Rect extends UI implements IRect {
14
15
 
@@ -21,12 +22,7 @@ export class Rect extends UI implements IRect {
21
22
  super(data)
22
23
  }
23
24
 
24
- public __drawPathByData(drawer: IPathDrawer, _data: IPathCommandData): void {
25
- const { width, height, cornerRadius } = this.__
26
- if (cornerRadius) {
27
- drawer.roundRect(0, 0, width, height, cornerRadius)
28
- } else {
29
- drawer.rect(0, 0, width, height)
30
- }
31
- }
25
+ @rewrite(UI.prototype.__drawPathByBox)
26
+ public __drawPathByData(_drawer: IPathDrawer, _data: IPathCommandData): void { }
27
+
32
28
  }
package/src/Star.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { __Number } from '@leafer/interface'
1
+ import { INumber } from '@leafer/interface'
2
2
  import { PathCommandDataHelper, dataProcessor, pathType, registerUI } from '@leafer/core'
3
3
 
4
4
  import { IStar, IStarData, IStarInputData } from '@leafer-ui/interface'
@@ -20,10 +20,10 @@ export class Star extends UI implements IStar {
20
20
  declare public __: IStarData
21
21
 
22
22
  @pathType(5)
23
- public corners: __Number
23
+ public corners: INumber
24
24
 
25
25
  @pathType(0.382)
26
- public innerRadius: __Number
26
+ public innerRadius: INumber
27
27
 
28
28
  constructor(data?: IStarInputData) {
29
29
  super(data)
package/src/Text.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { ILeaferCanvas, IPathDrawer, IPathCommandData, __Boolean, __Number, __String } from '@leafer/interface'
2
- import { BoundsHelper, boundsType, dataProcessor, registerUI, affectStrokeBoundsType } from '@leafer/core'
1
+ import { ILeaferCanvas, IPathDrawer, IPathCommandData, IBoolean, INumber, IString, IBoundsData } from '@leafer/interface'
2
+ import { BoundsHelper, boundsType, surfaceType, dataProcessor, registerUI, affectStrokeBoundsType, hitType, MathHelper } from '@leafer/core'
3
3
 
4
- import { IText, IFontWeight, ITextCase, ITextDecoration, ITextData, ITextInputData, ITextAlign, IVerticalAlign, ITextDrawData, IOverflow, IUnitData, IStrokeAlign } from '@leafer-ui/interface'
4
+ import { IFill, IText, IFontWeight, ITextCase, ITextDecoration, ITextData, ITextInputData, ITextAlign, IVerticalAlign, ITextDrawData, IOverflow, IUnitData, IStrokeAlign, IHitType, ITextWrap } from '@leafer-ui/interface'
5
5
  import { TextData, UnitConvert } from '@leafer-ui/data'
6
6
 
7
7
  import { TextConvert } from '@leafer-ui/external'
@@ -9,7 +9,7 @@ import { TextConvert } from '@leafer-ui/external'
9
9
  import { UI } from './UI'
10
10
 
11
11
 
12
- const { copyAndSpread, includes, spread } = BoundsHelper
12
+ const { copyAndSpread, includes, spread, setList } = BoundsHelper
13
13
 
14
14
  @registerUI()
15
15
  export class Text extends UI implements IText {
@@ -21,31 +21,37 @@ export class Text extends UI implements IText {
21
21
 
22
22
  // size
23
23
  @boundsType(0)
24
- declare public width: __Number
24
+ declare public width: INumber
25
25
 
26
26
  @boundsType(0)
27
- declare public height: __Number
27
+ declare public height: INumber
28
28
 
29
29
  @boundsType(0)
30
30
  public padding: number | number[]
31
31
 
32
+ @surfaceType('#000000')
33
+ declare public fill: IFill
34
+
32
35
  @affectStrokeBoundsType('outside')
33
36
  declare public strokeAlign: IStrokeAlign
34
37
 
38
+ @hitType('all')
39
+ declare public hitFill: IHitType
40
+
35
41
  @boundsType('')
36
- public text: __String
42
+ public text: IString
37
43
 
38
44
  @boundsType('L')
39
- public fontFamily: __String
45
+ public fontFamily: IString
40
46
 
41
47
  @boundsType(12)
42
- public fontSize: __Number
48
+ public fontSize: INumber
43
49
 
44
50
  @boundsType('normal')
45
51
  public fontWeight: IFontWeight
46
52
 
47
53
  @boundsType(false)
48
- public italic: __Boolean
54
+ public italic: IBoolean
49
55
 
50
56
  @boundsType('none')
51
57
  public textCase: ITextCase
@@ -54,16 +60,16 @@ export class Text extends UI implements IText {
54
60
  public textDecoration: ITextDecoration
55
61
 
56
62
  @boundsType(0)
57
- public letterSpacing: __Number | IUnitData
63
+ public letterSpacing: INumber | IUnitData
58
64
 
59
65
  @boundsType({ type: 'percent', value: 150 } as IUnitData)
60
- public lineHeight: __Number | IUnitData
66
+ public lineHeight: INumber | IUnitData
61
67
 
62
68
  @boundsType(0)
63
- public paraIndent: __Number
69
+ public paraIndent: INumber
64
70
 
65
71
  @boundsType(0)
66
- public paraSpacing: __Number
72
+ public paraSpacing: INumber
67
73
 
68
74
  @boundsType('left')
69
75
  public textAlign: ITextAlign
@@ -71,11 +77,14 @@ export class Text extends UI implements IText {
71
77
  @boundsType('top')
72
78
  public verticalAlign: IVerticalAlign
73
79
 
80
+ @boundsType('normal')
81
+ public textWrap: ITextWrap
82
+
74
83
  @boundsType('show')
75
84
  public textOverflow: IOverflow | string
76
85
 
77
86
  public get textDrawData(): ITextDrawData {
78
- this.__layout.checkUpdate()
87
+ this.__layout.update()
79
88
  return this.__.__textDrawData
80
89
  }
81
90
 
@@ -114,7 +123,10 @@ export class Text extends UI implements IText {
114
123
 
115
124
  const data = this.__
116
125
  const layout = this.__layout
117
- const { lineHeight, letterSpacing, fontFamily, fontSize, fontWeight, italic, textCase } = data
126
+ const { lineHeight, letterSpacing, fontFamily, fontSize, fontWeight, italic, textCase, textOverflow } = data
127
+
128
+ const autoWidth = data.__autoWidth
129
+ const autoHeight = data.__autoHeight
118
130
 
119
131
  // compute
120
132
 
@@ -122,6 +134,7 @@ export class Text extends UI implements IText {
122
134
  data.__letterSpacing = UnitConvert.number(letterSpacing, fontSize)
123
135
  data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * 0.7) / 2
124
136
  data.__font = `${italic ? 'italic ' : ''}${textCase === 'small-caps' ? 'small-caps ' : ''}${fontWeight !== 'normal' ? fontWeight + ' ' : ''}${fontSize}px ${fontFamily}`
137
+ data.__clipText = textOverflow !== 'show' && !data.__autoBounds
125
138
 
126
139
  this.__updateTextDrawData()
127
140
 
@@ -130,23 +143,36 @@ export class Text extends UI implements IText {
130
143
 
131
144
  if (data.__lineHeight < fontSize) spread(bounds, fontSize / 2)
132
145
 
133
- const width = data.__getInput('width')
134
- const height = data.__getInput('height')
135
-
136
- if (width && height) {
137
- super.__updateBoxBounds()
138
- } else {
139
- b.x = width ? 0 : bounds.x
140
- b.y = height ? 0 : bounds.y
141
- b.width = width ? width : bounds.width
142
- b.height = height ? height : bounds.height
146
+ if (autoWidth || autoHeight) {
147
+ b.x = autoWidth ? bounds.x : 0
148
+ b.y = autoHeight ? bounds.y : 0
149
+ b.width = autoWidth ? bounds.width : data.width
150
+ b.height = autoHeight ? bounds.height : data.height
151
+
152
+ const { padding } = data
153
+ if (padding) {
154
+ const [top, right, bottom, left] = MathHelper.fourNumber(padding)
155
+ if (autoWidth) {
156
+ b.x -= left
157
+ b.width += (right + left)
158
+ }
159
+ if (autoHeight) {
160
+ b.y -= top
161
+ b.height += (bottom + top)
162
+ }
163
+ }
143
164
  this.__updateNaturalSize()
165
+ } else {
166
+ super.__updateBoxBounds()
144
167
  }
145
168
 
146
169
  const contentBounds = includes(b, bounds) ? b : bounds
147
170
  if (contentBounds !== layout.contentBounds) {
148
171
  layout.contentBounds = contentBounds
149
172
  layout.renderChanged = true
173
+ setList(data.__textBoxBounds = {} as IBoundsData, [b, bounds])
174
+ } else {
175
+ data.__textBoxBounds = contentBounds
150
176
  }
151
177
 
152
178
  }
@@ -158,7 +184,7 @@ export class Text extends UI implements IText {
158
184
  }
159
185
 
160
186
  public __updateRenderBounds(): void {
161
- copyAndSpread(this.__layout.renderBounds, this.__layout.contentBounds, this.__layout.renderSpread)
187
+ copyAndSpread(this.__layout.renderBounds, this.__.__textBoxBounds, this.__layout.renderSpread)
162
188
  }
163
189
 
164
190
  }
package/src/UI.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { ILeaferCanvas, IPathDrawer, IPathCommandData, IHitType, __Number, __Boolean, __String, IPathString, IExportFileType, IPointData, ICursorType, IAround } from '@leafer/interface'
2
- import { Leaf, PathDrawer, surfaceType, dataType, positionType, boundsType, pathType, scaleType, rotationType, opacityType, sortType, maskType, dataProcessor, useModule, rewrite, rewriteAble, UICreator, PathCorner, hitType, strokeType, PathConvert, eraserType, cursorType } from '@leafer/core'
1
+ import { ILeaferCanvas, IPathDrawer, IPathCommandData, IHitType, INumber, IBoolean, IString, IPathString, IExportFileType, IPointData, ICursorType, IAround, IFindMethod } from '@leafer/interface'
2
+ import { Leaf, PathDrawer, surfaceType, dataType, positionType, boundsType, pathType, scaleType, rotationType, opacityType, sortType, maskType, dataProcessor, useModule, rewrite, rewriteAble, UICreator, PathCorner, hitType, strokeType, PathConvert, eraserType, cursorType, autoLayoutType } from '@leafer/core'
3
3
 
4
- import { IUI, IShadowEffect, IBlurEffect, IPaint, IStrokeAlign, IStrokeJoin, IStrokeCap, IBlendMode, IPaintString, IDashPatternString, IShadowString, IGrayscaleEffect, IUIData, IGroup, IStrokeWidthString, ICornerRadiusString, IUIInputData, IExportOptions, IExportResult } from '@leafer-ui/interface'
4
+ import { IUI, IShadowEffect, IBlurEffect, IStrokeAlign, IStrokeJoin, IStrokeCap, IBlendMode, IDashPatternString, IShadowString, IGrayscaleEffect, IUIData, IGroup, IStrokeWidthString, ICornerRadiusString, IUIInputData, IExportOptions, IExportResult, IFill, IStroke, IFindUIMethod, IEditSize, ILeafer } from '@leafer-ui/interface'
5
5
  import { effectType } from '@leafer-ui/decorator'
6
6
 
7
7
  import { UIData } from '@leafer-ui/data'
@@ -19,19 +19,29 @@ export class UI extends Leaf implements IUI {
19
19
  @dataProcessor(UIData)
20
20
  declare public __: IUIData
21
21
 
22
+ declare public proxyData?: IUIInputData // need rewrite getter
23
+ declare public __proxyData?: IUIInputData
24
+
25
+ public get app(): ILeafer { return this.leafer && this.leafer.app }
26
+
27
+ declare public leafer?: ILeafer
22
28
  declare public parent?: IGroup
23
29
 
30
+ public isFrame?: boolean
31
+
32
+ declare public children?: IUI[]
33
+
24
34
  // ---
25
35
 
26
36
  // id
27
37
  @dataType('')
28
- public id: __String
38
+ public id: IString
29
39
 
30
40
  @dataType('')
31
- public name: __String
41
+ public name: IString
32
42
 
33
43
  @dataType('')
34
- public className: __String
44
+ public className: IString
35
45
 
36
46
 
37
47
  // layer
@@ -39,67 +49,75 @@ export class UI extends Leaf implements IUI {
39
49
  public blendMode: IBlendMode
40
50
 
41
51
  @opacityType(1)
42
- public opacity: __Number
52
+ public opacity: INumber
43
53
 
44
54
  @opacityType(true)
45
- public visible: __Boolean
55
+ public visible: IBoolean
46
56
 
47
57
  @maskType(false)
48
- public isMask: __Boolean
58
+ public isMask: IBoolean
49
59
 
50
60
  @eraserType(false)
51
- public isEraser?: __Boolean
61
+ public isEraser?: IBoolean
52
62
 
53
- @sortType(0)
54
- public zIndex: __Number
63
+ @dataType(false)
64
+ public locked: IBoolean
55
65
 
56
- @dataType()
57
- public locked: __Boolean
66
+ @sortType(0)
67
+ public zIndex: INumber
58
68
 
59
69
 
60
70
  // position
61
71
  @positionType(0)
62
- public x: __Number
72
+ public x: INumber
63
73
 
64
74
  @positionType(0)
65
- public y: __Number
75
+ public y: INumber
66
76
 
67
77
  // size
68
78
  @boundsType(100)
69
- public width: __Number
79
+ public width: INumber
70
80
 
71
81
  @boundsType(100)
72
- public height: __Number
82
+ public height: INumber
73
83
 
74
84
  // scale
75
85
  @scaleType(1)
76
- public scaleX: __Number
86
+ public scaleX: INumber
77
87
 
78
88
  @scaleType(1)
79
- public scaleY: __Number
89
+ public scaleY: INumber
80
90
 
81
91
  // rotate
82
92
  @rotationType(0)
83
- public rotation: __Number
93
+ public rotation: INumber
84
94
 
85
95
  // skew
86
96
  @rotationType(0)
87
- public skewX: __Number
97
+ public skewX: INumber
88
98
 
89
99
  @rotationType(0)
90
- public skewY: __Number
100
+ public skewY: INumber
91
101
 
92
102
 
93
- @positionType()
103
+ @autoLayoutType()
94
104
  public around: IAround
95
105
 
96
106
 
97
107
  @dataType(false)
98
- public draggable: __Boolean
108
+ public draggable: IBoolean
109
+
110
+
111
+ @dataType(false)
112
+ public editable: IBoolean
113
+
114
+ @dataType('size')
115
+ public editSize?: IEditSize
116
+
99
117
 
100
118
  // hit
101
119
  @hitType(true)
102
- public hittable: __Boolean
120
+ public hittable: IBoolean
103
121
 
104
122
  @hitType('path')
105
123
  public hitFill: IHitType
@@ -107,14 +125,17 @@ export class UI extends Leaf implements IUI {
107
125
  @strokeType('path')
108
126
  public hitStroke: IHitType
109
127
 
128
+ @hitType(false)
129
+ public hitBox: IBoolean
130
+
110
131
  @hitType(true)
111
- public hitChildren: __Boolean
132
+ public hitChildren: IBoolean
112
133
 
113
134
  @hitType(true)
114
- public hitSelf: __Boolean
135
+ public hitSelf: IBoolean
115
136
 
116
137
  @hitType()
117
- public hitRadius: __Number
138
+ public hitRadius: INumber
118
139
 
119
140
  @cursorType('')
120
141
  public cursor: ICursorType | ICursorType[]
@@ -125,12 +146,12 @@ export class UI extends Leaf implements IUI {
125
146
  // fill
126
147
 
127
148
  @surfaceType()
128
- public fill: IPaint | IPaint[] | IPaintString
149
+ public fill: IFill
129
150
 
130
151
  // stroke
131
152
 
132
153
  @strokeType()
133
- public stroke: IPaint | IPaint[] | IPaintString
154
+ public stroke: IStroke
134
155
 
135
156
  @strokeType('inside')
136
157
  public strokeAlign: IStrokeAlign
@@ -145,22 +166,22 @@ export class UI extends Leaf implements IUI {
145
166
  public strokeJoin: IStrokeJoin
146
167
 
147
168
  @strokeType()
148
- public dashPattern: __Number[] | IDashPatternString
169
+ public dashPattern: INumber[] | IDashPatternString
149
170
 
150
171
  @strokeType()
151
- public dashOffset: __Number
172
+ public dashOffset: INumber
152
173
 
153
174
  @strokeType(10)
154
- public miterLimit: __Number
175
+ public miterLimit: INumber
155
176
 
156
177
 
157
178
  // corner
158
179
 
159
- @pathType()
180
+ @pathType(0)
160
181
  public cornerRadius: number | number[] | ICornerRadiusString
161
182
 
162
183
  @pathType()
163
- public cornerSmoothing: __Number
184
+ public cornerSmoothing: INumber
164
185
 
165
186
  // effect
166
187
 
@@ -171,16 +192,16 @@ export class UI extends Leaf implements IUI {
171
192
  public innerShadow: IShadowEffect | IShadowEffect[] | IShadowString
172
193
 
173
194
  @effectType()
174
- public blur: __Number | IBlurEffect
195
+ public blur: INumber | IBlurEffect
175
196
 
176
197
  @effectType()
177
- public backgroundBlur: __Number | IBlurEffect
198
+ public backgroundBlur: INumber | IBlurEffect
178
199
 
179
200
  @effectType()
180
- public grayscale: __Number | IGrayscaleEffect
201
+ public grayscale: INumber | IGrayscaleEffect
181
202
 
182
203
 
183
- public set scale(value: __Number | IPointData) {
204
+ public set scale(value: INumber | IPointData) {
184
205
  if (typeof value === 'number') {
185
206
  this.scaleX = this.scaleY = value
186
207
  } else {
@@ -189,12 +210,19 @@ export class UI extends Leaf implements IUI {
189
210
  }
190
211
  }
191
212
 
192
- public get scale(): __Number | IPointData {
213
+ public get scale(): INumber | IPointData {
193
214
  const { scaleX, scaleY } = this
194
215
  return scaleX !== scaleY ? { x: scaleX, y: scaleY } : scaleX
195
216
  }
196
217
 
197
218
 
219
+ constructor(data?: IUIInputData) {
220
+ super(data)
221
+ }
222
+
223
+
224
+ // data
225
+
198
226
  @rewrite(Leaf.prototype.reset)
199
227
  public reset(_data?: IUIInputData): void { }
200
228
 
@@ -207,9 +235,24 @@ export class UI extends Leaf implements IUI {
207
235
  return this.__.__getInputData()
208
236
  }
209
237
 
238
+ public createProxyData(): IUIInputData { return undefined }
239
+
240
+
241
+ // find
242
+
243
+ public find(condition: number | string | IFindUIMethod, options?: any): IUI[] {
244
+ return this.leafer ? this.leafer.selector.getBy(condition as IFindMethod, this, false, options) as IUI[] : []
245
+ }
246
+
247
+ public findOne(condition: number | string | IFindUIMethod, options?: any): IUI {
248
+ return this.leafer ? this.leafer.selector.getBy(condition as IFindMethod, this, true, options) as IUI : null
249
+ }
250
+
251
+
252
+ // path
210
253
 
211
254
  public getPath(curve?: boolean): IPathCommandData {
212
- const path = this.__.path
255
+ const { path } = this.__
213
256
  if (!path) return []
214
257
  return curve ? PathConvert.toCanvasData(path, true) : path
215
258
  }
@@ -247,6 +290,18 @@ export class UI extends Leaf implements IUI {
247
290
  @rewrite(PathDrawer.drawPathByData)
248
291
  public __drawPathByData(_drawer: IPathDrawer, _data: IPathCommandData): void { }
249
292
 
293
+ public __drawPathByBox(drawer: IPathDrawer): void {
294
+ const { x, y, width, height } = this.__layout.boxBounds
295
+ if (this.__.cornerRadius) {
296
+ drawer.roundRect(x, y, width, height, this.__.cornerRadius)
297
+ } else {
298
+ drawer.rect(x, y, width, height)
299
+ }
300
+ }
301
+
302
+
303
+ // create
304
+
250
305
  public export(filename: IExportFileType | string, options?: IExportOptions | number | boolean): Promise<IExportResult> {
251
306
  return Export.export(this, filename, options)
252
307
  }
@@ -259,6 +314,7 @@ export class UI extends Leaf implements IUI {
259
314
  return UICreator.get(data.tag || this.prototype.__tag, data, x, y, width, height) as IUI
260
315
  }
261
316
 
317
+
262
318
  public destroy(): void {
263
319
  this.fill = this.stroke = null
264
320
  super.destroy()
package/types/index.d.ts CHANGED
@@ -1,59 +1,72 @@
1
- import { __String, __Number, __Boolean, IAround, IHitType, ICursorType, IPointData, IPathCommandData, IPathString, ILeaferCanvas, IPathDrawer, IExportFileType, IRenderOptions, ILeaferImage, ICanvasContext2D, IWindingRule } from '@leafer/interface';
1
+ import { IString, INumber, IBoolean, IAround, IHitType, ICursorType, IPointData, IPathCommandData, IPathString, ILeaferCanvas, IPathDrawer, IExportFileType, IRenderOptions, ILeaferImage, ICanvasContext2D, IWindingRule } from '@leafer/interface';
2
2
  import { Leaf } from '@leafer/core';
3
- import { IUI, IUIData, IGroup, IBlendMode, IPaint, IPaintString, IStrokeAlign, IStrokeWidthString, IStrokeCap, IStrokeJoin, IDashPatternString, ICornerRadiusString, IShadowEffect, IShadowString, IBlurEffect, IGrayscaleEffect, IUIInputData, IExportOptions, IExportResult, IGroupData, IGroupInputData, IBox, IBoxData, IOverflow, IBoxInputData, IFrame, IFrameData, IFrameInputData, IRect, IRectData, IRectInputData, IEllipse, IEllipseData, IEllipseInputData, IPolygon, IPolygonData, IPolygonInputData, IStar, IStarData, IStarInputData, ILine, ILineData, ILineInputData, IImage, IImageData, IImageInputData, ICanvas, ICanvasData, ICanvasInputData, IText, ITextData, IFontWeight, ITextCase, ITextDecoration, IUnitData, ITextAlign, IVerticalAlign, ITextDrawData, ITextInputData, IPath, IPathData, IPathString as IPathString$1, IPathInputData, IPen, IPenData, IPathCommandData as IPathCommandData$1, IPenInputData } from '@leafer-ui/interface';
3
+ import { IUI, IUIData, IUIInputData, ILeafer, IGroup, IBlendMode, IEditSize, IFill, IStroke, IStrokeAlign, IStrokeWidthString, IStrokeCap, IStrokeJoin, IDashPatternString, ICornerRadiusString, IShadowEffect, IShadowString, IBlurEffect, IGrayscaleEffect, IFindUIMethod, IExportOptions, IExportResult, IGroupData, IGroupInputData, IBox, IBoxData, IOverflow, IBoxInputData, IFrame, IFrameData, IFrameInputData, IRect, IRectData, IRectInputData, IEllipse, IEllipseData, IEllipseInputData, IPolygon, IPolygonData, IPolygonInputData, IStar, IStarData, IStarInputData, ILine, ILineData, ILineInputData, IImage, IImageData, IImageInputData, ICanvas, ICanvasData, ICanvasInputData, IText, ITextData, IHitType as IHitType$1, IFontWeight, ITextCase, ITextDecoration, IUnitData, ITextAlign, IVerticalAlign, ITextWrap, ITextDrawData, ITextInputData, IPath, IPathData, IPathString as IPathString$1, IPathInputData, IPen, IPenData, IPathCommandData as IPathCommandData$1, IPenInputData } from '@leafer-ui/interface';
4
4
 
5
5
  declare class UI extends Leaf implements IUI {
6
6
  __: IUIData;
7
+ proxyData?: IUIInputData;
8
+ __proxyData?: IUIInputData;
9
+ get app(): ILeafer;
10
+ leafer?: ILeafer;
7
11
  parent?: IGroup;
8
- id: __String;
9
- name: __String;
10
- className: __String;
12
+ isFrame?: boolean;
13
+ children?: IUI[];
14
+ id: IString;
15
+ name: IString;
16
+ className: IString;
11
17
  blendMode: IBlendMode;
12
- opacity: __Number;
13
- visible: __Boolean;
14
- isMask: __Boolean;
15
- isEraser?: __Boolean;
16
- zIndex: __Number;
17
- locked: __Boolean;
18
- x: __Number;
19
- y: __Number;
20
- width: __Number;
21
- height: __Number;
22
- scaleX: __Number;
23
- scaleY: __Number;
24
- rotation: __Number;
25
- skewX: __Number;
26
- skewY: __Number;
18
+ opacity: INumber;
19
+ visible: IBoolean;
20
+ isMask: IBoolean;
21
+ isEraser?: IBoolean;
22
+ locked: IBoolean;
23
+ zIndex: INumber;
24
+ x: INumber;
25
+ y: INumber;
26
+ width: INumber;
27
+ height: INumber;
28
+ scaleX: INumber;
29
+ scaleY: INumber;
30
+ rotation: INumber;
31
+ skewX: INumber;
32
+ skewY: INumber;
27
33
  around: IAround;
28
- draggable: __Boolean;
29
- hittable: __Boolean;
34
+ draggable: IBoolean;
35
+ editable: IBoolean;
36
+ editSize?: IEditSize;
37
+ hittable: IBoolean;
30
38
  hitFill: IHitType;
31
39
  hitStroke: IHitType;
32
- hitChildren: __Boolean;
33
- hitSelf: __Boolean;
34
- hitRadius: __Number;
40
+ hitBox: IBoolean;
41
+ hitChildren: IBoolean;
42
+ hitSelf: IBoolean;
43
+ hitRadius: INumber;
35
44
  cursor: ICursorType | ICursorType[];
36
- fill: IPaint | IPaint[] | IPaintString;
37
- stroke: IPaint | IPaint[] | IPaintString;
45
+ fill: IFill;
46
+ stroke: IStroke;
38
47
  strokeAlign: IStrokeAlign;
39
48
  strokeWidth: number | number[] | IStrokeWidthString;
40
49
  strokeCap: IStrokeCap;
41
50
  strokeJoin: IStrokeJoin;
42
- dashPattern: __Number[] | IDashPatternString;
43
- dashOffset: __Number;
44
- miterLimit: __Number;
51
+ dashPattern: INumber[] | IDashPatternString;
52
+ dashOffset: INumber;
53
+ miterLimit: INumber;
45
54
  cornerRadius: number | number[] | ICornerRadiusString;
46
- cornerSmoothing: __Number;
55
+ cornerSmoothing: INumber;
47
56
  shadow: IShadowEffect | IShadowEffect[] | IShadowString;
48
57
  innerShadow: IShadowEffect | IShadowEffect[] | IShadowString;
49
- blur: __Number | IBlurEffect;
50
- backgroundBlur: __Number | IBlurEffect;
51
- grayscale: __Number | IGrayscaleEffect;
52
- set scale(value: __Number | IPointData);
53
- get scale(): __Number | IPointData;
58
+ blur: INumber | IBlurEffect;
59
+ backgroundBlur: INumber | IBlurEffect;
60
+ grayscale: INumber | IGrayscaleEffect;
61
+ set scale(value: INumber | IPointData);
62
+ get scale(): INumber | IPointData;
63
+ constructor(data?: IUIInputData);
54
64
  reset(_data?: IUIInputData): void;
55
65
  set(data: IUIInputData): void;
56
66
  get(): IUIInputData;
67
+ createProxyData(): IUIInputData;
68
+ find(condition: number | string | IFindUIMethod, options?: any): IUI[];
69
+ findOne(condition: number | string | IFindUIMethod, options?: any): IUI;
57
70
  getPath(curve?: boolean): IPathCommandData;
58
71
  getPathString(curve?: boolean): IPathString;
59
72
  __onUpdateSize(): void;
@@ -61,6 +74,7 @@ declare class UI extends Leaf implements IUI {
61
74
  __drawRenderPath(canvas: ILeaferCanvas): void;
62
75
  __drawPath(canvas: ILeaferCanvas): void;
63
76
  __drawPathByData(_drawer: IPathDrawer, _data: IPathCommandData): void;
77
+ __drawPathByBox(drawer: IPathDrawer): void;
64
78
  export(filename: IExportFileType | string, options?: IExportOptions | number | boolean): Promise<IExportResult>;
65
79
  clone(): IUI;
66
80
  static one(data: IUIInputData, x?: number, y?: number, width?: number, height?: number): IUI;
@@ -71,13 +85,13 @@ declare class Group extends UI implements IGroup {
71
85
  get __tag(): string;
72
86
  __: IGroupData;
73
87
  children: IUI[];
74
- get resizeable(): boolean;
75
88
  set mask(child: IUI);
76
89
  get mask(): IUI;
77
90
  constructor(data?: IGroupInputData);
78
91
  __setBranch(): void;
79
92
  set(data: IUIInputData): void;
80
93
  toJSON(): IUIInputData;
94
+ __scaleResize(scaleX: number, scaleY: number): void;
81
95
  addAt(child: IUI, index: number): void;
82
96
  addAfter(child: IUI, after: IUI): void;
83
97
  addBefore(child: UI, before: IUI): void;
@@ -91,11 +105,12 @@ declare class Box extends Group implements IBox {
91
105
  get __tag(): string;
92
106
  __: IBoxData;
93
107
  overflow: IOverflow;
94
- get resizeable(): boolean;
95
108
  constructor(data?: IBoxInputData);
109
+ __scaleResize(scaleX: number, scaleY: number): void;
96
110
  __updateStrokeSpread(): number;
97
111
  __updateRectRenderSpread(): number;
98
112
  __updateRenderSpread(): number;
113
+ __updateRectBoxBounds(): void;
99
114
  __updateBoxBounds(): void;
100
115
  __updateStrokeBounds(): void;
101
116
  __updateRenderBounds(): void;
@@ -120,15 +135,15 @@ declare class Rect extends UI implements IRect {
120
135
  get __tag(): string;
121
136
  __: IRectData;
122
137
  constructor(data?: IRectInputData);
123
- __drawPathByData(drawer: IPathDrawer, _data: IPathCommandData): void;
138
+ __drawPathByData(_drawer: IPathDrawer, _data: IPathCommandData): void;
124
139
  }
125
140
 
126
141
  declare class Ellipse extends UI implements IEllipse {
127
142
  get __tag(): string;
128
143
  __: IEllipseData;
129
- innerRadius: __Number;
130
- startAngle: __Number;
131
- endAngle: __Number;
144
+ innerRadius: INumber;
145
+ startAngle: INumber;
146
+ endAngle: INumber;
132
147
  constructor(data?: IEllipseInputData);
133
148
  __updatePath(): void;
134
149
  }
@@ -136,21 +151,21 @@ declare class Ellipse extends UI implements IEllipse {
136
151
  declare class Polygon extends UI implements IPolygon {
137
152
  get __tag(): string;
138
153
  __: IPolygonData;
139
- sides: number;
154
+ sides: INumber;
140
155
  points: number[];
141
156
  curve: boolean | number;
142
- get resizeable(): boolean;
143
157
  constructor(data?: IPolygonInputData);
144
158
  __updatePath(): void;
145
159
  __updateRenderPath(): void;
146
160
  __updateBoxBounds(): void;
161
+ __scaleResize(_scaleX: number, _scaleY: number): void;
147
162
  }
148
163
 
149
164
  declare class Star extends UI implements IStar {
150
165
  get __tag(): string;
151
166
  __: IStarData;
152
- corners: __Number;
153
- innerRadius: __Number;
167
+ corners: INumber;
168
+ innerRadius: INumber;
154
169
  constructor(data?: IStarInputData);
155
170
  __updatePath(): void;
156
171
  }
@@ -159,22 +174,22 @@ declare class Line extends UI implements ILine {
159
174
  get __tag(): string;
160
175
  __: ILineData;
161
176
  strokeAlign: IStrokeAlign;
162
- height: __Number;
177
+ height: INumber;
163
178
  points: number[];
164
179
  curve: boolean | number;
165
- get resizeable(): boolean;
166
180
  get toPoint(): IPointData;
167
181
  set toPoint(value: IPointData);
168
182
  constructor(data?: ILineInputData);
169
183
  __updatePath(): void;
170
184
  __updateRenderPath(): void;
171
185
  __updateBoxBounds(): void;
186
+ __scaleResize(scaleX: number, scaleY: number): void;
172
187
  }
173
188
 
174
189
  declare class Image extends Rect implements IImage {
175
190
  get __tag(): string;
176
191
  __: IImageData;
177
- url: __String;
192
+ url: IString;
178
193
  get ready(): boolean;
179
194
  image: ILeaferImage;
180
195
  constructor(data?: IImageInputData);
@@ -185,9 +200,9 @@ declare class Image extends Rect implements IImage {
185
200
  declare class Canvas extends Rect implements ICanvas {
186
201
  get __tag(): string;
187
202
  __: ICanvasData;
188
- width: __Number;
189
- height: __Number;
190
- pixelRatio: __Number;
203
+ width: INumber;
204
+ height: INumber;
205
+ pixelRatio: INumber;
191
206
  smooth: boolean;
192
207
  hitFill: IHitType;
193
208
  canvas: ILeaferCanvas;
@@ -203,23 +218,26 @@ declare class Canvas extends Rect implements ICanvas {
203
218
  declare class Text extends UI implements IText {
204
219
  get __tag(): string;
205
220
  __: ITextData;
206
- width: __Number;
207
- height: __Number;
221
+ width: INumber;
222
+ height: INumber;
208
223
  padding: number | number[];
224
+ fill: IFill;
209
225
  strokeAlign: IStrokeAlign;
210
- text: __String;
211
- fontFamily: __String;
212
- fontSize: __Number;
226
+ hitFill: IHitType$1;
227
+ text: IString;
228
+ fontFamily: IString;
229
+ fontSize: INumber;
213
230
  fontWeight: IFontWeight;
214
- italic: __Boolean;
231
+ italic: IBoolean;
215
232
  textCase: ITextCase;
216
233
  textDecoration: ITextDecoration;
217
- letterSpacing: __Number | IUnitData;
218
- lineHeight: __Number | IUnitData;
219
- paraIndent: __Number;
220
- paraSpacing: __Number;
234
+ letterSpacing: INumber | IUnitData;
235
+ lineHeight: INumber | IUnitData;
236
+ paraIndent: INumber;
237
+ paraSpacing: INumber;
221
238
  textAlign: ITextAlign;
222
239
  verticalAlign: IVerticalAlign;
240
+ textWrap: ITextWrap;
223
241
  textOverflow: IOverflow | string;
224
242
  get textDrawData(): ITextDrawData;
225
243
  constructor(data?: ITextInputData);
@@ -238,8 +256,8 @@ declare class Path extends UI implements IPath {
238
256
  path: IPathCommandData | IPathString$1;
239
257
  windingRule: IWindingRule;
240
258
  strokeAlign: IStrokeAlign;
241
- get resizeable(): boolean;
242
259
  constructor(data?: IPathInputData);
260
+ __scaleResize(scaleX: number, scaleY: number): void;
243
261
  __updateBoxBounds(): void;
244
262
  }
245
263