@leafer/interface 1.0.0-rc.6 → 1.0.0-rc.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/app/IApp.ts +3 -3
- package/src/app/ILeafer.ts +22 -10
- package/src/canvas/ILeaferCanvas.ts +1 -1
- package/src/data/IData.ts +4 -5
- package/src/data/ILeafData.ts +3 -2
- package/src/data/IList.ts +9 -6
- package/src/display/ILeaf.ts +121 -78
- package/src/display/module/ILeafBounds.ts +2 -0
- package/src/display/module/ILeafDataProxy.ts +5 -5
- package/src/event/IEventer.ts +6 -1
- package/src/function/IFunction.ts +9 -0
- package/src/index.ts +8 -8
- package/src/interaction/IInteraction.ts +2 -0
- package/src/layout/ILeafLayout.ts +20 -8
- package/src/layouter/ILayouter.ts +3 -0
- package/src/math/IMath.ts +46 -31
- package/src/platform/IPlatform.ts +5 -2
- package/src/plugin/IPlugin.ts +2 -2
- package/src/selector/ISelector.ts +13 -2
- package/types/index.d.ts +230 -153
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,14 @@ 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
|
|
32
|
+
imageReady: boolean
|
|
37
33
|
viewCompleted: boolean
|
|
34
|
+
layoutLocked: boolean
|
|
38
35
|
|
|
39
36
|
pixelRatio: number
|
|
40
37
|
|
|
@@ -62,7 +59,14 @@ export interface ILeafer extends IZoomView, IControl {
|
|
|
62
59
|
__eventIds: IEventListenerId[]
|
|
63
60
|
__nextRenderWait: IFunction[]
|
|
64
61
|
|
|
65
|
-
init(userConfig?: ILeaferConfig, parentApp?:
|
|
62
|
+
init(userConfig?: ILeaferConfig, parentApp?: IAppBase): void
|
|
63
|
+
|
|
64
|
+
start(): void
|
|
65
|
+
stop(): void
|
|
66
|
+
|
|
67
|
+
unlockLayout(): void
|
|
68
|
+
lockLayout(): void
|
|
69
|
+
|
|
66
70
|
setZoomLayer(zoomLayer: ILeaf): void
|
|
67
71
|
forceFullRender(): void
|
|
68
72
|
updateCursor(): void
|
|
@@ -73,14 +77,20 @@ export interface ILeafer extends IZoomView, IControl {
|
|
|
73
77
|
waitViewCompleted(item: IFunction): void
|
|
74
78
|
}
|
|
75
79
|
|
|
80
|
+
export interface ILeaferBase extends IZoomView, IControl, ILeaferAttrData {
|
|
81
|
+
readonly isApp: boolean
|
|
82
|
+
readonly app: ILeaferBase
|
|
83
|
+
parent?: IAppBase
|
|
84
|
+
}
|
|
85
|
+
|
|
76
86
|
export interface ILeaferTypeCreator {
|
|
77
87
|
list: ILeaferTypeList
|
|
78
88
|
register(name: string, fn: ILeaferTypeFunction): void
|
|
79
|
-
run(name: string, leafer:
|
|
89
|
+
run(name: string, leafer: ILeaferBase): void
|
|
80
90
|
}
|
|
81
91
|
|
|
82
92
|
export interface ILeaferTypeFunction {
|
|
83
|
-
(leafer:
|
|
93
|
+
(leafer: ILeaferBase): void
|
|
84
94
|
}
|
|
85
95
|
|
|
86
96
|
export interface ILeaferTypeList {
|
|
@@ -98,6 +108,8 @@ export interface ICreator {
|
|
|
98
108
|
selector?(target: ILeaf, options?: ISelectorConfig): ISelector
|
|
99
109
|
|
|
100
110
|
interaction?(target: ILeaf, canvas: IInteractionCanvas, selector: ISelector, options?: IInteractionConfig): IInteraction
|
|
111
|
+
|
|
112
|
+
editor?(options?: IObject): ILeaf
|
|
101
113
|
}
|
|
102
114
|
|
|
103
115
|
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
|
|
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,11 +10,12 @@ 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
|
|
16
17
|
__removeInput(name: string): void
|
|
17
|
-
__getInputData(
|
|
18
|
+
__getInputData(): IObject
|
|
18
19
|
|
|
19
20
|
__setMiddle(name: string, value: any): void
|
|
20
21
|
__getMiddle(name: string): any
|
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,21 @@
|
|
|
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
|
-
import { ILeafData
|
|
18
|
+
import { ILeafData } from '../data/ILeafData'
|
|
19
19
|
import { IFindMethod } from '../selector/ISelector'
|
|
20
20
|
|
|
21
21
|
|
|
@@ -28,40 +28,44 @@ export interface ICachedLeaf {
|
|
|
28
28
|
|
|
29
29
|
export interface ILeafAttrData {
|
|
30
30
|
// layer data
|
|
31
|
-
id:
|
|
32
|
-
name:
|
|
33
|
-
className:
|
|
31
|
+
id: IString
|
|
32
|
+
name: IString
|
|
33
|
+
className: IString
|
|
34
34
|
|
|
35
35
|
blendMode: IBlendMode
|
|
36
|
-
opacity:
|
|
37
|
-
visible:
|
|
38
|
-
isMask:
|
|
39
|
-
isEraser:
|
|
40
|
-
|
|
36
|
+
opacity: INumber
|
|
37
|
+
visible: IBoolean
|
|
38
|
+
isMask: IBoolean
|
|
39
|
+
isEraser: IBoolean
|
|
40
|
+
locked: IBoolean
|
|
41
|
+
zIndex: INumber
|
|
41
42
|
|
|
42
43
|
// layout data
|
|
43
|
-
x:
|
|
44
|
-
y:
|
|
45
|
-
width:
|
|
46
|
-
height:
|
|
47
|
-
scaleX:
|
|
48
|
-
scaleY:
|
|
49
|
-
rotation:
|
|
50
|
-
skewX:
|
|
51
|
-
skewY:
|
|
52
|
-
|
|
53
|
-
scale:
|
|
54
|
-
around:
|
|
55
|
-
|
|
56
|
-
draggable:
|
|
57
|
-
|
|
58
|
-
|
|
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
|
|
59
63
|
hitFill: IHitType
|
|
60
64
|
hitStroke: IHitType
|
|
61
|
-
hitBox:
|
|
62
|
-
hitChildren:
|
|
63
|
-
hitSelf:
|
|
64
|
-
hitRadius:
|
|
65
|
+
hitBox: IBoolean
|
|
66
|
+
hitChildren: IBoolean
|
|
67
|
+
hitSelf: IBoolean
|
|
68
|
+
hitRadius: INumber
|
|
65
69
|
|
|
66
70
|
cursor: ICursorType | ICursorType[]
|
|
67
71
|
}
|
|
@@ -100,14 +104,24 @@ export type IBlendMode =
|
|
|
100
104
|
| 'destination-atop'
|
|
101
105
|
| 'xor'
|
|
102
106
|
|
|
103
|
-
export type
|
|
107
|
+
export type IEditSize = 'size' | 'scale'
|
|
104
108
|
export interface IImageCursor {
|
|
105
109
|
url: string
|
|
106
110
|
x?: number
|
|
107
111
|
y?: number
|
|
108
112
|
}
|
|
109
113
|
|
|
110
|
-
export type IAround =
|
|
114
|
+
export type IAround =
|
|
115
|
+
| 'topLeft'
|
|
116
|
+
| 'top'
|
|
117
|
+
| 'topRight'
|
|
118
|
+
| 'right'
|
|
119
|
+
| 'bottomRight'
|
|
120
|
+
| 'bottom'
|
|
121
|
+
| 'bottomLeft'
|
|
122
|
+
| 'left'
|
|
123
|
+
| 'center'
|
|
124
|
+
| IPointData
|
|
111
125
|
|
|
112
126
|
export type ICursorType =
|
|
113
127
|
| IImageCursor
|
|
@@ -152,48 +166,55 @@ export type ICursorType =
|
|
|
152
166
|
export interface ICursorTypeMap {
|
|
153
167
|
[name: string]: ICursorType | ICursorType[]
|
|
154
168
|
}
|
|
155
|
-
export interface ILeafInputData
|
|
169
|
+
export interface ILeafInputData {
|
|
156
170
|
tag?: string
|
|
157
171
|
|
|
158
172
|
// layer data
|
|
159
|
-
id?:
|
|
160
|
-
name?:
|
|
161
|
-
className?:
|
|
173
|
+
id?: IString
|
|
174
|
+
name?: IString
|
|
175
|
+
className?: IString
|
|
162
176
|
|
|
163
177
|
blendMode?: IBlendMode
|
|
164
|
-
opacity?:
|
|
165
|
-
visible?:
|
|
166
|
-
isMask?:
|
|
167
|
-
isEraser?:
|
|
168
|
-
|
|
178
|
+
opacity?: INumber
|
|
179
|
+
visible?: IBoolean
|
|
180
|
+
isMask?: IBoolean
|
|
181
|
+
isEraser?: IBoolean
|
|
182
|
+
locked?: IBoolean
|
|
183
|
+
zIndex?: INumber
|
|
169
184
|
|
|
170
185
|
// layout data
|
|
171
|
-
x?:
|
|
172
|
-
y?:
|
|
173
|
-
width?:
|
|
174
|
-
height?:
|
|
175
|
-
scaleX?:
|
|
176
|
-
scaleY?:
|
|
177
|
-
rotation?:
|
|
178
|
-
skewX?:
|
|
179
|
-
skewY?:
|
|
180
|
-
|
|
181
|
-
scale?:
|
|
186
|
+
x?: INumber
|
|
187
|
+
y?: INumber
|
|
188
|
+
width?: INumber
|
|
189
|
+
height?: INumber
|
|
190
|
+
scaleX?: INumber
|
|
191
|
+
scaleY?: INumber
|
|
192
|
+
rotation?: INumber
|
|
193
|
+
skewX?: INumber
|
|
194
|
+
skewY?: INumber
|
|
195
|
+
|
|
196
|
+
scale?: INumber | IPointData // helper
|
|
182
197
|
around?: IAround
|
|
183
198
|
|
|
184
|
-
draggable?:
|
|
199
|
+
draggable?: IBoolean
|
|
185
200
|
|
|
186
|
-
|
|
201
|
+
editable?: IBoolean
|
|
202
|
+
editSize?: IEditSize
|
|
203
|
+
|
|
204
|
+
hittable?: IBoolean
|
|
187
205
|
hitFill?: IHitType
|
|
188
206
|
hitStroke?: IHitType
|
|
189
|
-
hitBox?:
|
|
190
|
-
hitChildren?:
|
|
191
|
-
hitSelf?:
|
|
192
|
-
hitRadius?:
|
|
207
|
+
hitBox?: IBoolean
|
|
208
|
+
hitChildren?: IBoolean
|
|
209
|
+
hitSelf?: IBoolean
|
|
210
|
+
hitRadius?: INumber
|
|
193
211
|
|
|
194
212
|
cursor?: ICursorType | ICursorType[]
|
|
195
213
|
|
|
196
214
|
children?: ILeafInputData[]
|
|
215
|
+
|
|
216
|
+
// other
|
|
217
|
+
noBounds?: boolean
|
|
197
218
|
}
|
|
198
219
|
export interface ILeafComputedData {
|
|
199
220
|
// layer data
|
|
@@ -206,6 +227,7 @@ export interface ILeafComputedData {
|
|
|
206
227
|
visible?: boolean
|
|
207
228
|
isMask?: boolean
|
|
208
229
|
isEraser?: boolean
|
|
230
|
+
locked?: boolean
|
|
209
231
|
zIndex?: number
|
|
210
232
|
|
|
211
233
|
// layout data
|
|
@@ -223,6 +245,9 @@ export interface ILeafComputedData {
|
|
|
223
245
|
|
|
224
246
|
draggable?: boolean
|
|
225
247
|
|
|
248
|
+
editable?: boolean
|
|
249
|
+
editSize?: IEditSize
|
|
250
|
+
|
|
226
251
|
hittable?: boolean
|
|
227
252
|
hitFill?: IHitType
|
|
228
253
|
hitStroke?: IHitType
|
|
@@ -248,7 +273,8 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
|
|
|
248
273
|
readonly __DataProcessor: IObject // IDataProcessor
|
|
249
274
|
readonly __LayoutProcessor: IObject // ILeafLayout
|
|
250
275
|
|
|
251
|
-
|
|
276
|
+
readonly app?: ILeaferBase
|
|
277
|
+
leafer?: ILeaferBase
|
|
252
278
|
parent?: ILeaf
|
|
253
279
|
|
|
254
280
|
readonly isApp?: boolean
|
|
@@ -257,12 +283,17 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
|
|
|
257
283
|
isBranchLeaf?: boolean
|
|
258
284
|
|
|
259
285
|
__: ILeafData
|
|
286
|
+
|
|
260
287
|
proxyData?: ILeafInputData
|
|
288
|
+
__proxyData?: ILeafInputData
|
|
261
289
|
|
|
262
290
|
__layout: ILeafLayout
|
|
263
291
|
|
|
264
292
|
__world: IMatrixWithLayoutData
|
|
265
|
-
__local
|
|
293
|
+
__local?: IMatrixWithBoundsData
|
|
294
|
+
|
|
295
|
+
readonly __localMatrix: IMatrixData
|
|
296
|
+
readonly __localBounds: IBoundsData
|
|
266
297
|
|
|
267
298
|
__worldOpacity: number
|
|
268
299
|
|
|
@@ -279,10 +310,9 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
|
|
|
279
310
|
__level: number // 图层级别 root(1) -> hight
|
|
280
311
|
__tempNumber?: number // 用于临时运算储存状态
|
|
281
312
|
|
|
282
|
-
readonly
|
|
283
|
-
|
|
284
|
-
readonly __hasMirror: boolean
|
|
313
|
+
readonly __worldFlipped: boolean
|
|
285
314
|
|
|
315
|
+
__hasAutoLayout?: boolean
|
|
286
316
|
__hasMask?: boolean
|
|
287
317
|
__hasEraser?: boolean
|
|
288
318
|
__hitCanvas?: IHitCanvas
|
|
@@ -302,31 +332,34 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
|
|
|
302
332
|
waitLeafer(item: IFunction): void
|
|
303
333
|
nextRender(item: IFunction): void
|
|
304
334
|
|
|
305
|
-
__bindLeafer(leafer:
|
|
335
|
+
__bindLeafer(leafer: ILeaferBase | null): void
|
|
306
336
|
|
|
307
337
|
set(data: IObject): void
|
|
308
|
-
get(
|
|
338
|
+
get(): ILeafInputData
|
|
309
339
|
toJSON(): IObject
|
|
310
340
|
toString(): string
|
|
311
341
|
|
|
312
342
|
// ILeafData ->
|
|
313
|
-
__setAttr(attrName: string, newValue:
|
|
314
|
-
__getAttr(attrName: string):
|
|
315
|
-
setProxyAttr(name: string, newValue:
|
|
316
|
-
getProxyAttr(name: string):
|
|
343
|
+
__setAttr(attrName: string, newValue: IValue): void
|
|
344
|
+
__getAttr(attrName: string): IValue
|
|
345
|
+
setProxyAttr(name: string, newValue: IValue): void
|
|
346
|
+
getProxyAttr(name: string): IValue
|
|
317
347
|
|
|
318
348
|
// find
|
|
319
|
-
find(condition: number | string | IFindMethod): ILeaf[]
|
|
320
|
-
findOne(condition: number | string | IFindMethod): ILeaf
|
|
349
|
+
find(condition: number | string | IFindMethod, options?: any): ILeaf[]
|
|
350
|
+
findOne(condition: number | string | IFindMethod, options?: any): ILeaf
|
|
321
351
|
|
|
322
352
|
forceUpdate(attrName?: string): void
|
|
323
353
|
|
|
354
|
+
updateLayout(): void
|
|
355
|
+
|
|
324
356
|
// ILeafMatrix ->
|
|
325
357
|
__updateWorldMatrix(): void
|
|
326
358
|
__updateLocalMatrix(): void
|
|
327
359
|
|
|
328
360
|
// ILeafBounds ->
|
|
329
361
|
__updateWorldBounds(): void
|
|
362
|
+
__updateLocalBounds(): void
|
|
330
363
|
|
|
331
364
|
__updateLocalBoxBounds(): void
|
|
332
365
|
__updateLocalStrokeBounds(): void
|
|
@@ -336,6 +369,7 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
|
|
|
336
369
|
__updateStrokeBounds(): void
|
|
337
370
|
__updateRenderBounds(): void
|
|
338
371
|
|
|
372
|
+
__updateAutoLayout(): void
|
|
339
373
|
__updateNaturalSize(): void
|
|
340
374
|
|
|
341
375
|
__updateStrokeSpread(): number
|
|
@@ -350,8 +384,9 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
|
|
|
350
384
|
__removeMask(child?: ILeaf): void
|
|
351
385
|
|
|
352
386
|
// convert
|
|
353
|
-
getWorld(attrName:
|
|
354
|
-
getBounds(type
|
|
387
|
+
getWorld(attrName: ILayoutAttr): number
|
|
388
|
+
getBounds(type?: IBoundsType, relative?: ILocationType | ILeaf): IBoundsData
|
|
389
|
+
getLayoutBounds(type?: IBoundsType, relative?: ILocationType | ILeaf, unscale?: boolean): ILayoutBoundsData
|
|
355
390
|
|
|
356
391
|
worldToLocal(world: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void
|
|
357
392
|
localToWorld(local: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void
|
|
@@ -365,10 +400,17 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
|
|
|
365
400
|
getWorldPoint(inner: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData
|
|
366
401
|
getWorldPointByLocal(local: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData
|
|
367
402
|
|
|
403
|
+
// transform
|
|
404
|
+
setTransform(transform?: IMatrixData, resize?: boolean): void
|
|
405
|
+
transform(transform?: IMatrixData, resize?: boolean): void
|
|
406
|
+
|
|
368
407
|
move(x: number, y?: number): void
|
|
369
|
-
scaleOf(origin: IPointData,
|
|
408
|
+
scaleOf(origin: IPointData, scaleX: number, scaleY?: number, resize?: boolean): void
|
|
370
409
|
rotateOf(origin: IPointData, rotation: number): void
|
|
371
|
-
skewOf(origin: IPointData,
|
|
410
|
+
skewOf(origin: IPointData, skewX: number, skewY?: number, resize?: boolean): void
|
|
411
|
+
|
|
412
|
+
scaleResize(scaleX: number, scaleY: number, noResize?: boolean): void
|
|
413
|
+
__scaleResize(scaleX: number, scaleY: number): void
|
|
372
414
|
|
|
373
415
|
// ILeafHit ->
|
|
374
416
|
__hitWorld(point: IRadiusPointData): boolean
|
|
@@ -398,4 +440,5 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
|
|
|
398
440
|
__updateSortChildren(): void
|
|
399
441
|
add(child: ILeaf, index?: number): void
|
|
400
442
|
remove(child?: ILeaf, destroy?: boolean): void
|
|
443
|
+
dropTo(parent: ILeaf, index?: number, resize?: boolean): void
|
|
401
444
|
}
|
|
@@ -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,12 +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):
|
|
9
|
-
setProxyAttr?(name: string, newValue:
|
|
10
|
-
getProxyAttr?(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
|
|
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
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export { ILeaf, ILeafAttrData, ILeafComputedData, ILeafInputData, ICachedLeaf, IHitType, IBlendMode,
|
|
1
|
+
export { IAppBase } from './app/IApp'
|
|
2
|
+
export { ILeaferBase, ILeaferAttrData, ILeaferType, ILeaferTypeCreator, ILeaferTypeFunction, ILeaferTypeList, ILeaferConfig, ICreator, IUICreator } from './app/ILeafer'
|
|
3
|
+
export { ILeaf, ILeafAttrData, ILeafComputedData, ILeafInputData, ICachedLeaf, IHitType, IBlendMode, IEditSize, ICursorType, ICursorTypeMap, IAround } from './display/ILeaf'
|
|
4
4
|
export { IBranch } from './display/IBranch'
|
|
5
5
|
export { IZoomView } from './display/IView'
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
export { ILeafData, IDataProcessor, ILeafDataOptions } from './data/ILeafData'
|
|
9
|
-
export { ILeafLayout,
|
|
9
|
+
export { ILeafLayout, ILocationType, IBoundsType } from './layout/ILeafLayout'
|
|
10
10
|
|
|
11
11
|
export { ILeafDataProxy, ILeafDataProxyModule } from './display/module/ILeafDataProxy'
|
|
12
12
|
export { ILeafMatrix, ILeafMatrixModule } from './display/module/ILeafMatrix'
|
|
@@ -20,7 +20,7 @@ export { IBranchRender, IBranchRenderModule } from './display/module/IBranchRend
|
|
|
20
20
|
export { IRenderer, IRendererConfig, IRenderOptions } from './renderer/IRenderer'
|
|
21
21
|
export { IWatcher, IWatchEventData, IWatcherConfig } from './watcher/IWatcher'
|
|
22
22
|
export { ILayouter, ILayoutChangedData, ILayoutBlockData, ILayouterConfig, IPartLayoutConfig } from './layouter/ILayouter'
|
|
23
|
-
export { ISelector, ISelectorConfig, IFindMethod, ISelectPathResult, ISelectPathOptions } from './selector/ISelector'
|
|
23
|
+
export { ISelector, ISelectorConfig, ISelectorProxy, IFindMethod, ISelectPathResult, ISelectPathOptions, AnswerType } from './selector/ISelector'
|
|
24
24
|
|
|
25
25
|
export { ICanvasManager } from './canvas/ICanvasManager'
|
|
26
26
|
export { IHitCanvasManager } from './canvas/IHitCanvasManager'
|
|
@@ -49,7 +49,7 @@ export { IUIEvent, IPointerEvent, PointerType, IDragEvent, IDropEvent, ISwipeEve
|
|
|
49
49
|
export { IInteraction, IInteractionCanvas, IInteractionConfig, IWheelConfig, IPointerConfig } from './interaction/IInteraction'
|
|
50
50
|
|
|
51
51
|
|
|
52
|
-
export {
|
|
52
|
+
export { INumber, IBoolean, IString, IValue, IPathString, ITimer, IObject, INumberMap, IStringMap, IBooleanMap, IDataTypeHandle } from './data/IData'
|
|
53
53
|
export { ILeafList, ILeafArrayMap, ILeafMap, ILeafLevelList, ILeafListItemCallback } from './data/IList'
|
|
54
|
-
export { IPoint, IPointData, IRadiusPointData, ISize, ISizeData, IScreenSizeData, IBounds, IBoundsData,
|
|
55
|
-
export { IFunction } from './function/IFunction'
|
|
54
|
+
export { IPoint, IPointData, IRadiusPointData, ISize, ISizeData, IScreenSizeData, IBounds, IBoundsData, IBoundsDataFn, IOffsetBoundsData, ITwoPointBoundsData, IAutoBounds, IAutoBoundsData, IMatrix, IMatrixData, IMatrixWithBoundsData, IMatrixWithScaleData, IMatrixWithLayoutData, IScaleRotationData, IScaleData, ISkewData, ILayoutBoundsData, ILayoutData, ILayoutAttr } from './math/IMath'
|
|
55
|
+
export { IFunction, IAttrDecorator } from './function/IFunction'
|
|
@@ -17,6 +17,7 @@ export interface IInteraction extends IControl {
|
|
|
17
17
|
|
|
18
18
|
running: boolean
|
|
19
19
|
readonly dragging: boolean
|
|
20
|
+
readonly isDragEmpty: boolean
|
|
20
21
|
readonly moveMode: boolean
|
|
21
22
|
|
|
22
23
|
config: IInteractionConfig
|
|
@@ -77,6 +78,7 @@ export interface IZoomConfig {
|
|
|
77
78
|
|
|
78
79
|
export interface IMoveConfig {
|
|
79
80
|
holdSpaceKey?: boolean
|
|
81
|
+
drag?: boolean
|
|
80
82
|
dragEmpty?: boolean
|
|
81
83
|
dragOut?: boolean
|
|
82
84
|
autoDistance?: number
|