@leafer-ui/display 1.0.0-rc.6 → 1.0.0-rc.8

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