@leafer-ui/display 1.9.4 → 1.9.6
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 +8 -8
- package/src/Box.ts +2 -2
- package/src/Canvas.ts +3 -3
- package/src/Ellipse.ts +1 -4
- package/src/Frame.ts +1 -4
- package/src/Group.ts +1 -4
- package/src/Image.ts +1 -5
- package/src/Leafer.ts +18 -12
- package/src/Line.ts +3 -23
- package/src/Path.ts +1 -5
- package/src/Pen.ts +1 -4
- package/src/Polygon.ts +7 -17
- package/src/Rect.ts +1 -5
- package/src/Star.ts +1 -4
- package/src/Text.ts +7 -10
- package/src/UI.ts +11 -21
- package/types/index.d.ts +26 -41
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-ui/display",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.6",
|
|
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.9.
|
|
26
|
-
"@leafer-ui/data": "1.9.
|
|
27
|
-
"@leafer-ui/display-module": "1.9.
|
|
28
|
-
"@leafer-ui/decorator": "1.9.
|
|
29
|
-
"@leafer-ui/external": "1.9.
|
|
25
|
+
"@leafer/core": "1.9.6",
|
|
26
|
+
"@leafer-ui/data": "1.9.6",
|
|
27
|
+
"@leafer-ui/display-module": "1.9.6",
|
|
28
|
+
"@leafer-ui/decorator": "1.9.6",
|
|
29
|
+
"@leafer-ui/external": "1.9.6"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@leafer/interface": "1.9.
|
|
33
|
-
"@leafer-ui/interface": "1.9.
|
|
32
|
+
"@leafer/interface": "1.9.6",
|
|
33
|
+
"@leafer-ui/interface": "1.9.6"
|
|
34
34
|
}
|
|
35
35
|
}
|
package/src/Box.ts
CHANGED
|
@@ -13,7 +13,7 @@ const rect = Rect.prototype, group = Group.prototype
|
|
|
13
13
|
|
|
14
14
|
@rewriteAble()
|
|
15
15
|
@registerUI()
|
|
16
|
-
export class Box extends Group implements IBox {
|
|
16
|
+
export class Box<TInputData = IBoxInputData> extends Group<TInputData> implements IBox {
|
|
17
17
|
|
|
18
18
|
public get __tag() { return 'Box' }
|
|
19
19
|
|
|
@@ -46,7 +46,7 @@ export class Box extends Group implements IBox {
|
|
|
46
46
|
public scroller?: IScroller
|
|
47
47
|
public hasScroller?: boolean
|
|
48
48
|
|
|
49
|
-
constructor(data?:
|
|
49
|
+
constructor(data?: TInputData) {
|
|
50
50
|
super(data)
|
|
51
51
|
this.__layout.renderChanged || this.__layout.renderChange()
|
|
52
52
|
}
|
package/src/Canvas.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { Rect } from './Rect'
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
@registerUI()
|
|
12
|
-
export class Canvas extends Rect implements ICanvas {
|
|
12
|
+
export class Canvas<TInputData = ICanvasInputData> extends Rect<TInputData> implements ICanvas {
|
|
13
13
|
|
|
14
14
|
public get __tag() { return 'Canvas' }
|
|
15
15
|
|
|
@@ -42,10 +42,10 @@ export class Canvas extends Rect implements ICanvas {
|
|
|
42
42
|
|
|
43
43
|
public url?: string // 用于临时加载canvas的base64数据,完成后会置空
|
|
44
44
|
|
|
45
|
-
constructor(data?:
|
|
45
|
+
constructor(data?: TInputData) {
|
|
46
46
|
super(data)
|
|
47
47
|
this.canvas = Creator.canvas(this.__ as ILeaferCanvasConfig)
|
|
48
|
-
if (data && data.url) this.drawImage(data.url)
|
|
48
|
+
if (data && (data as ICanvasInputData).url) this.drawImage((data as ICanvasInputData).url)
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
public drawImage(url: string): void {
|
package/src/Ellipse.ts
CHANGED
|
@@ -10,7 +10,7 @@ import { UI } from './UI'
|
|
|
10
10
|
const { moveTo, closePath, ellipse } = PathCommandDataHelper
|
|
11
11
|
|
|
12
12
|
@registerUI()
|
|
13
|
-
export class Ellipse extends UI implements IEllipse {
|
|
13
|
+
export class Ellipse<TInputData = IEllipseInputData> extends UI<TInputData> implements IEllipse {
|
|
14
14
|
|
|
15
15
|
public get __tag() { return 'Ellipse' }
|
|
16
16
|
|
|
@@ -26,9 +26,6 @@ export class Ellipse extends UI implements IEllipse {
|
|
|
26
26
|
@pathType(0)
|
|
27
27
|
public endAngle?: INumber
|
|
28
28
|
|
|
29
|
-
constructor(data?: IEllipseInputData) {
|
|
30
|
-
super(data)
|
|
31
|
-
}
|
|
32
29
|
|
|
33
30
|
public __updatePath(): void {
|
|
34
31
|
|
package/src/Frame.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { Box } from './Box'
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
@registerUI()
|
|
10
|
-
export class Frame extends Box implements IFrame {
|
|
10
|
+
export class Frame<TInputData = IFrameInputData> extends Box<TInputData> implements IFrame {
|
|
11
11
|
|
|
12
12
|
public get __tag() { return 'Frame' }
|
|
13
13
|
|
|
@@ -22,7 +22,4 @@ export class Frame extends Box implements IFrame {
|
|
|
22
22
|
@affectRenderBoundsType('hide')
|
|
23
23
|
declare public overflow?: IOverflow
|
|
24
24
|
|
|
25
|
-
constructor(data?: IFrameInputData) {
|
|
26
|
-
super(data)
|
|
27
|
-
}
|
|
28
25
|
}
|
package/src/Group.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { UI } from './UI'
|
|
|
9
9
|
|
|
10
10
|
@useModule(Branch)
|
|
11
11
|
@registerUI()
|
|
12
|
-
export class Group extends UI implements IGroup { // tip: rewrited Box
|
|
12
|
+
export class Group<TInputData = IGroupInputData> extends UI<TInputData> implements IGroup { // tip: rewrited Box
|
|
13
13
|
|
|
14
14
|
public get __tag() { return 'Group' }
|
|
15
15
|
|
|
@@ -31,9 +31,6 @@ export class Group extends UI implements IGroup { // tip: rewrited Box
|
|
|
31
31
|
|
|
32
32
|
public childlessJSON?: boolean
|
|
33
33
|
|
|
34
|
-
constructor(data?: IGroupInputData) {
|
|
35
|
-
super(data)
|
|
36
|
-
}
|
|
37
34
|
|
|
38
35
|
public reset(data?: IGroupInputData): void {
|
|
39
36
|
this.__setBranch()
|
package/src/Image.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { Rect } from './Rect'
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
@registerUI()
|
|
11
|
-
export class Image extends Rect implements IImage {
|
|
11
|
+
export class Image<TInputData = IImageInputData> extends Rect<TInputData> implements IImage {
|
|
12
12
|
|
|
13
13
|
public get __tag() { return 'Image' }
|
|
14
14
|
|
|
@@ -22,10 +22,6 @@ export class Image extends Rect implements IImage {
|
|
|
22
22
|
|
|
23
23
|
public get image(): ILeaferImage { const { fill } = this.__; return isArray(fill) && fill[0].image }
|
|
24
24
|
|
|
25
|
-
constructor(data?: IImageInputData) {
|
|
26
|
-
super(data)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
25
|
}
|
|
30
26
|
|
|
31
27
|
export const MyImage = Image
|
package/src/Leafer.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ILeaferCanvas, IRenderer, ILayouter, ISelector, IWatcher, IInteraction, ILeaferConfig, ICanvasManager, IHitCanvasManager, IAutoBounds, IScreenSizeData, IResizeEvent, IEventListenerId, ITimer, IValue, IObject, IControl, IPointData, ILeaferType, ICursorType, IBoundsData, INumber, IZoomType, IZoomOptions, IFourNumber, IBounds, IClientPointData, ITransition } from '@leafer/interface'
|
|
2
|
-
import { AutoBounds, LayoutEvent, ResizeEvent, LeaferEvent, CanvasManager, ImageManager, Resource, DataHelper, Creator, Run, Debug, RenderEvent, registerUI, boundsType, canvasSizeAttrs, dataProcessor, WaitHelper, WatchEvent, Bounds, LeafList, Plugin, getBoundsData } from '@leafer/core'
|
|
1
|
+
import { ILeaferCanvas, IRenderer, ILayouter, ISelector, IWatcher, IInteraction, ILeaferConfig, ICanvasManager, IHitCanvasManager, IAutoBounds, IScreenSizeData, IResizeEvent, IEventListenerId, ITimer, IValue, IObject, IControl, IPointData, ILeaferType, ICursorType, IBoundsData, INumber, IZoomType, IZoomOptions, IFourNumber, IBounds, IClientPointData, ITransition, ICanvasSizeAttr, ILeaferMode } from '@leafer/interface'
|
|
2
|
+
import { AutoBounds, LayoutEvent, ResizeEvent, LeaferEvent, CanvasManager, ImageManager, Resource, DataHelper, Creator, Run, Debug, RenderEvent, registerUI, boundsType, canvasSizeAttrs, dataProcessor, WaitHelper, WatchEvent, Bounds, LeafList, Plugin, getBoundsData, dataType } from '@leafer/core'
|
|
3
3
|
|
|
4
4
|
import { ILeaferInputData, ILeaferData, IFunction, IUIInputData, ILeafer, IApp, IEditorBase } from '@leafer-ui/interface'
|
|
5
5
|
import { LeaferData } from '@leafer-ui/data'
|
|
@@ -23,6 +23,9 @@ export class Leafer extends Group implements ILeafer {
|
|
|
23
23
|
@boundsType()
|
|
24
24
|
declare public pixelRatio?: INumber
|
|
25
25
|
|
|
26
|
+
@dataType('normal')
|
|
27
|
+
public mode: ILeaferMode
|
|
28
|
+
|
|
26
29
|
public get isApp(): boolean { return false }
|
|
27
30
|
public get app(): ILeafer { return this.parent || this }
|
|
28
31
|
|
|
@@ -65,6 +68,7 @@ export class Leafer extends Group implements ILeafer {
|
|
|
65
68
|
hittable: true,
|
|
66
69
|
smooth: true,
|
|
67
70
|
lazySpeard: 100,
|
|
71
|
+
// maxFPS: 120, // 最大的运行帧率
|
|
68
72
|
// pixelSnap: false // 是否对齐像素,避免图片存在浮点坐标导致模糊
|
|
69
73
|
}
|
|
70
74
|
|
|
@@ -123,7 +127,7 @@ export class Leafer extends Group implements ILeafer {
|
|
|
123
127
|
)
|
|
124
128
|
|
|
125
129
|
if (this.isApp) this.__setApp()
|
|
126
|
-
this.__checkAutoLayout(
|
|
130
|
+
this.__checkAutoLayout()
|
|
127
131
|
this.view = canvas.view
|
|
128
132
|
|
|
129
133
|
// interaction / manager
|
|
@@ -247,7 +251,8 @@ export class Leafer extends Group implements ILeafer {
|
|
|
247
251
|
this.__level = 1
|
|
248
252
|
}
|
|
249
253
|
|
|
250
|
-
protected __checkAutoLayout(
|
|
254
|
+
protected __checkAutoLayout(): void {
|
|
255
|
+
const { config, parentApp } = this
|
|
251
256
|
if (!parentApp) {
|
|
252
257
|
if (!config.width || !config.height) this.autoLayout = new AutoBounds(config)
|
|
253
258
|
this.canvas.startAutoLayout(this.autoLayout, this.__onResize.bind(this))
|
|
@@ -258,7 +263,7 @@ export class Leafer extends Group implements ILeafer {
|
|
|
258
263
|
if (this.canvas) {
|
|
259
264
|
if (canvasSizeAttrs.includes(attrName)) {
|
|
260
265
|
// if (!newValue) debug.warn(attrName + ' is 0')
|
|
261
|
-
this.__changeCanvasSize(attrName, newValue as number)
|
|
266
|
+
this.__changeCanvasSize(attrName as ICanvasSizeAttr, newValue as number)
|
|
262
267
|
} else if (attrName === 'fill') {
|
|
263
268
|
this.__changeFill(newValue as string)
|
|
264
269
|
} else if (attrName === 'hittable') {
|
|
@@ -266,7 +271,7 @@ export class Leafer extends Group implements ILeafer {
|
|
|
266
271
|
} else if (attrName === 'zIndex') {
|
|
267
272
|
this.canvas.zIndex = newValue as any
|
|
268
273
|
setTimeout(() => this.parent && this.parent.__updateSortChildren())
|
|
269
|
-
}
|
|
274
|
+
} else if (attrName === 'mode') this.emit(LeaferEvent.UPDATE_MODE, { mode: newValue })
|
|
270
275
|
}
|
|
271
276
|
return super.__setAttr(attrName, newValue)
|
|
272
277
|
}
|
|
@@ -276,10 +281,11 @@ export class Leafer extends Group implements ILeafer {
|
|
|
276
281
|
return super.__getAttr(attrName)
|
|
277
282
|
}
|
|
278
283
|
|
|
279
|
-
protected __changeCanvasSize(attrName:
|
|
280
|
-
const
|
|
281
|
-
data
|
|
282
|
-
|
|
284
|
+
protected __changeCanvasSize(attrName: ICanvasSizeAttr, newValue: number): void {
|
|
285
|
+
const { config, canvas } = this
|
|
286
|
+
const data = DataHelper.copyAttrs({}, canvas, canvasSizeAttrs)
|
|
287
|
+
data[attrName] = config[attrName] = newValue
|
|
288
|
+
config.width && config.height ? canvas.stopAutoLayout() : this.__checkAutoLayout()
|
|
283
289
|
this.__doResize(data as IScreenSizeData)
|
|
284
290
|
}
|
|
285
291
|
|
|
@@ -455,10 +461,10 @@ export class Leafer extends Group implements ILeafer {
|
|
|
455
461
|
if (!this.parent) {
|
|
456
462
|
if (this.selector) this.selector.destroy()
|
|
457
463
|
if (this.hitCanvasManager) this.hitCanvasManager.destroy()
|
|
458
|
-
this.canvasManager.destroy()
|
|
464
|
+
if (this.canvasManager) this.canvasManager.destroy()
|
|
459
465
|
}
|
|
460
466
|
|
|
461
|
-
this.canvas.destroy()
|
|
467
|
+
if (this.canvas) this.canvas.destroy()
|
|
462
468
|
|
|
463
469
|
this.config.view = this.view = this.parentApp = null
|
|
464
470
|
if (this.userConfig) this.userConfig.view = null
|
package/src/Line.ts
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
import { IPointData, INumber } from '@leafer/interface'
|
|
2
|
-
import {
|
|
2
|
+
import { PathCommandDataHelper, PointHelper, boundsType, pathType, affectStrokeBoundsType, dataProcessor, registerUI, getPointData } from '@leafer/core'
|
|
3
3
|
|
|
4
4
|
import { ILine, ILineData, ILineInputData, IStrokeAlign } from '@leafer-ui/interface'
|
|
5
5
|
import { LineData } from '@leafer-ui/data'
|
|
6
6
|
|
|
7
7
|
import { UI } from './UI'
|
|
8
|
-
import { PathArrow } from '@leafer-ui/external'
|
|
9
8
|
|
|
10
9
|
|
|
11
10
|
const { moveTo, lineTo, drawPoints } = PathCommandDataHelper
|
|
12
11
|
const { rotate, getAngle, getDistance, defaultPoint } = PointHelper
|
|
13
|
-
const { toBounds } = PathBounds
|
|
14
12
|
|
|
15
13
|
|
|
16
14
|
@registerUI()
|
|
17
|
-
export class Line extends UI implements ILine { // tip: rewrited Polygon
|
|
15
|
+
export class Line<TInputData = ILineInputData> extends UI<TInputData> implements ILine { // tip: rewrited Polygon
|
|
18
16
|
|
|
19
17
|
public get __tag() { return 'Line' }
|
|
20
18
|
|
|
@@ -53,10 +51,6 @@ export class Line extends UI implements ILine { // tip: rewrited Polygon
|
|
|
53
51
|
}
|
|
54
52
|
|
|
55
53
|
|
|
56
|
-
constructor(data?: ILineInputData) {
|
|
57
|
-
super(data)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
54
|
public __updatePath(): void {
|
|
61
55
|
|
|
62
56
|
const data = this.__
|
|
@@ -64,7 +58,7 @@ export class Line extends UI implements ILine { // tip: rewrited Polygon
|
|
|
64
58
|
|
|
65
59
|
if (data.points) {
|
|
66
60
|
|
|
67
|
-
drawPoints(path, data.points,
|
|
61
|
+
drawPoints(path, data.points, data.curve, data.closed)
|
|
68
62
|
|
|
69
63
|
} else {
|
|
70
64
|
|
|
@@ -74,18 +68,4 @@ export class Line extends UI implements ILine { // tip: rewrited Polygon
|
|
|
74
68
|
|
|
75
69
|
}
|
|
76
70
|
|
|
77
|
-
public __updateRenderPath(): void {
|
|
78
|
-
const data = this.__
|
|
79
|
-
if (!this.pathInputed && data.points && data.curve) {
|
|
80
|
-
drawPoints(data.__pathForRender = [], data.points, data.curve, data.closed)
|
|
81
|
-
if (data.__useArrow) PathArrow.addArrows(this, false)
|
|
82
|
-
} else super.__updateRenderPath()
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
public __updateBoxBounds(): void {
|
|
86
|
-
if (this.points) {
|
|
87
|
-
toBounds(this.__.__pathForRender, this.__layout.boxBounds)
|
|
88
|
-
} else super.__updateBoxBounds()
|
|
89
|
-
}
|
|
90
|
-
|
|
91
71
|
}
|
package/src/Path.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { UI } from './UI'
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
@registerUI()
|
|
10
|
-
export class Path extends UI implements IPath {
|
|
10
|
+
export class Path<TInputData = IPathInputData> extends UI<TInputData> implements IPath {
|
|
11
11
|
|
|
12
12
|
public get __tag() { return 'Path' }
|
|
13
13
|
|
|
@@ -17,8 +17,4 @@ export class Path extends UI implements IPath {
|
|
|
17
17
|
@affectStrokeBoundsType('center')
|
|
18
18
|
declare public strokeAlign?: IStrokeAlign
|
|
19
19
|
|
|
20
|
-
constructor(data?: IPathInputData) {
|
|
21
|
-
super(data)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
20
|
}
|
package/src/Pen.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { Path } from './Path'
|
|
|
8
8
|
|
|
9
9
|
@useModule(PathCreator, ['set', 'path', 'paint'])
|
|
10
10
|
@registerUI()
|
|
11
|
-
export class Pen extends Group implements IPen {
|
|
11
|
+
export class Pen<TInputData = IPenInputData> extends Group<TInputData> implements IPen {
|
|
12
12
|
|
|
13
13
|
public get __tag() { return 'Pen' }
|
|
14
14
|
|
|
@@ -23,9 +23,6 @@ export class Pen extends Group implements IPen {
|
|
|
23
23
|
|
|
24
24
|
public __path: IPathCommandData
|
|
25
25
|
|
|
26
|
-
constructor(data?: IPenInputData) {
|
|
27
|
-
super(data)
|
|
28
|
-
}
|
|
29
26
|
|
|
30
27
|
public setStyle(data: IPathInputData): Pen {
|
|
31
28
|
const path = this.pathElement = new Path(data)
|
package/src/Polygon.ts
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
import { INumber, IPointData } from '@leafer/interface'
|
|
2
|
-
import { PathCommandDataHelper, dataProcessor, pathType, registerUI,
|
|
2
|
+
import { PathCommandDataHelper, dataProcessor, pathType, registerUI, 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'
|
|
9
8
|
|
|
10
9
|
|
|
11
10
|
const { sin, cos, PI } = Math
|
|
12
11
|
const { moveTo, lineTo, closePath, drawPoints } = PathCommandDataHelper
|
|
13
|
-
const line = Line.prototype
|
|
14
12
|
|
|
15
13
|
@rewriteAble()
|
|
16
14
|
@registerUI()
|
|
17
|
-
export class Polygon extends UI implements IPolygon {
|
|
15
|
+
export class Polygon<TInputData = IPolygonInputData> extends UI<TInputData> implements IPolygon {
|
|
18
16
|
|
|
19
17
|
public get __tag() { return 'Polygon' }
|
|
20
18
|
|
|
@@ -30,21 +28,19 @@ export class Polygon extends UI implements IPolygon {
|
|
|
30
28
|
@pathType(0)
|
|
31
29
|
public curve?: boolean | number
|
|
32
30
|
|
|
33
|
-
constructor(data?: IPolygonInputData) {
|
|
34
|
-
super(data)
|
|
35
|
-
}
|
|
36
31
|
|
|
37
32
|
public __updatePath(): void {
|
|
38
33
|
|
|
39
|
-
const
|
|
34
|
+
const data = this.__
|
|
35
|
+
const path: number[] = data.path = []
|
|
40
36
|
|
|
41
|
-
if (
|
|
37
|
+
if (data.points) {
|
|
42
38
|
|
|
43
|
-
drawPoints(path,
|
|
39
|
+
drawPoints(path, data.points, data.curve, true)
|
|
44
40
|
|
|
45
41
|
} else {
|
|
46
42
|
|
|
47
|
-
const { width, height, sides } =
|
|
43
|
+
const { width, height, sides } = data
|
|
48
44
|
const rx = width / 2, ry = height / 2
|
|
49
45
|
|
|
50
46
|
moveTo(path, rx, 0)
|
|
@@ -59,10 +55,4 @@ export class Polygon extends UI implements IPolygon {
|
|
|
59
55
|
|
|
60
56
|
}
|
|
61
57
|
|
|
62
|
-
@rewrite(line.__updateRenderPath)
|
|
63
|
-
public __updateRenderPath(): void { }
|
|
64
|
-
|
|
65
|
-
@rewrite(line.__updateBoxBounds)
|
|
66
|
-
public __updateBoxBounds(): void { }
|
|
67
|
-
|
|
68
58
|
}
|
package/src/Rect.ts
CHANGED
|
@@ -10,15 +10,11 @@ import { UI } from './UI'
|
|
|
10
10
|
@useModule(RectRender)
|
|
11
11
|
@rewriteAble()
|
|
12
12
|
@registerUI()
|
|
13
|
-
export class Rect extends UI implements IRect { // tip: rewrited Box
|
|
13
|
+
export class Rect<TInputData = IRectInputData> extends UI<TInputData> implements IRect { // tip: rewrited Box
|
|
14
14
|
|
|
15
15
|
public get __tag() { return 'Rect' }
|
|
16
16
|
|
|
17
17
|
@dataProcessor(RectData)
|
|
18
18
|
declare public __: IRectData
|
|
19
19
|
|
|
20
|
-
constructor(data?: IRectInputData) {
|
|
21
|
-
super(data)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
20
|
}
|
package/src/Star.ts
CHANGED
|
@@ -12,7 +12,7 @@ const { moveTo, lineTo, closePath } = PathCommandDataHelper
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
@registerUI()
|
|
15
|
-
export class Star extends UI implements IStar {
|
|
15
|
+
export class Star<TInputData = IStarInputData> extends UI<TInputData> implements IStar {
|
|
16
16
|
|
|
17
17
|
public get __tag() { return 'Star' }
|
|
18
18
|
|
|
@@ -25,9 +25,6 @@ export class Star extends UI implements IStar {
|
|
|
25
25
|
@pathType(0.382)
|
|
26
26
|
public innerRadius?: INumber
|
|
27
27
|
|
|
28
|
-
constructor(data?: IStarInputData) {
|
|
29
|
-
super(data)
|
|
30
|
-
}
|
|
31
28
|
|
|
32
29
|
public __updatePath() {
|
|
33
30
|
|
package/src/Text.ts
CHANGED
|
@@ -12,7 +12,7 @@ import { UI } from './UI'
|
|
|
12
12
|
const { copyAndSpread, includes, spread, setList } = BoundsHelper
|
|
13
13
|
|
|
14
14
|
@registerUI()
|
|
15
|
-
export class Text extends UI implements IText {
|
|
15
|
+
export class Text<TConstructorData = ITextInputData> extends UI<TConstructorData> implements IText {
|
|
16
16
|
|
|
17
17
|
public get __tag() { return 'Text' }
|
|
18
18
|
|
|
@@ -103,10 +103,6 @@ export class Text extends UI implements IText {
|
|
|
103
103
|
public get textDrawData(): ITextDrawData { this.updateLayout(); return this.__.__textDrawData }
|
|
104
104
|
|
|
105
105
|
|
|
106
|
-
constructor(data?: ITextInputData) {
|
|
107
|
-
super(data)
|
|
108
|
-
}
|
|
109
|
-
|
|
110
106
|
public __updateTextDrawData(): void {
|
|
111
107
|
const data = this.__
|
|
112
108
|
const { lineHeight, letterSpacing, fontFamily, fontSize, fontWeight, italic, textCase, textOverflow, padding } = data
|
|
@@ -158,11 +154,6 @@ export class Text extends UI implements IText {
|
|
|
158
154
|
else data.__textBoxBounds = b
|
|
159
155
|
}
|
|
160
156
|
|
|
161
|
-
override __onUpdateSize(): void {
|
|
162
|
-
if (this.__box) this.__box.__onUpdateSize()
|
|
163
|
-
super.__onUpdateSize()
|
|
164
|
-
}
|
|
165
|
-
|
|
166
157
|
override __updateRenderSpread(): number {
|
|
167
158
|
let width = super.__updateRenderSpread()
|
|
168
159
|
if (!width) width = this.isOverflow ? 1 : 0
|
|
@@ -175,6 +166,12 @@ export class Text extends UI implements IText {
|
|
|
175
166
|
if (this.__box) this.__box.__layout.renderBounds = renderBounds
|
|
176
167
|
}
|
|
177
168
|
|
|
169
|
+
override __updateChange(): void {
|
|
170
|
+
super.__updateChange()
|
|
171
|
+
const box = this.__box
|
|
172
|
+
if (box) box.__onUpdateSize(), box.__updateChange()
|
|
173
|
+
}
|
|
174
|
+
|
|
178
175
|
override __drawRenderPath(canvas: ILeaferCanvas): void {
|
|
179
176
|
canvas.font = this.__.__font
|
|
180
177
|
}
|
package/src/UI.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ILeaferCanvas, IPathDrawer, IPathCommandData, IHitType, INumber, IBoolean, IString, IPathString, IExportFileType, IPointData, ICursorType, IMaskType, IEraserType, IValue, IWindingRule, IPathCreator, IFourNumber, IBoundsData, IFlowType, IGap, IFlowWrap, IAxis, IConstraint, IAutoBoxData, IFlowBoxType, IPointGap, IFlowAlign, IFlowAxisAlign, IFindCondition, IAutoSize, IRangeSize, IAlign, IUnitPointData, IObject, IScaleData, IUnitData, IPathCommandObject, ITransition, IFilter, ILeaferImage, IScaleFixed, IDragBoundsType } from '@leafer/interface'
|
|
2
2
|
import { Leaf, PathDrawer, surfaceType, dataType, positionType, scrollType, boundsType, pathType, scaleType, rotationType, opacityType, visibleType, sortType, maskType, dataProcessor, registerUI, useModule, rewrite, rewriteAble, UICreator, PathCorner, hitType, strokeType, PathConvert, eraserType, cursorType, autoLayoutType, pen, naturalBoundsType, pathInputType, MathHelper, Plugin, DataHelper, affectRenderBoundsType, isString, isNumber } from '@leafer/core'
|
|
3
3
|
|
|
4
|
-
import { IUI, IShadowEffect, IBlurEffect, IStrokeAlign, IStrokeJoin, IStrokeCap, IBlendMode, IDashPatternString, IShadowString, IGrayscaleEffect, IUIData, IGroup, IStrokeWidthString, ICornerRadiusString, IUIInputData, IExportOptions, IExportResult, IFill, IStroke,
|
|
4
|
+
import { IUI, IShadowEffect, IBlurEffect, IStrokeAlign, IStrokeJoin, IStrokeCap, IBlendMode, IDashPatternString, IShadowString, IGrayscaleEffect, IUIData, IGroup, IStrokeWidthString, ICornerRadiusString, IUIInputData, IExportOptions, IExportResult, IFill, IStroke, IArrowStyle, IFindUIMethod, ILeafer, IEditorConfig, IEditorConfigFunction, IEditToolFunction, IKeyframe, IAnimation, IAnimate, IStates, IStateName, IAnimateType, IStateStyle, IColorString, IAnimateList } from '@leafer-ui/interface'
|
|
5
5
|
import { effectType, zoomLayerType } from '@leafer-ui/decorator'
|
|
6
6
|
|
|
7
7
|
import { UIData } from '@leafer-ui/data'
|
|
@@ -13,7 +13,7 @@ import { Export, Paint, PathArrow } from '@leafer-ui/external'
|
|
|
13
13
|
@useModule(UIBounds)
|
|
14
14
|
@useModule(UIRender)
|
|
15
15
|
@rewriteAble()
|
|
16
|
-
export class UI extends Leaf implements IUI { // tip: rewrited Box
|
|
16
|
+
export class UI<TInputData = IUIInputData> extends Leaf<TInputData> implements IUI { // tip: rewrited Box
|
|
17
17
|
|
|
18
18
|
@dataProcessor(UIData)
|
|
19
19
|
declare public __: IUIData
|
|
@@ -272,9 +272,9 @@ export class UI extends Leaf implements IUI { // tip: rewrited Box
|
|
|
272
272
|
|
|
273
273
|
// @leafer-in/arrow rewrite
|
|
274
274
|
|
|
275
|
-
public startArrow?:
|
|
275
|
+
public startArrow?: IArrowStyle
|
|
276
276
|
|
|
277
|
-
public endArrow?:
|
|
277
|
+
public endArrow?: IArrowStyle
|
|
278
278
|
|
|
279
279
|
// corner
|
|
280
280
|
|
|
@@ -399,27 +399,16 @@ export class UI extends Leaf implements IUI { // tip: rewrited Box
|
|
|
399
399
|
}
|
|
400
400
|
|
|
401
401
|
|
|
402
|
-
constructor(data?: IUIInputData) {
|
|
403
|
-
super(data)
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
|
|
407
402
|
// data
|
|
408
403
|
|
|
409
404
|
@rewrite(Leaf.prototype.reset)
|
|
410
405
|
public reset(_data?: IUIInputData): void { }
|
|
411
406
|
|
|
412
407
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
this.lockNormalStyle = true
|
|
418
|
-
Object.assign(this, data)
|
|
419
|
-
this.lockNormalStyle = false
|
|
420
|
-
} else this.animate(data, transition)
|
|
421
|
-
} else Object.assign(this, data)
|
|
422
|
-
}
|
|
408
|
+
// @leafer-in/animate will rewrite
|
|
409
|
+
|
|
410
|
+
public set(data: IUIInputData, _transition?: ITransition | 'temp'): void {
|
|
411
|
+
if (data) Object.assign(this, data)
|
|
423
412
|
}
|
|
424
413
|
|
|
425
414
|
public get(name?: string | string[] | IUIInputData): IUIInputData | IValue {
|
|
@@ -469,7 +458,7 @@ export class UI extends Leaf implements IUI { // tip: rewrited Box
|
|
|
469
458
|
const data = this.__
|
|
470
459
|
if (data.path) {
|
|
471
460
|
data.__pathForRender = data.cornerRadius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path
|
|
472
|
-
if (data.__useArrow) PathArrow.addArrows(this
|
|
461
|
+
if (data.__useArrow) PathArrow.addArrows(this)
|
|
473
462
|
} else data.__pathForRender && (data.__pathForRender = undefined)
|
|
474
463
|
}
|
|
475
464
|
|
|
@@ -501,7 +490,8 @@ export class UI extends Leaf implements IUI { // tip: rewrited Box
|
|
|
501
490
|
|
|
502
491
|
// @leafer-in/animate rewrite
|
|
503
492
|
|
|
504
|
-
public animate(
|
|
493
|
+
public animate(keyframe?: IUIInputData | IKeyframe[] | IAnimation | IAnimation[], _options?: ITransition, _type?: IAnimateType, _isTemp?: boolean): IAnimate {
|
|
494
|
+
this.set(keyframe as IUIInputData)
|
|
505
495
|
return Plugin.need('animate')
|
|
506
496
|
}
|
|
507
497
|
|
package/types/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { IString, INumber, IBoolean, IMaskType, IEraserType, IAlign, IUnitPointData, IPathCommandData, IPathCommandObject, IPathString, IWindingRule, IFlowType, IFourNumber, IGap, IPointGap, IFlowAlign, IFlowAxisAlign, IFlowWrap, IFlowBoxType, IAutoSize, IAutoBoxData, IConstraint, IRangeSize, IAxis, IBoundsData, IDragBoundsType, IHitType, ICursorType, IScaleFixed, IFilter, ITransition, IUnitData, IObject, IPointData, IPathCreator, IValue, IFindCondition, ILeaferCanvas, IPathDrawer, ILeaferImage, IExportFileType, IJSONOptions, IPickOptions, IPickResult, IRenderer, IWatcher, ILayouter, ISelector, IInteraction, ICanvasManager, IHitCanvasManager, ILeaferConfig, IAutoBounds, IBounds, IEventListenerId, ITimer, IControl, ILeaferType, IScreenSizeData, IResizeEvent, IZoomType, IZoomOptions, IClientPointData, IRenderOptions, ICanvasContext2DSettings, ICanvasContext2D } from '@leafer/interface';
|
|
1
|
+
import { IString, INumber, IBoolean, IMaskType, IEraserType, IAlign, IUnitPointData, IPathCommandData, IPathCommandObject, IPathString, IWindingRule, IFlowType, IFourNumber, IGap, IPointGap, IFlowAlign, IFlowAxisAlign, IFlowWrap, IFlowBoxType, IAutoSize, IAutoBoxData, IConstraint, IRangeSize, IAxis, IBoundsData, IDragBoundsType, IHitType, ICursorType, IScaleFixed, IFilter, ITransition, IUnitData, IObject, IPointData, IPathCreator, IValue, IFindCondition, ILeaferCanvas, IPathDrawer, ILeaferImage, IExportFileType, IJSONOptions, IPickOptions, IPickResult, ILeaferMode, IRenderer, IWatcher, ILayouter, ISelector, IInteraction, ICanvasManager, IHitCanvasManager, ILeaferConfig, IAutoBounds, IBounds, IEventListenerId, ITimer, IControl, ILeaferType, IScreenSizeData, IResizeEvent, ICanvasSizeAttr, IZoomType, IZoomOptions, IClientPointData, IRenderOptions, ICanvasContext2DSettings, ICanvasContext2D } from '@leafer/interface';
|
|
2
2
|
import { Leaf, LeafList } from '@leafer/core';
|
|
3
|
-
import { IUI, IUIData,
|
|
3
|
+
import { IUIInputData, IUI, IUIData, ILeafer, IGroup, IBlendMode, IFill, IStroke, IStrokeAlign, IStrokeWidthString, IStrokeCap, IStrokeJoin, IDashPatternString, IArrowStyle, ICornerRadiusString, IShadowEffect, IShadowString, IBlurEffect, IGrayscaleEffect, IAnimation, IStates, IStateName, IStateStyle, IColorString, IEditorConfig, IAnimate, IAnimateList, IFindUIMethod, IKeyframe, IAnimateType, IExportOptions, IExportResult, IEditorConfigFunction, IEditToolFunction, IGroupInputData, IGroupData, IUIJSONData, IFindCondition as IFindCondition$1, ILeaferData, IApp, IEditorBase, IFunction, ILeaferInputData, IBoxInputData, IBox, IBoxData, IOverflow, IScrollConfig, IScroller, IFrameInputData, IFrame, IFrameData, IRectInputData, IRect, IRectData, IEllipseInputData, IEllipse, IEllipseData, IPolygonInputData, IPolygon, IPolygonData, IStarInputData, IStar, IStarData, ILineInputData, ILine, ILineData, IImageInputData, IImage, IImageData, ICanvasInputData, ICanvas, ICanvasData, ITextInputData, IText, ITextData, IBackgroundBoxStyle, IHitType as IHitType$1, IFontWeight, ITextCase, ITextDecoration, IWritingMode, ITextAlign, IVerticalAlign, ITextWrap, ITextOverflow, ITextDrawData, IPathInputData, IPath, IPathData, IPenInputData, IPen, IPenData, IPathCommandData as IPathCommandData$1, IPointData as IPointData$1 } from '@leafer-ui/interface';
|
|
4
4
|
|
|
5
|
-
declare class UI extends Leaf implements IUI {
|
|
5
|
+
declare class UI<TInputData = IUIInputData> extends Leaf<TInputData> implements IUI {
|
|
6
6
|
__: IUIData;
|
|
7
7
|
proxyData?: IUIInputData;
|
|
8
8
|
__proxyData?: IUIInputData;
|
|
@@ -80,8 +80,8 @@ declare class UI extends Leaf implements IUI {
|
|
|
80
80
|
dashPattern?: INumber[] | IDashPatternString;
|
|
81
81
|
dashOffset?: INumber;
|
|
82
82
|
miterLimit?: INumber;
|
|
83
|
-
startArrow?:
|
|
84
|
-
endArrow?:
|
|
83
|
+
startArrow?: IArrowStyle;
|
|
84
|
+
endArrow?: IArrowStyle;
|
|
85
85
|
cornerRadius?: IFourNumber | ICornerRadiusString;
|
|
86
86
|
cornerSmoothing?: INumber;
|
|
87
87
|
shadow?: IShadowEffect | IShadowEffect[] | IShadowString;
|
|
@@ -124,9 +124,8 @@ declare class UI extends Leaf implements IUI {
|
|
|
124
124
|
__box?: IUI;
|
|
125
125
|
__animate?: IAnimate | IAnimateList;
|
|
126
126
|
get pen(): IPathCreator;
|
|
127
|
-
constructor(data?: IUIInputData);
|
|
128
127
|
reset(_data?: IUIInputData): void;
|
|
129
|
-
set(data: IUIInputData,
|
|
128
|
+
set(data: IUIInputData, _transition?: ITransition | 'temp'): void;
|
|
130
129
|
get(name?: string | string[] | IUIInputData): IUIInputData | IValue;
|
|
131
130
|
createProxyData(): IUIInputData;
|
|
132
131
|
find(_condition: number | string | IFindCondition | IFindUIMethod, _options?: any): IUI[];
|
|
@@ -143,7 +142,7 @@ declare class UI extends Leaf implements IUI {
|
|
|
143
142
|
__drawPathByData(drawer: IPathDrawer, data: IPathCommandData): void;
|
|
144
143
|
__drawPathByBox(drawer: IPathDrawer): void;
|
|
145
144
|
drawImagePlaceholder(canvas: ILeaferCanvas, _image?: ILeaferImage): void;
|
|
146
|
-
animate(
|
|
145
|
+
animate(keyframe?: IUIInputData | IKeyframe[] | IAnimation | IAnimation[], _options?: ITransition, _type?: IAnimateType, _isTemp?: boolean): IAnimate;
|
|
147
146
|
killAnimate(_type?: IAnimateType, _nextStyle?: IUIInputData): void;
|
|
148
147
|
export(_filename: IExportFileType | string, _options?: IExportOptions | number | boolean): Promise<IExportResult>;
|
|
149
148
|
syncExport(_filename: IExportFileType | string, _options?: IExportOptions | number | boolean): IExportResult;
|
|
@@ -157,7 +156,7 @@ declare class UI extends Leaf implements IUI {
|
|
|
157
156
|
destroy(): void;
|
|
158
157
|
}
|
|
159
158
|
|
|
160
|
-
declare class Group extends UI implements IGroup {
|
|
159
|
+
declare class Group<TInputData = IGroupInputData> extends UI<TInputData> implements IGroup {
|
|
161
160
|
get __tag(): string;
|
|
162
161
|
get isBranch(): boolean;
|
|
163
162
|
__: IGroupData;
|
|
@@ -166,7 +165,6 @@ declare class Group extends UI implements IGroup {
|
|
|
166
165
|
children: IUI[];
|
|
167
166
|
topChildren?: IUI[];
|
|
168
167
|
childlessJSON?: boolean;
|
|
169
|
-
constructor(data?: IGroupInputData);
|
|
170
168
|
reset(data?: IGroupInputData): void;
|
|
171
169
|
__setBranch(): void;
|
|
172
170
|
set(data: IUIInputData, transition?: ITransition | 'temp'): void;
|
|
@@ -187,6 +185,7 @@ declare class Leafer extends Group implements ILeafer {
|
|
|
187
185
|
get __tag(): string;
|
|
188
186
|
__: ILeaferData;
|
|
189
187
|
pixelRatio?: INumber;
|
|
188
|
+
mode: ILeaferMode;
|
|
190
189
|
get isApp(): boolean;
|
|
191
190
|
get app(): ILeafer;
|
|
192
191
|
get isLeafer(): boolean;
|
|
@@ -245,10 +244,10 @@ declare class Leafer extends Group implements ILeafer {
|
|
|
245
244
|
protected __setApp(): void;
|
|
246
245
|
protected __bindApp(app: IApp): void;
|
|
247
246
|
__setLeafer(leafer: ILeafer): void;
|
|
248
|
-
protected __checkAutoLayout(
|
|
247
|
+
protected __checkAutoLayout(): void;
|
|
249
248
|
__setAttr(attrName: string, newValue: IValue): boolean;
|
|
250
249
|
__getAttr(attrName: string): IValue;
|
|
251
|
-
protected __changeCanvasSize(attrName:
|
|
250
|
+
protected __changeCanvasSize(attrName: ICanvasSizeAttr, newValue: number): void;
|
|
252
251
|
protected __changeFill(newValue: string): void;
|
|
253
252
|
protected __onCreated(): void;
|
|
254
253
|
protected __onReady(): void;
|
|
@@ -276,7 +275,7 @@ declare class Leafer extends Group implements ILeafer {
|
|
|
276
275
|
destroy(sync?: boolean): void;
|
|
277
276
|
}
|
|
278
277
|
|
|
279
|
-
declare class Box extends Group implements IBox {
|
|
278
|
+
declare class Box<TInputData = IBoxInputData> extends Group<TInputData> implements IBox {
|
|
280
279
|
get __tag(): string;
|
|
281
280
|
get isBranchLeaf(): boolean;
|
|
282
281
|
__: IBoxData;
|
|
@@ -289,7 +288,7 @@ declare class Box extends Group implements IBox {
|
|
|
289
288
|
scrollConfig?: IScrollConfig;
|
|
290
289
|
scroller?: IScroller;
|
|
291
290
|
hasScroller?: boolean;
|
|
292
|
-
constructor(data?:
|
|
291
|
+
constructor(data?: TInputData);
|
|
293
292
|
__updateStrokeSpread(): number;
|
|
294
293
|
__updateRectRenderSpread(): number;
|
|
295
294
|
__updateRenderSpread(): number;
|
|
@@ -307,53 +306,46 @@ declare class Box extends Group implements IBox {
|
|
|
307
306
|
__drawContent(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
308
307
|
}
|
|
309
308
|
|
|
310
|
-
declare class Frame extends Box implements IFrame {
|
|
309
|
+
declare class Frame<TInputData = IFrameInputData> extends Box<TInputData> implements IFrame {
|
|
311
310
|
get __tag(): string;
|
|
312
311
|
get isFrame(): boolean;
|
|
313
312
|
__: IFrameData;
|
|
314
313
|
fill?: IFill;
|
|
315
314
|
overflow?: IOverflow;
|
|
316
|
-
constructor(data?: IFrameInputData);
|
|
317
315
|
}
|
|
318
316
|
|
|
319
|
-
declare class Rect extends UI implements IRect {
|
|
317
|
+
declare class Rect<TInputData = IRectInputData> extends UI<TInputData> implements IRect {
|
|
320
318
|
get __tag(): string;
|
|
321
319
|
__: IRectData;
|
|
322
|
-
constructor(data?: IRectInputData);
|
|
323
320
|
}
|
|
324
321
|
|
|
325
|
-
declare class Ellipse extends UI implements IEllipse {
|
|
322
|
+
declare class Ellipse<TInputData = IEllipseInputData> extends UI<TInputData> implements IEllipse {
|
|
326
323
|
get __tag(): string;
|
|
327
324
|
__: IEllipseData;
|
|
328
325
|
innerRadius?: INumber;
|
|
329
326
|
startAngle?: INumber;
|
|
330
327
|
endAngle?: INumber;
|
|
331
|
-
constructor(data?: IEllipseInputData);
|
|
332
328
|
__updatePath(): void;
|
|
333
329
|
}
|
|
334
330
|
|
|
335
|
-
declare class Polygon extends UI implements IPolygon {
|
|
331
|
+
declare class Polygon<TInputData = IPolygonInputData> extends UI<TInputData> implements IPolygon {
|
|
336
332
|
get __tag(): string;
|
|
337
333
|
__: IPolygonData;
|
|
338
334
|
sides?: INumber;
|
|
339
335
|
points?: number[] | IPointData[];
|
|
340
336
|
curve?: boolean | number;
|
|
341
|
-
constructor(data?: IPolygonInputData);
|
|
342
337
|
__updatePath(): void;
|
|
343
|
-
__updateRenderPath(): void;
|
|
344
|
-
__updateBoxBounds(): void;
|
|
345
338
|
}
|
|
346
339
|
|
|
347
|
-
declare class Star extends UI implements IStar {
|
|
340
|
+
declare class Star<TInputData = IStarInputData> extends UI<TInputData> implements IStar {
|
|
348
341
|
get __tag(): string;
|
|
349
342
|
__: IStarData;
|
|
350
343
|
corners?: INumber;
|
|
351
344
|
innerRadius?: INumber;
|
|
352
|
-
constructor(data?: IStarInputData);
|
|
353
345
|
__updatePath(): void;
|
|
354
346
|
}
|
|
355
347
|
|
|
356
|
-
declare class Line extends UI implements ILine {
|
|
348
|
+
declare class Line<TInputData = ILineInputData> extends UI<TInputData> implements ILine {
|
|
357
349
|
get __tag(): string;
|
|
358
350
|
__: ILineData;
|
|
359
351
|
strokeAlign?: IStrokeAlign;
|
|
@@ -363,23 +355,19 @@ declare class Line extends UI implements ILine {
|
|
|
363
355
|
closed?: boolean;
|
|
364
356
|
get toPoint(): IPointData;
|
|
365
357
|
set toPoint(value: IPointData);
|
|
366
|
-
constructor(data?: ILineInputData);
|
|
367
358
|
__updatePath(): void;
|
|
368
|
-
__updateRenderPath(): void;
|
|
369
|
-
__updateBoxBounds(): void;
|
|
370
359
|
}
|
|
371
360
|
|
|
372
|
-
declare class Image extends Rect implements IImage {
|
|
361
|
+
declare class Image<TInputData = IImageInputData> extends Rect<TInputData> implements IImage {
|
|
373
362
|
get __tag(): string;
|
|
374
363
|
__: IImageData;
|
|
375
364
|
url: IString;
|
|
376
365
|
get ready(): boolean;
|
|
377
366
|
get image(): ILeaferImage;
|
|
378
|
-
constructor(data?: IImageInputData);
|
|
379
367
|
}
|
|
380
368
|
declare const MyImage: typeof Image;
|
|
381
369
|
|
|
382
|
-
declare class Canvas extends Rect implements ICanvas {
|
|
370
|
+
declare class Canvas<TInputData = ICanvasInputData> extends Rect<TInputData> implements ICanvas {
|
|
383
371
|
get __tag(): string;
|
|
384
372
|
__: ICanvasData;
|
|
385
373
|
width?: INumber;
|
|
@@ -392,7 +380,7 @@ declare class Canvas extends Rect implements ICanvas {
|
|
|
392
380
|
get context(): ICanvasContext2D;
|
|
393
381
|
get ready(): boolean;
|
|
394
382
|
url?: string;
|
|
395
|
-
constructor(data?:
|
|
383
|
+
constructor(data?: TInputData);
|
|
396
384
|
drawImage(url: string): void;
|
|
397
385
|
draw(ui: IUI, offset?: IPointData, scale?: number | IPointData, rotation?: number): void;
|
|
398
386
|
paint(): void;
|
|
@@ -401,7 +389,7 @@ declare class Canvas extends Rect implements ICanvas {
|
|
|
401
389
|
destroy(): void;
|
|
402
390
|
}
|
|
403
391
|
|
|
404
|
-
declare class Text extends UI implements IText {
|
|
392
|
+
declare class Text<TConstructorData = ITextInputData> extends UI<TConstructorData> implements IText {
|
|
405
393
|
get __tag(): string;
|
|
406
394
|
__: ITextData;
|
|
407
395
|
width?: INumber;
|
|
@@ -432,33 +420,30 @@ declare class Text extends UI implements IText {
|
|
|
432
420
|
textEditing: boolean;
|
|
433
421
|
isOverflow: boolean;
|
|
434
422
|
get textDrawData(): ITextDrawData;
|
|
435
|
-
constructor(data?: ITextInputData);
|
|
436
423
|
__updateTextDrawData(): void;
|
|
437
424
|
__updateBoxBounds(): void;
|
|
438
|
-
__onUpdateSize(): void;
|
|
439
425
|
__updateRenderSpread(): number;
|
|
440
426
|
__updateRenderBounds(): void;
|
|
427
|
+
__updateChange(): void;
|
|
441
428
|
__drawRenderPath(canvas: ILeaferCanvas): void;
|
|
442
429
|
__draw(canvas: ILeaferCanvas, options: IRenderOptions, originCanvas?: ILeaferCanvas): void;
|
|
443
430
|
__drawShape(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
444
431
|
destroy(): void;
|
|
445
432
|
}
|
|
446
433
|
|
|
447
|
-
declare class Path extends UI implements IPath {
|
|
434
|
+
declare class Path<TInputData = IPathInputData> extends UI<TInputData> implements IPath {
|
|
448
435
|
get __tag(): string;
|
|
449
436
|
__: IPathData;
|
|
450
437
|
strokeAlign?: IStrokeAlign;
|
|
451
|
-
constructor(data?: IPathInputData);
|
|
452
438
|
}
|
|
453
439
|
|
|
454
|
-
declare class Pen extends Group implements IPen {
|
|
440
|
+
declare class Pen<TInputData = IPenInputData> extends Group<TInputData> implements IPen {
|
|
455
441
|
get __tag(): string;
|
|
456
442
|
__: IPenData;
|
|
457
443
|
pathElement: IPath;
|
|
458
444
|
pathStyle: IPathInputData;
|
|
459
445
|
path: IPathCommandData$1;
|
|
460
446
|
__path: IPathCommandData$1;
|
|
461
|
-
constructor(data?: IPenInputData);
|
|
462
447
|
setStyle(data: IPathInputData): Pen;
|
|
463
448
|
beginPath(): Pen;
|
|
464
449
|
moveTo(_x: number, _y: number): Pen;
|