@leafer/interface 1.0.0-rc.5 → 1.0.0-rc.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/app/IApp.ts +3 -3
- package/src/app/ILeafer.ts +21 -10
- package/src/canvas/ILeaferCanvas.ts +1 -1
- package/src/canvas/ISkiaCanvas.ts +20 -1
- package/src/data/IData.ts +4 -5
- package/src/data/ILeafData.ts +7 -1
- package/src/data/IList.ts +9 -6
- package/src/display/ILeaf.ts +119 -71
- package/src/display/module/ILeafBounds.ts +2 -0
- package/src/display/module/ILeafDataProxy.ts +5 -3
- package/src/display/module/ILeafMask.ts +1 -1
- package/src/event/IEventer.ts +6 -1
- package/src/function/IFunction.ts +9 -0
- package/src/index.ts +10 -10
- package/src/interaction/IInteraction.ts +3 -1
- package/src/layout/ILeafLayout.ts +20 -8
- package/src/layouter/ILayouter.ts +3 -0
- package/src/math/IMath.ts +47 -31
- package/src/platform/IPlatform.ts +9 -2
- package/src/plugin/IPlugin.ts +2 -2
- package/src/selector/ISelector.ts +22 -6
- package/types/index.d.ts +297 -186
package/package.json
CHANGED
package/src/app/IApp.ts
CHANGED
package/src/app/ILeafer.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { IHitCanvasManager } from '../canvas/IHitCanvasManager'
|
|
|
11
11
|
import { IEventListenerId } from '../event/IEventer'
|
|
12
12
|
import { IObject } from '../data/IData'
|
|
13
13
|
import { IZoomView } from '../display/IView'
|
|
14
|
-
import {
|
|
14
|
+
import { IAppBase } from './IApp'
|
|
15
15
|
import { ILeaferImage, ILeaferImageConfig } from '../image/ILeaferImage'
|
|
16
16
|
import { IControl } from '../control/IControl'
|
|
17
17
|
import { IFunction } from '../function/IFunction'
|
|
@@ -24,17 +24,13 @@ export interface ILeaferConfig extends IRendererConfig, ILeaferCanvasConfig, IIn
|
|
|
24
24
|
realCanvas?: boolean
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
export interface
|
|
28
|
-
|
|
29
|
-
readonly isApp: boolean
|
|
30
|
-
readonly app: ILeafer
|
|
31
|
-
parent?: IApp
|
|
32
|
-
|
|
27
|
+
export interface ILeaferAttrData {
|
|
33
28
|
running: boolean
|
|
34
29
|
created: boolean
|
|
35
30
|
ready: boolean
|
|
36
31
|
viewReady: boolean
|
|
37
32
|
viewCompleted: boolean
|
|
33
|
+
layoutLocked: boolean
|
|
38
34
|
|
|
39
35
|
pixelRatio: number
|
|
40
36
|
|
|
@@ -62,7 +58,14 @@ export interface ILeafer extends IZoomView, IControl {
|
|
|
62
58
|
__eventIds: IEventListenerId[]
|
|
63
59
|
__nextRenderWait: IFunction[]
|
|
64
60
|
|
|
65
|
-
init(userConfig?: ILeaferConfig, parentApp?:
|
|
61
|
+
init(userConfig?: ILeaferConfig, parentApp?: IAppBase): void
|
|
62
|
+
|
|
63
|
+
start(): void
|
|
64
|
+
stop(): void
|
|
65
|
+
|
|
66
|
+
unlockLayout(): void
|
|
67
|
+
lockLayout(): void
|
|
68
|
+
|
|
66
69
|
setZoomLayer(zoomLayer: ILeaf): void
|
|
67
70
|
forceFullRender(): void
|
|
68
71
|
updateCursor(): void
|
|
@@ -73,14 +76,20 @@ export interface ILeafer extends IZoomView, IControl {
|
|
|
73
76
|
waitViewCompleted(item: IFunction): void
|
|
74
77
|
}
|
|
75
78
|
|
|
79
|
+
export interface ILeaferBase extends IZoomView, IControl, ILeaferAttrData {
|
|
80
|
+
readonly isApp: boolean
|
|
81
|
+
readonly app: ILeaferBase
|
|
82
|
+
parent?: IAppBase
|
|
83
|
+
}
|
|
84
|
+
|
|
76
85
|
export interface ILeaferTypeCreator {
|
|
77
86
|
list: ILeaferTypeList
|
|
78
87
|
register(name: string, fn: ILeaferTypeFunction): void
|
|
79
|
-
run(name: string, leafer:
|
|
88
|
+
run(name: string, leafer: ILeaferBase): void
|
|
80
89
|
}
|
|
81
90
|
|
|
82
91
|
export interface ILeaferTypeFunction {
|
|
83
|
-
(leafer:
|
|
92
|
+
(leafer: ILeaferBase): void
|
|
84
93
|
}
|
|
85
94
|
|
|
86
95
|
export interface ILeaferTypeList {
|
|
@@ -98,6 +107,8 @@ export interface ICreator {
|
|
|
98
107
|
selector?(target: ILeaf, options?: ISelectorConfig): ISelector
|
|
99
108
|
|
|
100
109
|
interaction?(target: ILeaf, canvas: IInteractionCanvas, selector: ISelector, options?: IInteractionConfig): IInteraction
|
|
110
|
+
|
|
111
|
+
editor?(options?: IObject): ILeaf
|
|
101
112
|
}
|
|
102
113
|
|
|
103
114
|
export interface IUICreator {
|
|
@@ -183,7 +183,7 @@ export interface ILeaferCanvas extends ICanvasAttr, ICanvasMethod, IPathDrawer {
|
|
|
183
183
|
|
|
184
184
|
// other
|
|
185
185
|
isSameSize(options: ILeaferCanvasConfig): boolean
|
|
186
|
-
getSameCanvas(useSameWorldTransform?: boolean): ILeaferCanvas
|
|
186
|
+
getSameCanvas(useSameWorldTransform?: boolean, useSameSmooth?: boolean): ILeaferCanvas
|
|
187
187
|
getBiggerCanvas(addWidth: number, addHeight: number): ILeaferCanvas
|
|
188
188
|
recycle(): void
|
|
189
189
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { IExportFileType, IExportImageType } from '../file/IFileType'
|
|
2
2
|
|
|
3
|
-
export type ICanvasType = 'skia' | 'canvas' | 'wx'
|
|
3
|
+
export type ICanvasType = 'skia' | 'napi' | 'canvas' | 'wx'
|
|
4
4
|
|
|
5
|
+
// skia
|
|
5
6
|
export interface ISkiaCanvas {
|
|
6
7
|
toBuffer(format: IExportFileType, config: ISkiaCanvasExportConfig): Promise<any>
|
|
7
8
|
toBufferSync(format: IExportFileType, config: ISkiaCanvasExportConfig): any
|
|
@@ -17,4 +18,22 @@ export interface ISkiaCanvasExportConfig {
|
|
|
17
18
|
density?: number,
|
|
18
19
|
quality?: number,
|
|
19
20
|
outline?: boolean
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// skia-napi
|
|
24
|
+
export interface ISkiaNAPICanvas {
|
|
25
|
+
encodeSync(format: 'webp' | 'jpeg', quality?: number): any
|
|
26
|
+
encodeSync(format: 'png'): any
|
|
27
|
+
|
|
28
|
+
encode(format: 'webp' | 'jpeg' | string, quality?: number): Promise<any>
|
|
29
|
+
encode(format: 'png'): Promise<any>
|
|
30
|
+
|
|
31
|
+
toBuffer(mime: 'image/png'): any
|
|
32
|
+
toBuffer(mime: 'image/jpeg' | 'image/webp' | string, quality?: number): any
|
|
33
|
+
|
|
34
|
+
toDataURL(mime?: 'image/png'): string
|
|
35
|
+
toDataURL(mime: 'image/jpeg' | 'image/webp' | string, quality?: number): string
|
|
36
|
+
|
|
37
|
+
toDataURLAsync(mime?: 'image/png'): Promise<string>
|
|
38
|
+
toDataURLAsync(mime: 'image/jpeg' | 'image/webp' | string, quality?: number): Promise<string>
|
|
20
39
|
}
|
package/src/data/IData.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
export type
|
|
2
|
-
export type
|
|
3
|
-
export type
|
|
4
|
-
export type
|
|
5
|
-
export type __Value = __Number | __Boolean | __String | __Object //
|
|
1
|
+
export type INumber = number // number | string will convert to number
|
|
2
|
+
export type IBoolean = boolean // boolean | string will convert to boolean
|
|
3
|
+
export type IString = string // string | other will convert to string
|
|
4
|
+
export type IValue = INumber | IBoolean | IString | IObject //
|
|
6
5
|
export type ITimer = any
|
|
7
6
|
|
|
8
7
|
export type IPathString = string
|
package/src/data/ILeafData.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ILeaf, ILeafComputedData } from '../display/ILeaf'
|
|
2
2
|
import { IObject } from './IData'
|
|
3
3
|
|
|
4
|
-
export interface IDataProcessor
|
|
4
|
+
export interface IDataProcessor {
|
|
5
5
|
__leaf: ILeaf
|
|
6
6
|
__input: IObject
|
|
7
7
|
__middle: IObject
|
|
@@ -10,6 +10,7 @@ export interface IDataProcessor extends IObject {
|
|
|
10
10
|
__checkSingle(): void
|
|
11
11
|
|
|
12
12
|
__get(name: string): any
|
|
13
|
+
__getData(): IObject
|
|
13
14
|
|
|
14
15
|
__setInput(name: string, value: any): void
|
|
15
16
|
__getInput(name: string): any
|
|
@@ -22,6 +23,11 @@ export interface IDataProcessor extends IObject {
|
|
|
22
23
|
destroy(): void
|
|
23
24
|
}
|
|
24
25
|
|
|
26
|
+
export interface ILeafDataOptions {
|
|
27
|
+
attrs?: 'all' | string[]
|
|
28
|
+
children?: boolean
|
|
29
|
+
}
|
|
30
|
+
|
|
25
31
|
export interface ILeafData extends IDataProcessor, ILeafComputedData {
|
|
26
32
|
|
|
27
33
|
}
|
package/src/data/IList.ts
CHANGED
|
@@ -18,13 +18,16 @@ export interface ILeafList {
|
|
|
18
18
|
has(leaf: ILeaf): boolean
|
|
19
19
|
indexAt(index: number): ILeaf
|
|
20
20
|
indexOf(leaf: ILeaf): number
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
|
|
22
|
+
add(leaf: ILeaf): void
|
|
23
|
+
addAt(leaf: ILeaf, index: number): void
|
|
24
|
+
addList(list: ILeaf[]): void
|
|
25
25
|
remove(leaf: ILeaf): void
|
|
26
|
+
|
|
26
27
|
forEach(itemCallback: ILeafListItemCallback): void
|
|
28
|
+
sort(reverse?: boolean): void
|
|
27
29
|
clone(): ILeafList
|
|
30
|
+
update(): void
|
|
28
31
|
reset(): void
|
|
29
32
|
destroy(): void
|
|
30
33
|
}
|
|
@@ -37,8 +40,8 @@ export interface ILeafLevelList {
|
|
|
37
40
|
has(leaf: ILeaf): boolean
|
|
38
41
|
without(leaf: ILeaf): boolean
|
|
39
42
|
sort(reverse?: boolean): void
|
|
40
|
-
|
|
41
|
-
|
|
43
|
+
addList(list: ILeaf[]): void
|
|
44
|
+
add(leaf: ILeaf): void
|
|
42
45
|
forEach(itemCallback: ILeafListItemCallback): void
|
|
43
46
|
reset(): void
|
|
44
47
|
destroy(): void
|
package/src/display/ILeaf.ts
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ILeaferBase } from '../app/ILeafer'
|
|
2
2
|
import { IEventer } from '../event/IEventer'
|
|
3
3
|
|
|
4
4
|
import { ILeaferCanvas, IHitCanvas } from '../canvas/ILeaferCanvas'
|
|
5
5
|
import { IRenderOptions } from '../renderer/IRenderer'
|
|
6
6
|
|
|
7
|
-
import { IObject,
|
|
8
|
-
import { IMatrixWithBoundsData, IMatrix, IPointData, IBoundsData, IRadiusPointData,
|
|
7
|
+
import { IObject, INumber, IBoolean, IValue, IString } from '../data/IData'
|
|
8
|
+
import { IMatrixWithBoundsData, IMatrix, IPointData, IBoundsData, IRadiusPointData, ILayoutAttr, IMatrixWithLayoutData, ILayoutBoundsData, IMatrixData } from '../math/IMath'
|
|
9
9
|
import { IFunction } from '../function/IFunction'
|
|
10
10
|
|
|
11
11
|
import { ILeafDataProxy } from './module/ILeafDataProxy'
|
|
12
12
|
import { ILeafMatrix } from './module/ILeafMatrix'
|
|
13
13
|
import { ILeafBounds } from './module/ILeafBounds'
|
|
14
|
-
import { ILeafLayout,
|
|
14
|
+
import { ILeafLayout, IBoundsType, ILocationType } from '../layout/ILeafLayout'
|
|
15
15
|
import { ILeafHit } from './module/ILeafHit'
|
|
16
16
|
import { ILeafRender } from './module/ILeafRender'
|
|
17
17
|
import { ILeafMask } from './module/ILeafMask'
|
|
18
18
|
import { ILeafData } from '../data/ILeafData'
|
|
19
|
+
import { IFindMethod } from '../selector/ISelector'
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
export interface ICachedLeaf {
|
|
@@ -27,39 +28,44 @@ export interface ICachedLeaf {
|
|
|
27
28
|
|
|
28
29
|
export interface ILeafAttrData {
|
|
29
30
|
// layer data
|
|
30
|
-
id:
|
|
31
|
-
name:
|
|
32
|
-
className:
|
|
31
|
+
id: IString
|
|
32
|
+
name: IString
|
|
33
|
+
className: IString
|
|
33
34
|
|
|
34
35
|
blendMode: IBlendMode
|
|
35
|
-
opacity:
|
|
36
|
-
visible:
|
|
37
|
-
isMask:
|
|
38
|
-
isEraser:
|
|
39
|
-
|
|
36
|
+
opacity: INumber
|
|
37
|
+
visible: IBoolean
|
|
38
|
+
isMask: IBoolean
|
|
39
|
+
isEraser: IBoolean
|
|
40
|
+
locked: IBoolean
|
|
41
|
+
zIndex: INumber
|
|
40
42
|
|
|
41
43
|
// layout data
|
|
42
|
-
x:
|
|
43
|
-
y:
|
|
44
|
-
width:
|
|
45
|
-
height:
|
|
46
|
-
scaleX:
|
|
47
|
-
scaleY:
|
|
48
|
-
rotation:
|
|
49
|
-
skewX:
|
|
50
|
-
skewY:
|
|
51
|
-
|
|
52
|
-
scale:
|
|
53
|
-
around:
|
|
54
|
-
|
|
55
|
-
draggable:
|
|
56
|
-
|
|
57
|
-
|
|
44
|
+
x: INumber
|
|
45
|
+
y: INumber
|
|
46
|
+
width: INumber
|
|
47
|
+
height: INumber
|
|
48
|
+
scaleX: INumber
|
|
49
|
+
scaleY: INumber
|
|
50
|
+
rotation: INumber
|
|
51
|
+
skewX: INumber
|
|
52
|
+
skewY: INumber
|
|
53
|
+
|
|
54
|
+
scale: INumber | IPointData // helper
|
|
55
|
+
around: IAround
|
|
56
|
+
|
|
57
|
+
draggable: IBoolean
|
|
58
|
+
|
|
59
|
+
editable: IBoolean
|
|
60
|
+
editSize?: IEditSize
|
|
61
|
+
|
|
62
|
+
hittable: IBoolean
|
|
58
63
|
hitFill: IHitType
|
|
59
64
|
hitStroke: IHitType
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
65
|
+
hitBox: IBoolean
|
|
66
|
+
hitChildren: IBoolean
|
|
67
|
+
hitSelf: IBoolean
|
|
68
|
+
hitRadius: INumber
|
|
63
69
|
|
|
64
70
|
cursor: ICursorType | ICursorType[]
|
|
65
71
|
}
|
|
@@ -98,14 +104,16 @@ export type IBlendMode =
|
|
|
98
104
|
| 'destination-atop'
|
|
99
105
|
| 'xor'
|
|
100
106
|
|
|
101
|
-
export type
|
|
107
|
+
export type IEditSize = 'size' | 'scale'
|
|
102
108
|
export interface IImageCursor {
|
|
103
109
|
url: string
|
|
104
110
|
x?: number
|
|
105
111
|
y?: number
|
|
106
112
|
}
|
|
107
113
|
|
|
108
|
-
export type IAround =
|
|
114
|
+
export type IAround =
|
|
115
|
+
| 'center'
|
|
116
|
+
| IPointData
|
|
109
117
|
|
|
110
118
|
export type ICursorType =
|
|
111
119
|
| IImageCursor
|
|
@@ -150,47 +158,55 @@ export type ICursorType =
|
|
|
150
158
|
export interface ICursorTypeMap {
|
|
151
159
|
[name: string]: ICursorType | ICursorType[]
|
|
152
160
|
}
|
|
153
|
-
export interface ILeafInputData
|
|
161
|
+
export interface ILeafInputData {
|
|
154
162
|
tag?: string
|
|
155
163
|
|
|
156
164
|
// layer data
|
|
157
|
-
id?:
|
|
158
|
-
name?:
|
|
159
|
-
className?:
|
|
165
|
+
id?: IString
|
|
166
|
+
name?: IString
|
|
167
|
+
className?: IString
|
|
160
168
|
|
|
161
169
|
blendMode?: IBlendMode
|
|
162
|
-
opacity?:
|
|
163
|
-
visible?:
|
|
164
|
-
isMask?:
|
|
165
|
-
isEraser?:
|
|
166
|
-
|
|
170
|
+
opacity?: INumber
|
|
171
|
+
visible?: IBoolean
|
|
172
|
+
isMask?: IBoolean
|
|
173
|
+
isEraser?: IBoolean
|
|
174
|
+
locked?: IBoolean
|
|
175
|
+
zIndex?: INumber
|
|
167
176
|
|
|
168
177
|
// layout data
|
|
169
|
-
x?:
|
|
170
|
-
y?:
|
|
171
|
-
width?:
|
|
172
|
-
height?:
|
|
173
|
-
scaleX?:
|
|
174
|
-
scaleY?:
|
|
175
|
-
rotation?:
|
|
176
|
-
skewX?:
|
|
177
|
-
skewY?:
|
|
178
|
-
|
|
179
|
-
scale?:
|
|
178
|
+
x?: INumber
|
|
179
|
+
y?: INumber
|
|
180
|
+
width?: INumber
|
|
181
|
+
height?: INumber
|
|
182
|
+
scaleX?: INumber
|
|
183
|
+
scaleY?: INumber
|
|
184
|
+
rotation?: INumber
|
|
185
|
+
skewX?: INumber
|
|
186
|
+
skewY?: INumber
|
|
187
|
+
|
|
188
|
+
scale?: INumber | IPointData // helper
|
|
180
189
|
around?: IAround
|
|
181
190
|
|
|
182
|
-
draggable?:
|
|
191
|
+
draggable?: IBoolean
|
|
183
192
|
|
|
184
|
-
|
|
193
|
+
editable?: IBoolean
|
|
194
|
+
editSize?: IEditSize
|
|
195
|
+
|
|
196
|
+
hittable?: IBoolean
|
|
185
197
|
hitFill?: IHitType
|
|
186
198
|
hitStroke?: IHitType
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
199
|
+
hitBox?: IBoolean
|
|
200
|
+
hitChildren?: IBoolean
|
|
201
|
+
hitSelf?: IBoolean
|
|
202
|
+
hitRadius?: INumber
|
|
190
203
|
|
|
191
204
|
cursor?: ICursorType | ICursorType[]
|
|
192
205
|
|
|
193
206
|
children?: ILeafInputData[]
|
|
207
|
+
|
|
208
|
+
// other
|
|
209
|
+
noBounds?: boolean
|
|
194
210
|
}
|
|
195
211
|
export interface ILeafComputedData {
|
|
196
212
|
// layer data
|
|
@@ -203,6 +219,7 @@ export interface ILeafComputedData {
|
|
|
203
219
|
visible?: boolean
|
|
204
220
|
isMask?: boolean
|
|
205
221
|
isEraser?: boolean
|
|
222
|
+
locked?: boolean
|
|
206
223
|
zIndex?: number
|
|
207
224
|
|
|
208
225
|
// layout data
|
|
@@ -220,9 +237,13 @@ export interface ILeafComputedData {
|
|
|
220
237
|
|
|
221
238
|
draggable?: boolean
|
|
222
239
|
|
|
240
|
+
editable?: boolean
|
|
241
|
+
editSize?: IEditSize
|
|
242
|
+
|
|
223
243
|
hittable?: boolean
|
|
224
244
|
hitFill?: IHitType
|
|
225
245
|
hitStroke?: IHitType
|
|
246
|
+
hitBox?: boolean
|
|
226
247
|
hitChildren?: boolean
|
|
227
248
|
hitSelf?: boolean
|
|
228
249
|
hitRadius?: number
|
|
@@ -244,7 +265,8 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
|
|
|
244
265
|
readonly __DataProcessor: IObject // IDataProcessor
|
|
245
266
|
readonly __LayoutProcessor: IObject // ILeafLayout
|
|
246
267
|
|
|
247
|
-
|
|
268
|
+
readonly app?: ILeaferBase
|
|
269
|
+
leafer?: ILeaferBase
|
|
248
270
|
parent?: ILeaf
|
|
249
271
|
|
|
250
272
|
readonly isApp?: boolean
|
|
@@ -253,10 +275,17 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
|
|
|
253
275
|
isBranchLeaf?: boolean
|
|
254
276
|
|
|
255
277
|
__: ILeafData
|
|
278
|
+
|
|
279
|
+
proxyData?: ILeafInputData
|
|
280
|
+
__proxyData?: ILeafInputData
|
|
281
|
+
|
|
256
282
|
__layout: ILeafLayout
|
|
257
283
|
|
|
258
284
|
__world: IMatrixWithLayoutData
|
|
259
|
-
__local
|
|
285
|
+
__local?: IMatrixWithBoundsData
|
|
286
|
+
|
|
287
|
+
readonly __localMatrix: IMatrixData
|
|
288
|
+
readonly __localBounds: IBoundsData
|
|
260
289
|
|
|
261
290
|
__worldOpacity: number
|
|
262
291
|
|
|
@@ -273,10 +302,9 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
|
|
|
273
302
|
__level: number // 图层级别 root(1) -> hight
|
|
274
303
|
__tempNumber?: number // 用于临时运算储存状态
|
|
275
304
|
|
|
276
|
-
readonly
|
|
277
|
-
|
|
278
|
-
readonly __hasMirror: boolean
|
|
305
|
+
readonly __worldFlipped: boolean
|
|
279
306
|
|
|
307
|
+
__hasAutoLayout?: boolean
|
|
280
308
|
__hasMask?: boolean
|
|
281
309
|
__hasEraser?: boolean
|
|
282
310
|
__hitCanvas?: IHitCanvas
|
|
@@ -296,24 +324,34 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
|
|
|
296
324
|
waitLeafer(item: IFunction): void
|
|
297
325
|
nextRender(item: IFunction): void
|
|
298
326
|
|
|
299
|
-
__bindLeafer(leafer:
|
|
327
|
+
__bindLeafer(leafer: ILeaferBase | null): void
|
|
300
328
|
|
|
301
329
|
set(data: IObject): void
|
|
330
|
+
get(): ILeafInputData
|
|
302
331
|
toJSON(): IObject
|
|
303
332
|
toString(): string
|
|
304
333
|
|
|
305
334
|
// ILeafData ->
|
|
306
|
-
__setAttr(attrName: string, newValue:
|
|
307
|
-
__getAttr(attrName: string):
|
|
335
|
+
__setAttr(attrName: string, newValue: IValue): void
|
|
336
|
+
__getAttr(attrName: string): IValue
|
|
337
|
+
setProxyAttr(name: string, newValue: IValue): void
|
|
338
|
+
getProxyAttr(name: string): IValue
|
|
339
|
+
|
|
340
|
+
// find
|
|
341
|
+
find(condition: number | string | IFindMethod, options?: any): ILeaf[]
|
|
342
|
+
findOne(condition: number | string | IFindMethod, options?: any): ILeaf
|
|
308
343
|
|
|
309
344
|
forceUpdate(attrName?: string): void
|
|
310
345
|
|
|
346
|
+
updateLayout(): void
|
|
347
|
+
|
|
311
348
|
// ILeafMatrix ->
|
|
312
349
|
__updateWorldMatrix(): void
|
|
313
350
|
__updateLocalMatrix(): void
|
|
314
351
|
|
|
315
352
|
// ILeafBounds ->
|
|
316
353
|
__updateWorldBounds(): void
|
|
354
|
+
__updateLocalBounds(): void
|
|
317
355
|
|
|
318
356
|
__updateLocalBoxBounds(): void
|
|
319
357
|
__updateLocalStrokeBounds(): void
|
|
@@ -323,6 +361,7 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
|
|
|
323
361
|
__updateStrokeBounds(): void
|
|
324
362
|
__updateRenderBounds(): void
|
|
325
363
|
|
|
364
|
+
__updateAutoLayout(): void
|
|
326
365
|
__updateNaturalSize(): void
|
|
327
366
|
|
|
328
367
|
__updateStrokeSpread(): number
|
|
@@ -333,12 +372,13 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
|
|
|
333
372
|
// IBranchMask ->
|
|
334
373
|
__updateEraser(value?: boolean): void
|
|
335
374
|
__updateMask(value?: boolean): void
|
|
336
|
-
__renderMask(canvas: ILeaferCanvas, content: ILeaferCanvas, mask: ILeaferCanvas): void
|
|
375
|
+
__renderMask(canvas: ILeaferCanvas, content: ILeaferCanvas, mask: ILeaferCanvas, recycle?: boolean): void
|
|
337
376
|
__removeMask(child?: ILeaf): void
|
|
338
377
|
|
|
339
378
|
// convert
|
|
340
|
-
getWorld(attrName:
|
|
341
|
-
getBounds(type
|
|
379
|
+
getWorld(attrName: ILayoutAttr): number
|
|
380
|
+
getBounds(type?: IBoundsType, relative?: ILocationType | ILeaf): IBoundsData
|
|
381
|
+
getLayoutBounds(type?: IBoundsType, relative?: ILocationType | ILeaf, unscale?: boolean): ILayoutBoundsData
|
|
342
382
|
|
|
343
383
|
worldToLocal(world: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void
|
|
344
384
|
localToWorld(local: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void
|
|
@@ -352,10 +392,17 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
|
|
|
352
392
|
getWorldPoint(inner: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData
|
|
353
393
|
getWorldPointByLocal(local: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData
|
|
354
394
|
|
|
395
|
+
// transform
|
|
396
|
+
setTransform(transform?: IMatrixData, resize?: boolean): void
|
|
397
|
+
transform(transform?: IMatrixData, resize?: boolean): void
|
|
398
|
+
|
|
355
399
|
move(x: number, y?: number): void
|
|
356
|
-
scaleOf(origin: IPointData,
|
|
400
|
+
scaleOf(origin: IPointData, scaleX: number, scaleY?: number, resize?: boolean): void
|
|
357
401
|
rotateOf(origin: IPointData, rotation: number): void
|
|
358
|
-
skewOf(origin: IPointData,
|
|
402
|
+
skewOf(origin: IPointData, skewX: number, skewY?: number, resize?: boolean): void
|
|
403
|
+
|
|
404
|
+
scaleResize(scaleX: number, scaleY: number, noResize?: boolean): void
|
|
405
|
+
__scaleResize(scaleX: number, scaleY: number): void
|
|
359
406
|
|
|
360
407
|
// ILeafHit ->
|
|
361
408
|
__hitWorld(point: IRadiusPointData): boolean
|
|
@@ -385,4 +432,5 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
|
|
|
385
432
|
__updateSortChildren(): void
|
|
386
433
|
add(child: ILeaf, index?: number): void
|
|
387
434
|
remove(child?: ILeaf, destroy?: boolean): void
|
|
435
|
+
dropTo(parent: ILeaf, index?: number, resize?: boolean): void
|
|
388
436
|
}
|
|
@@ -4,6 +4,7 @@ export type ILeafBoundsModule = ILeafBounds & ThisType<ILeaf>
|
|
|
4
4
|
|
|
5
5
|
export interface ILeafBounds {
|
|
6
6
|
__updateWorldBounds?(): void
|
|
7
|
+
__updateLocalBounds?(): void
|
|
7
8
|
|
|
8
9
|
__updateLocalBoxBounds?(): void
|
|
9
10
|
__updateLocalStrokeBounds?(): void
|
|
@@ -13,6 +14,7 @@ export interface ILeafBounds {
|
|
|
13
14
|
__updateStrokeBounds?(): void
|
|
14
15
|
__updateRenderBounds?(): void
|
|
15
16
|
|
|
17
|
+
__updateAutoLayout?(): void
|
|
16
18
|
__updateNaturalSize?(): void
|
|
17
19
|
|
|
18
20
|
__updateStrokeSpread?(): number
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { ILeaf } from '../ILeaf'
|
|
2
|
-
import {
|
|
2
|
+
import { IValue } from '../../data/IData'
|
|
3
3
|
|
|
4
4
|
export type ILeafDataProxyModule = ILeafDataProxy & ThisType<ILeaf>
|
|
5
5
|
|
|
6
6
|
export interface ILeafDataProxy {
|
|
7
|
-
__setAttr?(name: string, newValue:
|
|
8
|
-
__getAttr?(name: string):
|
|
7
|
+
__setAttr?(name: string, newValue: IValue): void
|
|
8
|
+
__getAttr?(name: string): IValue
|
|
9
|
+
setProxyAttr?(name: string, newValue: IValue): void
|
|
10
|
+
getProxyAttr?(name: string): IValue
|
|
9
11
|
}
|
|
10
12
|
|
|
@@ -6,7 +6,7 @@ export type ILeafMaskModule = ILeafMask & ThisType<ILeaf>
|
|
|
6
6
|
export interface ILeafMask {
|
|
7
7
|
__updateEraser?(value?: boolean): void
|
|
8
8
|
__updateMask?(value?: boolean): void
|
|
9
|
-
__renderMask?(canvas: ILeaferCanvas, content: ILeaferCanvas, mask: ILeaferCanvas): void
|
|
9
|
+
__renderMask?(canvas: ILeaferCanvas, content: ILeaferCanvas, mask: ILeaferCanvas, recycle?: boolean): void
|
|
10
10
|
__removeMask?(child?: ILeaf): void
|
|
11
11
|
}
|
|
12
12
|
|
package/src/event/IEventer.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import { IEvent, IFunction, IObject } from '@leafer/interface'
|
|
2
1
|
import { ILeafEventer } from '../display/module/ILeafEventer'
|
|
2
|
+
import { ILeaf } from '../display/ILeaf'
|
|
3
|
+
import { IFunction } from '../function/IFunction'
|
|
4
|
+
import { IEvent } from './IEvent'
|
|
5
|
+
import { IObject } from '../data/IData'
|
|
6
|
+
|
|
3
7
|
|
|
4
8
|
export type IEventListener = IFunction
|
|
5
9
|
|
|
@@ -18,6 +22,7 @@ export interface IEventListenerMap {
|
|
|
18
22
|
|
|
19
23
|
export interface IEventListenerId {
|
|
20
24
|
type: string | string[]
|
|
25
|
+
current: ILeaf
|
|
21
26
|
listener: IEventListener
|
|
22
27
|
options?: IEventListenerOptions | boolean
|
|
23
28
|
}
|
|
@@ -10,4 +10,13 @@ export interface INumberFunction {
|
|
|
10
10
|
|
|
11
11
|
export interface IPointDataFunction {
|
|
12
12
|
(...arg: any): IPointData
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
export interface IAttrDecorator {
|
|
17
|
+
(...arg: any): IAttrDecoratorInner
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface IAttrDecoratorInner {
|
|
21
|
+
(target: any, key: string): any
|
|
13
22
|
}
|