@leafer-ui/display 1.9.3 → 1.9.5
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 +9 -16
- 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 +13 -10
- package/src/Line.ts +3 -23
- package/src/Path.ts +1 -5
- package/src/Pen.ts +1 -4
- package/src/Polygon.ts +6 -8
- package/src/Rect.ts +1 -5
- package/src/Star.ts +1 -4
- package/src/Text.ts +1 -5
- package/src/UI.ts +11 -21
- package/types/index.d.ts +25 -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.5",
|
|
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.5",
|
|
26
|
+
"@leafer-ui/data": "1.9.5",
|
|
27
|
+
"@leafer-ui/display-module": "1.9.5",
|
|
28
|
+
"@leafer-ui/decorator": "1.9.5",
|
|
29
|
+
"@leafer-ui/external": "1.9.5"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@leafer/interface": "1.9.
|
|
33
|
-
"@leafer-ui/interface": "1.9.
|
|
32
|
+
"@leafer/interface": "1.9.5",
|
|
33
|
+
"@leafer-ui/interface": "1.9.5"
|
|
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
|
|
|
@@ -40,13 +40,13 @@ export class Box extends Group implements IBox {
|
|
|
40
40
|
|
|
41
41
|
public isOverflow?: boolean
|
|
42
42
|
|
|
43
|
-
// scroller rewrite
|
|
43
|
+
// scroller will rewrite
|
|
44
44
|
public scrollConfig?: IScrollConfig
|
|
45
45
|
|
|
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
|
}
|
|
@@ -99,15 +99,15 @@ export class Box extends Group implements IBox {
|
|
|
99
99
|
public __updateStrokeBounds(): void { }
|
|
100
100
|
|
|
101
101
|
public __updateRenderBounds(): void {
|
|
102
|
-
let isOverflow: boolean
|
|
102
|
+
let isOverflow: boolean, isScrollMode: boolean
|
|
103
103
|
|
|
104
104
|
if (this.children.length) {
|
|
105
|
-
const data = this.__, layout = this.__layout, { renderBounds, boxBounds } = layout
|
|
105
|
+
const data = this.__, layout = this.__layout, { renderBounds, boxBounds } = layout, { overflow } = data
|
|
106
106
|
|
|
107
107
|
const childrenRenderBounds = layout.childrenRenderBounds || (layout.childrenRenderBounds = getBoundsData())
|
|
108
108
|
super.__updateRenderBounds(childrenRenderBounds)
|
|
109
109
|
|
|
110
|
-
if (
|
|
110
|
+
if (isScrollMode = overflow.includes('scroll')) { // 检查滚动逻辑
|
|
111
111
|
add(childrenRenderBounds, boxBounds)
|
|
112
112
|
scroll(childrenRenderBounds, data as IScrollPointData)
|
|
113
113
|
}
|
|
@@ -115,27 +115,20 @@ export class Box extends Group implements IBox {
|
|
|
115
115
|
this.__updateRectRenderBounds()
|
|
116
116
|
|
|
117
117
|
isOverflow = !includes(boxBounds, childrenRenderBounds)
|
|
118
|
-
if (isOverflow &&
|
|
118
|
+
if (isOverflow && overflow === 'show') add(renderBounds, childrenRenderBounds)
|
|
119
119
|
} else this.__updateRectRenderBounds()
|
|
120
120
|
|
|
121
121
|
DataHelper.stintSet(this, 'isOverflow', isOverflow)
|
|
122
122
|
|
|
123
|
-
this.__checkScroll()
|
|
123
|
+
this.__checkScroll(isScrollMode)
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
@rewrite(rect.__updateRenderBounds)
|
|
127
127
|
public __updateRectRenderBounds(): void { }
|
|
128
128
|
|
|
129
|
-
public __updateWorldBounds(): void {
|
|
130
|
-
if (this.hasScroller) this.__updateScroll()
|
|
131
|
-
super.__updateWorldBounds()
|
|
132
|
-
}
|
|
133
|
-
|
|
134
129
|
|
|
135
130
|
// scroller will rewrite
|
|
136
|
-
public __checkScroll(): void { }
|
|
137
|
-
|
|
138
|
-
public __updateScroll(): void { }
|
|
131
|
+
public __checkScroll(_isScrollMode: boolean): void { }
|
|
139
132
|
|
|
140
133
|
|
|
141
134
|
@rewrite(rect.__updateChange)
|
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,4 +1,4 @@
|
|
|
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'
|
|
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 } from '@leafer/interface'
|
|
2
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'
|
|
3
3
|
|
|
4
4
|
import { ILeaferInputData, ILeaferData, IFunction, IUIInputData, ILeafer, IApp, IEditorBase } from '@leafer-ui/interface'
|
|
@@ -65,6 +65,7 @@ export class Leafer extends Group implements ILeafer {
|
|
|
65
65
|
hittable: true,
|
|
66
66
|
smooth: true,
|
|
67
67
|
lazySpeard: 100,
|
|
68
|
+
// maxFPS: 120, // 最大的运行帧率
|
|
68
69
|
// pixelSnap: false // 是否对齐像素,避免图片存在浮点坐标导致模糊
|
|
69
70
|
}
|
|
70
71
|
|
|
@@ -123,7 +124,7 @@ export class Leafer extends Group implements ILeafer {
|
|
|
123
124
|
)
|
|
124
125
|
|
|
125
126
|
if (this.isApp) this.__setApp()
|
|
126
|
-
this.__checkAutoLayout(
|
|
127
|
+
this.__checkAutoLayout()
|
|
127
128
|
this.view = canvas.view
|
|
128
129
|
|
|
129
130
|
// interaction / manager
|
|
@@ -247,7 +248,8 @@ export class Leafer extends Group implements ILeafer {
|
|
|
247
248
|
this.__level = 1
|
|
248
249
|
}
|
|
249
250
|
|
|
250
|
-
protected __checkAutoLayout(
|
|
251
|
+
protected __checkAutoLayout(): void {
|
|
252
|
+
const { config, parentApp } = this
|
|
251
253
|
if (!parentApp) {
|
|
252
254
|
if (!config.width || !config.height) this.autoLayout = new AutoBounds(config)
|
|
253
255
|
this.canvas.startAutoLayout(this.autoLayout, this.__onResize.bind(this))
|
|
@@ -258,7 +260,7 @@ export class Leafer extends Group implements ILeafer {
|
|
|
258
260
|
if (this.canvas) {
|
|
259
261
|
if (canvasSizeAttrs.includes(attrName)) {
|
|
260
262
|
// if (!newValue) debug.warn(attrName + ' is 0')
|
|
261
|
-
this.__changeCanvasSize(attrName, newValue as number)
|
|
263
|
+
this.__changeCanvasSize(attrName as ICanvasSizeAttr, newValue as number)
|
|
262
264
|
} else if (attrName === 'fill') {
|
|
263
265
|
this.__changeFill(newValue as string)
|
|
264
266
|
} else if (attrName === 'hittable') {
|
|
@@ -276,10 +278,11 @@ export class Leafer extends Group implements ILeafer {
|
|
|
276
278
|
return super.__getAttr(attrName)
|
|
277
279
|
}
|
|
278
280
|
|
|
279
|
-
protected __changeCanvasSize(attrName:
|
|
280
|
-
const
|
|
281
|
-
data
|
|
282
|
-
|
|
281
|
+
protected __changeCanvasSize(attrName: ICanvasSizeAttr, newValue: number): void {
|
|
282
|
+
const { config, canvas } = this
|
|
283
|
+
const data = DataHelper.copyAttrs({}, canvas, canvasSizeAttrs)
|
|
284
|
+
data[attrName] = config[attrName] = newValue
|
|
285
|
+
config.width && config.height ? canvas.stopAutoLayout() : this.__checkAutoLayout()
|
|
283
286
|
this.__doResize(data as IScreenSizeData)
|
|
284
287
|
}
|
|
285
288
|
|
|
@@ -455,10 +458,10 @@ export class Leafer extends Group implements ILeafer {
|
|
|
455
458
|
if (!this.parent) {
|
|
456
459
|
if (this.selector) this.selector.destroy()
|
|
457
460
|
if (this.hitCanvasManager) this.hitCanvasManager.destroy()
|
|
458
|
-
this.canvasManager.destroy()
|
|
461
|
+
if (this.canvasManager) this.canvasManager.destroy()
|
|
459
462
|
}
|
|
460
463
|
|
|
461
|
-
this.canvas.destroy()
|
|
464
|
+
if (this.canvas) this.canvas.destroy()
|
|
462
465
|
|
|
463
466
|
this.config.view = this.view = this.parentApp = null
|
|
464
467
|
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
|
@@ -14,7 +14,7 @@ const line = Line.prototype
|
|
|
14
14
|
|
|
15
15
|
@rewriteAble()
|
|
16
16
|
@registerUI()
|
|
17
|
-
export class Polygon extends UI implements IPolygon {
|
|
17
|
+
export class Polygon<TInputData = IPolygonInputData> extends UI<TInputData> implements IPolygon {
|
|
18
18
|
|
|
19
19
|
public get __tag() { return 'Polygon' }
|
|
20
20
|
|
|
@@ -30,21 +30,19 @@ export class Polygon extends UI implements IPolygon {
|
|
|
30
30
|
@pathType(0)
|
|
31
31
|
public curve?: boolean | number
|
|
32
32
|
|
|
33
|
-
constructor(data?: IPolygonInputData) {
|
|
34
|
-
super(data)
|
|
35
|
-
}
|
|
36
33
|
|
|
37
34
|
public __updatePath(): void {
|
|
38
35
|
|
|
39
|
-
const
|
|
36
|
+
const data = this.__
|
|
37
|
+
const path: number[] = data.path = []
|
|
40
38
|
|
|
41
|
-
if (
|
|
39
|
+
if (data.points) {
|
|
42
40
|
|
|
43
|
-
drawPoints(path,
|
|
41
|
+
drawPoints(path, data.points, data.curve, true)
|
|
44
42
|
|
|
45
43
|
} else {
|
|
46
44
|
|
|
47
|
-
const { width, height, sides } =
|
|
45
|
+
const { width, height, sides } = data
|
|
48
46
|
const rx = width / 2, ry = height / 2
|
|
49
47
|
|
|
50
48
|
moveTo(path, rx, 0)
|
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
|
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, 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;
|
|
@@ -245,10 +243,10 @@ declare class Leafer extends Group implements ILeafer {
|
|
|
245
243
|
protected __setApp(): void;
|
|
246
244
|
protected __bindApp(app: IApp): void;
|
|
247
245
|
__setLeafer(leafer: ILeafer): void;
|
|
248
|
-
protected __checkAutoLayout(
|
|
246
|
+
protected __checkAutoLayout(): void;
|
|
249
247
|
__setAttr(attrName: string, newValue: IValue): boolean;
|
|
250
248
|
__getAttr(attrName: string): IValue;
|
|
251
|
-
protected __changeCanvasSize(attrName:
|
|
249
|
+
protected __changeCanvasSize(attrName: ICanvasSizeAttr, newValue: number): void;
|
|
252
250
|
protected __changeFill(newValue: string): void;
|
|
253
251
|
protected __onCreated(): void;
|
|
254
252
|
protected __onReady(): void;
|
|
@@ -276,7 +274,7 @@ declare class Leafer extends Group implements ILeafer {
|
|
|
276
274
|
destroy(sync?: boolean): void;
|
|
277
275
|
}
|
|
278
276
|
|
|
279
|
-
declare class Box extends Group implements IBox {
|
|
277
|
+
declare class Box<TInputData = IBoxInputData> extends Group<TInputData> implements IBox {
|
|
280
278
|
get __tag(): string;
|
|
281
279
|
get isBranchLeaf(): boolean;
|
|
282
280
|
__: IBoxData;
|
|
@@ -289,7 +287,7 @@ declare class Box extends Group implements IBox {
|
|
|
289
287
|
scrollConfig?: IScrollConfig;
|
|
290
288
|
scroller?: IScroller;
|
|
291
289
|
hasScroller?: boolean;
|
|
292
|
-
constructor(data?:
|
|
290
|
+
constructor(data?: TInputData);
|
|
293
291
|
__updateStrokeSpread(): number;
|
|
294
292
|
__updateRectRenderSpread(): number;
|
|
295
293
|
__updateRenderSpread(): number;
|
|
@@ -298,9 +296,7 @@ declare class Box extends Group implements IBox {
|
|
|
298
296
|
__updateStrokeBounds(): void;
|
|
299
297
|
__updateRenderBounds(): void;
|
|
300
298
|
__updateRectRenderBounds(): void;
|
|
301
|
-
|
|
302
|
-
__checkScroll(): void;
|
|
303
|
-
__updateScroll(): void;
|
|
299
|
+
__checkScroll(_isScrollMode: boolean): void;
|
|
304
300
|
__updateRectChange(): void;
|
|
305
301
|
__updateChange(): void;
|
|
306
302
|
__renderRect(_canvas: ILeaferCanvas, _options: IRenderOptions): void;
|
|
@@ -309,53 +305,48 @@ declare class Box extends Group implements IBox {
|
|
|
309
305
|
__drawContent(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
310
306
|
}
|
|
311
307
|
|
|
312
|
-
declare class Frame extends Box implements IFrame {
|
|
308
|
+
declare class Frame<TInputData = IFrameInputData> extends Box<TInputData> implements IFrame {
|
|
313
309
|
get __tag(): string;
|
|
314
310
|
get isFrame(): boolean;
|
|
315
311
|
__: IFrameData;
|
|
316
312
|
fill?: IFill;
|
|
317
313
|
overflow?: IOverflow;
|
|
318
|
-
constructor(data?: IFrameInputData);
|
|
319
314
|
}
|
|
320
315
|
|
|
321
|
-
declare class Rect extends UI implements IRect {
|
|
316
|
+
declare class Rect<TInputData = IRectInputData> extends UI<TInputData> implements IRect {
|
|
322
317
|
get __tag(): string;
|
|
323
318
|
__: IRectData;
|
|
324
|
-
constructor(data?: IRectInputData);
|
|
325
319
|
}
|
|
326
320
|
|
|
327
|
-
declare class Ellipse extends UI implements IEllipse {
|
|
321
|
+
declare class Ellipse<TInputData = IEllipseInputData> extends UI<TInputData> implements IEllipse {
|
|
328
322
|
get __tag(): string;
|
|
329
323
|
__: IEllipseData;
|
|
330
324
|
innerRadius?: INumber;
|
|
331
325
|
startAngle?: INumber;
|
|
332
326
|
endAngle?: INumber;
|
|
333
|
-
constructor(data?: IEllipseInputData);
|
|
334
327
|
__updatePath(): void;
|
|
335
328
|
}
|
|
336
329
|
|
|
337
|
-
declare class Polygon extends UI implements IPolygon {
|
|
330
|
+
declare class Polygon<TInputData = IPolygonInputData> extends UI<TInputData> implements IPolygon {
|
|
338
331
|
get __tag(): string;
|
|
339
332
|
__: IPolygonData;
|
|
340
333
|
sides?: INumber;
|
|
341
334
|
points?: number[] | IPointData[];
|
|
342
335
|
curve?: boolean | number;
|
|
343
|
-
constructor(data?: IPolygonInputData);
|
|
344
336
|
__updatePath(): void;
|
|
345
337
|
__updateRenderPath(): void;
|
|
346
338
|
__updateBoxBounds(): void;
|
|
347
339
|
}
|
|
348
340
|
|
|
349
|
-
declare class Star extends UI implements IStar {
|
|
341
|
+
declare class Star<TInputData = IStarInputData> extends UI<TInputData> implements IStar {
|
|
350
342
|
get __tag(): string;
|
|
351
343
|
__: IStarData;
|
|
352
344
|
corners?: INumber;
|
|
353
345
|
innerRadius?: INumber;
|
|
354
|
-
constructor(data?: IStarInputData);
|
|
355
346
|
__updatePath(): void;
|
|
356
347
|
}
|
|
357
348
|
|
|
358
|
-
declare class Line extends UI implements ILine {
|
|
349
|
+
declare class Line<TInputData = ILineInputData> extends UI<TInputData> implements ILine {
|
|
359
350
|
get __tag(): string;
|
|
360
351
|
__: ILineData;
|
|
361
352
|
strokeAlign?: IStrokeAlign;
|
|
@@ -365,23 +356,19 @@ declare class Line extends UI implements ILine {
|
|
|
365
356
|
closed?: boolean;
|
|
366
357
|
get toPoint(): IPointData;
|
|
367
358
|
set toPoint(value: IPointData);
|
|
368
|
-
constructor(data?: ILineInputData);
|
|
369
359
|
__updatePath(): void;
|
|
370
|
-
__updateRenderPath(): void;
|
|
371
|
-
__updateBoxBounds(): void;
|
|
372
360
|
}
|
|
373
361
|
|
|
374
|
-
declare class Image extends Rect implements IImage {
|
|
362
|
+
declare class Image<TInputData = IImageInputData> extends Rect<TInputData> implements IImage {
|
|
375
363
|
get __tag(): string;
|
|
376
364
|
__: IImageData;
|
|
377
365
|
url: IString;
|
|
378
366
|
get ready(): boolean;
|
|
379
367
|
get image(): ILeaferImage;
|
|
380
|
-
constructor(data?: IImageInputData);
|
|
381
368
|
}
|
|
382
369
|
declare const MyImage: typeof Image;
|
|
383
370
|
|
|
384
|
-
declare class Canvas extends Rect implements ICanvas {
|
|
371
|
+
declare class Canvas<TInputData = ICanvasInputData> extends Rect<TInputData> implements ICanvas {
|
|
385
372
|
get __tag(): string;
|
|
386
373
|
__: ICanvasData;
|
|
387
374
|
width?: INumber;
|
|
@@ -394,7 +381,7 @@ declare class Canvas extends Rect implements ICanvas {
|
|
|
394
381
|
get context(): ICanvasContext2D;
|
|
395
382
|
get ready(): boolean;
|
|
396
383
|
url?: string;
|
|
397
|
-
constructor(data?:
|
|
384
|
+
constructor(data?: TInputData);
|
|
398
385
|
drawImage(url: string): void;
|
|
399
386
|
draw(ui: IUI, offset?: IPointData, scale?: number | IPointData, rotation?: number): void;
|
|
400
387
|
paint(): void;
|
|
@@ -403,7 +390,7 @@ declare class Canvas extends Rect implements ICanvas {
|
|
|
403
390
|
destroy(): void;
|
|
404
391
|
}
|
|
405
392
|
|
|
406
|
-
declare class Text extends UI implements IText {
|
|
393
|
+
declare class Text<TConstructorData = ITextInputData> extends UI<TConstructorData> implements IText {
|
|
407
394
|
get __tag(): string;
|
|
408
395
|
__: ITextData;
|
|
409
396
|
width?: INumber;
|
|
@@ -434,7 +421,6 @@ declare class Text extends UI implements IText {
|
|
|
434
421
|
textEditing: boolean;
|
|
435
422
|
isOverflow: boolean;
|
|
436
423
|
get textDrawData(): ITextDrawData;
|
|
437
|
-
constructor(data?: ITextInputData);
|
|
438
424
|
__updateTextDrawData(): void;
|
|
439
425
|
__updateBoxBounds(): void;
|
|
440
426
|
__onUpdateSize(): void;
|
|
@@ -446,21 +432,19 @@ declare class Text extends UI implements IText {
|
|
|
446
432
|
destroy(): void;
|
|
447
433
|
}
|
|
448
434
|
|
|
449
|
-
declare class Path extends UI implements IPath {
|
|
435
|
+
declare class Path<TInputData = IPathInputData> extends UI<TInputData> implements IPath {
|
|
450
436
|
get __tag(): string;
|
|
451
437
|
__: IPathData;
|
|
452
438
|
strokeAlign?: IStrokeAlign;
|
|
453
|
-
constructor(data?: IPathInputData);
|
|
454
439
|
}
|
|
455
440
|
|
|
456
|
-
declare class Pen extends Group implements IPen {
|
|
441
|
+
declare class Pen<TInputData = IPenInputData> extends Group<TInputData> implements IPen {
|
|
457
442
|
get __tag(): string;
|
|
458
443
|
__: IPenData;
|
|
459
444
|
pathElement: IPath;
|
|
460
445
|
pathStyle: IPathInputData;
|
|
461
446
|
path: IPathCommandData$1;
|
|
462
447
|
__path: IPathCommandData$1;
|
|
463
|
-
constructor(data?: IPenInputData);
|
|
464
448
|
setStyle(data: IPathInputData): Pen;
|
|
465
449
|
beginPath(): Pen;
|
|
466
450
|
moveTo(_x: number, _y: number): Pen;
|