@leafer/interface 1.0.0-rc.1 → 1.0.0-rc.10

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.
@@ -1,21 +1,21 @@
1
- import { ILeafer } from '../app/ILeafer'
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, __Number, __Boolean, __Value, __String } from '../data/IData'
8
- import { IMatrixWithBoundsData, IMatrix, IPointData, IBoundsData, IRadiusPointData, IMatrixDecompositionAttr, IMatrixWithLayoutData } from '../math/IMath'
7
+ import { IObject, INumber, IBoolean, IValue, IString } from '../data/IData'
8
+ import { IMatrixWithBoundsData, IMatrix, IPointData, IBoundsData, IRadiusPointData, ILayoutAttr, ILayoutBoundsData, IMatrixData, IMatrixWithBoundsScaleData } 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, ILayoutBoundsType, ILayoutLocationType } from '../layout/ILeafLayout'
14
+ import { ILeafLayout, IBoundsType, ILocationType } from '../layout/ILeafLayout'
15
15
  import { ILeafHit } from './module/ILeafHit'
16
16
  import { ILeafRender } from './module/ILeafRender'
17
- import { ILeafMask } from './module/ILeafMask'
18
17
  import { ILeafData } from '../data/ILeafData'
18
+ import { IFindMethod } from '../selector/ISelector'
19
19
 
20
20
 
21
21
  export interface ICachedLeaf {
@@ -27,39 +27,47 @@ export interface ICachedLeaf {
27
27
 
28
28
  export interface ILeafAttrData {
29
29
  // layer data
30
- id: __String
31
- name: __String
32
- className: __String
30
+ id: IString
31
+ name: IString
32
+ className: IString
33
33
 
34
34
  blendMode: IBlendMode
35
- opacity: __Number
36
- visible: __Boolean
37
- isMask: __Boolean
38
- isEraser: __Boolean
39
- zIndex: __Number
35
+ opacity: INumber
36
+ visible: IBoolean
37
+ locked: IBoolean
38
+ zIndex: INumber
39
+
40
+ mask: IBoolean
41
+ maskType: IMaskType
42
+ eraser: IBoolean
40
43
 
41
44
  // layout data
42
- x: __Number
43
- y: __Number
44
- width: __Number
45
- height: __Number
46
- scaleX: __Number
47
- scaleY: __Number
48
- rotation: __Number
49
- skewX: __Number
50
- skewY: __Number
51
-
52
- scale: __Number | IPointData // helper
53
- around: 'center' | IPointData
54
-
55
- draggable: __Boolean
56
-
57
- hittable: __Boolean
45
+ x: INumber
46
+ y: INumber
47
+ width: INumber
48
+ height: INumber
49
+ scaleX: INumber
50
+ scaleY: INumber
51
+ rotation: INumber
52
+ skewX: INumber
53
+ skewY: INumber
54
+
55
+ scale: INumber | IPointData // helper
56
+ around: IAround
57
+ lazy: IBoolean
58
+
59
+ draggable: IBoolean
60
+
61
+ editable: IBoolean
62
+ editSize?: IEditSize
63
+
64
+ hittable: IBoolean
58
65
  hitFill: IHitType
59
66
  hitStroke: IHitType
60
- hitChildren: __Boolean
61
- hitSelf: __Boolean
62
- hitRadius: __Number
67
+ hitBox: IBoolean
68
+ hitChildren: IBoolean
69
+ hitSelf: IBoolean
70
+ hitRadius: INumber
63
71
 
64
72
  cursor: ICursorType | ICursorType[]
65
73
  }
@@ -70,6 +78,11 @@ export type IHitType =
70
78
  | 'all'
71
79
  | 'none'
72
80
 
81
+ export type IMaskType =
82
+ | 'path'
83
+ | 'pixel'
84
+ | 'clipping'
85
+
73
86
  export type IBlendMode =
74
87
  | 'pass-through'
75
88
  | 'normal'
@@ -96,18 +109,31 @@ export type IBlendMode =
96
109
  | 'destination-in'
97
110
  | 'destination-out'
98
111
  | 'destination-atop'
112
+ | 'xor'
99
113
 
100
- export type IResizeType = 'size' | 'scale'
114
+ export type IEditSize = 'size' | 'scale'
101
115
  export interface IImageCursor {
102
116
  url: string
103
117
  x?: number
104
118
  y?: number
119
+ rotation?: number
105
120
  }
106
121
 
107
- export type IAround = 'center' | IPointData
122
+ export type IAround =
123
+ | 'topLeft'
124
+ | 'top'
125
+ | 'topRight'
126
+ | 'right'
127
+ | 'bottomRight'
128
+ | 'bottom'
129
+ | 'bottomLeft'
130
+ | 'left'
131
+ | 'center'
132
+ | IPointData
108
133
 
109
134
  export type ICursorType =
110
135
  | IImageCursor
136
+ | ''
111
137
  | 'auto'
112
138
  | 'default'
113
139
  | 'none'
@@ -142,53 +168,62 @@ export type ICursorType =
142
168
  | 'col-resize'
143
169
  | 'row-resize'
144
170
  | 'all-scroll'
145
- | 'zoom -in'
171
+ | 'zoom-in'
146
172
  | 'zoom-out'
147
173
 
148
- export interface ICursorTypeMap {
149
- [name: string]: ICursorType | ICursorType[]
150
- }
151
- export interface ILeafInputData extends IObject {
174
+
175
+ export interface ILeafInputData {
152
176
  tag?: string
153
177
 
154
178
  // layer data
155
- id?: __String
156
- name?: __String
157
- className?: __String
179
+ id?: IString
180
+ name?: IString
181
+ className?: IString
158
182
 
159
183
  blendMode?: IBlendMode
160
- opacity?: __Number
161
- visible?: __Boolean
162
- isMask?: __Boolean
163
- isEraser?: __Boolean
164
- zIndex?: __Number
184
+ opacity?: INumber
185
+ visible?: IBoolean
186
+ locked?: IBoolean
187
+ zIndex?: INumber
188
+
189
+ mask?: IBoolean
190
+ maskType?: IMaskType
191
+ eraser?: IBoolean
165
192
 
166
193
  // layout data
167
- x?: __Number
168
- y?: __Number
169
- width?: __Number
170
- height?: __Number
171
- scaleX?: __Number
172
- scaleY?: __Number
173
- rotation?: __Number
174
- skewX?: __Number
175
- skewY?: __Number
176
-
177
- scale?: __Number | IPointData // helper
194
+ x?: INumber
195
+ y?: INumber
196
+ width?: INumber
197
+ height?: INumber
198
+ scaleX?: INumber
199
+ scaleY?: INumber
200
+ rotation?: INumber
201
+ skewX?: INumber
202
+ skewY?: INumber
203
+
204
+ scale?: INumber | IPointData // helper
178
205
  around?: IAround
206
+ lazy?: IBoolean
207
+
208
+ draggable?: IBoolean
179
209
 
180
- draggable?: __Boolean
210
+ editable?: IBoolean
211
+ editSize?: IEditSize
181
212
 
182
- hittable?: __Boolean
213
+ hittable?: IBoolean
183
214
  hitFill?: IHitType
184
215
  hitStroke?: IHitType
185
- hitChildren?: __Boolean
186
- hitSelf?: __Boolean
187
- hitRadius?: __Number
216
+ hitBox?: IBoolean
217
+ hitChildren?: IBoolean
218
+ hitSelf?: IBoolean
219
+ hitRadius?: INumber
188
220
 
189
221
  cursor?: ICursorType | ICursorType[]
190
222
 
191
223
  children?: ILeafInputData[]
224
+
225
+ // other
226
+ noBounds?: boolean
192
227
  }
193
228
  export interface ILeafComputedData {
194
229
  // layer data
@@ -199,10 +234,13 @@ export interface ILeafComputedData {
199
234
  blendMode?: IBlendMode
200
235
  opacity?: number
201
236
  visible?: boolean
202
- isMask?: boolean
203
- isEraser?: boolean
237
+ locked?: boolean
204
238
  zIndex?: number
205
239
 
240
+ mask?: boolean
241
+ maskType?: IMaskType
242
+ eraser?: boolean
243
+
206
244
  // layout data
207
245
  x?: number
208
246
  y?: number
@@ -215,12 +253,18 @@ export interface ILeafComputedData {
215
253
  skewY?: number
216
254
 
217
255
  around?: IAround
256
+ lazy?: boolean
257
+ windingRule?: any
218
258
 
219
259
  draggable?: boolean
220
260
 
261
+ editable?: boolean
262
+ editSize?: IEditSize
263
+
221
264
  hittable?: boolean
222
265
  hitFill?: IHitType
223
266
  hitStroke?: IHitType
267
+ hitBox?: boolean
224
268
  hitChildren?: boolean
225
269
  hitSelf?: boolean
226
270
  hitRadius?: number
@@ -232,9 +276,10 @@ export interface ILeafComputedData {
232
276
  __complex?: boolean // 外观是否复杂
233
277
  __naturalWidth?: number
234
278
  __naturalHeight?: number
279
+ readonly __blendMode: string
235
280
  }
236
281
 
237
- export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDataProxy, ILeafInputData, IEventer {
282
+ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDataProxy, ILeafInputData, IEventer {
238
283
  tag: string
239
284
  readonly __tag: string
240
285
  readonly innerName: string
@@ -242,7 +287,8 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
242
287
  readonly __DataProcessor: IObject // IDataProcessor
243
288
  readonly __LayoutProcessor: IObject // ILeafLayout
244
289
 
245
- leafer?: ILeafer
290
+ readonly app?: ILeaferBase
291
+ leafer?: ILeaferBase
246
292
  parent?: ILeaf
247
293
 
248
294
  readonly isApp?: boolean
@@ -251,32 +297,40 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
251
297
  isBranchLeaf?: boolean
252
298
 
253
299
  __: ILeafData
300
+
301
+ proxyData?: ILeafInputData
302
+ __proxyData?: ILeafInputData
303
+
254
304
  __layout: ILeafLayout
255
305
 
256
- __world: IMatrixWithLayoutData
257
- __local: IMatrixWithBoundsData
306
+ __world: IMatrixWithBoundsScaleData
307
+ __local?: IMatrixWithBoundsData
308
+
309
+ __nowWorld?: IMatrixWithBoundsScaleData // use __world or __cameraWorld render
310
+ __cameraWorld?: IMatrixWithBoundsScaleData // use camera matrix render
311
+
312
+ readonly __localMatrix: IMatrixData
313
+ readonly __localBoxBounds: IBoundsData
258
314
 
259
315
  __worldOpacity: number
260
316
 
261
- readonly worldTransform: IMatrixWithLayoutData
262
- readonly localTransform: IMatrixWithBoundsData
317
+ readonly worldTransform: IMatrixData
318
+ readonly localTransform: IMatrixData
263
319
 
264
320
  readonly boxBounds: IBoundsData
321
+ readonly renderBounds: IBoundsData
265
322
  readonly worldBoxBounds: IBoundsData
266
323
  readonly worldStrokeBounds: IBoundsData
267
324
  readonly worldRenderBounds: IBoundsData
268
325
 
269
326
  readonly worldOpacity: number
270
327
 
271
- __renderTime?: number // μs 1000微秒 = 1毫秒
272
-
273
328
  __level: number // 图层级别 root(1) -> hight
274
329
  __tempNumber?: number // 用于临时运算储存状态
275
330
 
276
- readonly resizeable: boolean
277
-
278
- readonly __hasMirror: boolean
331
+ readonly __worldFlipped: boolean
279
332
 
333
+ __hasAutoLayout?: boolean
280
334
  __hasMask?: boolean
281
335
  __hasEraser?: boolean
282
336
  __hitCanvas?: IHitCanvas
@@ -289,28 +343,43 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
289
343
 
290
344
  destroyed: boolean
291
345
 
346
+ reset(data?: ILeafInputData): void
347
+ resetCustom(): void
348
+
292
349
  waitParent(item: IFunction): void
293
350
  waitLeafer(item: IFunction): void
294
- nextRender(item: IFunction): void
351
+ nextRender(item: IFunction, off?: 'off'): void
295
352
 
296
- __bindLeafer(leafer: ILeafer | null): void
353
+ __bindLeafer(leafer: ILeaferBase | null): void
297
354
 
298
355
  set(data: IObject): void
356
+ get(): ILeafInputData
299
357
  toJSON(): IObject
300
358
  toString(): string
359
+ toSVG?(): string
360
+ toHTML?(): string
301
361
 
302
362
  // ILeafData ->
303
- __setAttr(attrName: string, newValue: __Value): void
304
- __getAttr(attrName: string): __Value
363
+ __setAttr(attrName: string, newValue: IValue): void
364
+ __getAttr(attrName: string): IValue
365
+ setProxyAttr(name: string, newValue: IValue): void
366
+ getProxyAttr(name: string): IValue
367
+
368
+ // find
369
+ find(condition: number | string | IFindMethod, options?: any): ILeaf[]
370
+ findOne(condition: number | string | IFindMethod, options?: any): ILeaf
305
371
 
306
372
  forceUpdate(attrName?: string): void
307
373
 
374
+ updateLayout(): void
375
+
308
376
  // ILeafMatrix ->
309
377
  __updateWorldMatrix(): void
310
378
  __updateLocalMatrix(): void
311
379
 
312
380
  // ILeafBounds ->
313
381
  __updateWorldBounds(): void
382
+ __updateLocalBounds(): void
314
383
 
315
384
  __updateLocalBoxBounds(): void
316
385
  __updateLocalStrokeBounds(): void
@@ -320,6 +389,7 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
320
389
  __updateStrokeBounds(): void
321
390
  __updateRenderBounds(): void
322
391
 
392
+ __updateAutoLayout(): void
323
393
  __updateNaturalSize(): void
324
394
 
325
395
  __updateStrokeSpread(): number
@@ -330,12 +400,14 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
330
400
  // IBranchMask ->
331
401
  __updateEraser(value?: boolean): void
332
402
  __updateMask(value?: boolean): void
333
- __renderMask(canvas: ILeaferCanvas, content: ILeaferCanvas, mask: ILeaferCanvas): void
334
- __removeMask(child?: ILeaf): void
403
+ __renderMask(canvas: ILeaferCanvas, options: IRenderOptions): void
335
404
 
336
405
  // convert
337
- getWorld(attrName: IMatrixDecompositionAttr): number
338
- getBounds(type: ILayoutBoundsType, locationType?: ILayoutLocationType): IBoundsData
406
+ __getNowWorld(options: IRenderOptions): IMatrixWithBoundsScaleData // when render use other matrix
407
+
408
+ getWorld(attrName: ILayoutAttr): number // will remove
409
+ getBounds(type?: IBoundsType, relative?: ILocationType | ILeaf): IBoundsData
410
+ getLayoutBounds(type?: IBoundsType, relative?: ILocationType | ILeaf, unscale?: boolean): ILayoutBoundsData
339
411
 
340
412
  worldToLocal(world: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void
341
413
  localToWorld(local: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void
@@ -348,15 +420,27 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
348
420
  getLocalPointByInner(inner: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData
349
421
  getWorldPoint(inner: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData
350
422
  getWorldPointByLocal(local: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData
423
+ getPagePoint(world: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData
424
+ getWorldPointByPage(page: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData
425
+
426
+
427
+ // transform
428
+ setTransform(transform?: IMatrixData, resize?: boolean): void
429
+ transform(transform?: IMatrixData, resize?: boolean): void
351
430
 
352
431
  move(x: number, y?: number): void
353
- scaleOf(origin: IPointData, x: number, y?: number): void
432
+ scaleOf(origin: IPointData, scaleX: number, scaleY?: number, resize?: boolean): void
354
433
  rotateOf(origin: IPointData, rotation: number): void
355
- skewOf(origin: IPointData, x: number, y: number): void
434
+ skewOf(origin: IPointData, skewX: number, skewY?: number, resize?: boolean): void
435
+
436
+ scaleResize(scaleX: number, scaleY: number, noResize?: boolean): void
437
+ __scaleResize(scaleX: number, scaleY: number): void
356
438
 
357
439
  // ILeafHit ->
358
440
  __hitWorld(point: IRadiusPointData): boolean
359
441
  __hit(local: IRadiusPointData): boolean
442
+ __hitFill(inner: IRadiusPointData, windingRule?: string): boolean
443
+ __hitStroke(inner: IRadiusPointData, strokeWidth: number): boolean
360
444
  __drawHitPath(canvas: ILeaferCanvas): void
361
445
  __updateHitCanvas(): void
362
446
 
@@ -365,6 +449,7 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
365
449
  __drawFast(canvas: ILeaferCanvas, options: IRenderOptions): void
366
450
  __draw(canvas: ILeaferCanvas, options: IRenderOptions): void
367
451
 
452
+ __clip(canvas: ILeaferCanvas, options: IRenderOptions): void
368
453
  __renderShape(canvas: ILeaferCanvas, options: IRenderOptions): void
369
454
 
370
455
  __updateWorldOpacity(): void
@@ -382,4 +467,5 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
382
467
  __updateSortChildren(): void
383
468
  add(child: ILeaf, index?: number): void
384
469
  remove(child?: ILeaf, destroy?: boolean): void
470
+ dropTo(parent: ILeaf, index?: number, resize?: boolean): void
385
471
  }
@@ -1,10 +1,7 @@
1
1
  import { IBranch } from './IBranch'
2
2
  import { ILeaf } from './ILeaf'
3
- import { ITransformEventData } from '../event/IEvent'
4
3
 
5
4
  export interface IZoomView extends IBranch {
6
5
  zoomLayer?: ILeaf
7
- moveLayer?: ILeaf
8
- transformData?: ITransformEventData
9
- setZoomLayer(zoomLayer: ILeaf, moveLayer?: ILeaf): void
6
+ setZoomLayer(zoomLayer: ILeaf): void
10
7
  }
@@ -1,7 +1,7 @@
1
- import { ILeaferCanvas } from '../../canvas/ILeaferCanvas'
2
- import { IRenderOptions } from '../../renderer/IRenderer'
3
1
  import { IBranch } from '../IBranch'
4
2
  import { ILeafRender } from './ILeafRender'
3
+ import { ILeaferCanvas } from '../../canvas/ILeaferCanvas'
4
+ import { IRenderOptions } from '../../renderer/IRenderer'
5
5
 
6
6
  export type IBranchRenderModule = IBranchRender & ThisType<IBranch>
7
7
 
@@ -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 { __Value } from '../../data/IData'
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: __Value): void
8
- __getAttr?(name: string): __Value
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,9 @@ export type ILeafHitModule = ILeafHit & ThisType<ILeaf>
6
6
 
7
7
  export interface ILeafHit {
8
8
  __hitWorld?(point: IRadiusPointData): boolean
9
- __hit?(local: IRadiusPointData): boolean
9
+ __hit?(inner: IRadiusPointData): boolean
10
+ __hitFill?(inner: IRadiusPointData, windingRule?: string): boolean
11
+ __hitStroke?(inner: IRadiusPointData, strokeWidth: number): boolean
10
12
  __drawHitPath?(canvas: ILeaferCanvas): void
11
13
  __updateHitCanvas?(): void
12
14
  }
@@ -9,6 +9,7 @@ export interface ILeafRender {
9
9
  __draw?(canvas: ILeaferCanvas, options: IRenderOptions): void
10
10
  __drawFast?(canvas: ILeaferCanvas, options: IRenderOptions): void
11
11
 
12
+ __clip?(_canvas: ILeaferCanvas, _options: IRenderOptions): void
12
13
  __renderShape?(canvas: ILeaferCanvas, options: IRenderOptions): void
13
14
 
14
15
  __updateWorldOpacity?(): void
@@ -3,8 +3,11 @@ import { IWatchEventData } from '../watcher/IWatcher'
3
3
  import { ILayoutBlockData } from '../layouter/ILayouter'
4
4
  import { ILeaf } from '../display/ILeaf'
5
5
  import { IScreenSizeData, IPointData } from '../math/IMath'
6
+ import { IObject } from '../data/IData'
6
7
 
7
8
  export interface IEvent {
9
+ origin?: IObject
10
+
8
11
  type?: string
9
12
  target?: IEventTarget
10
13
  current?: IEventTarget
@@ -75,29 +78,6 @@ export interface IWatchEvent extends IEvent {
75
78
  readonly data: IWatchEventData
76
79
  }
77
80
 
78
- export interface ITransformEventData {
79
- x: number
80
- y: number
81
- scaleX: number
82
- scaleY: number
83
- rotation: number
84
-
85
- readonly zooming: boolean
86
- readonly moving: boolean
87
- readonly rotating: boolean
88
- readonly changing: boolean
89
- }
90
-
91
- export interface ITransformEvent extends IEvent, ITransformEventData {
92
- readonly x: number
93
- readonly y: number
94
- readonly scaleX: number
95
- readonly scaleY: number
96
- readonly rotation: number
97
- }
98
- export type TransformMode = 'move' | 'zoom' | 'rotate'
99
-
100
-
101
81
  export interface IMultiTouchData {
102
82
  move: IPointData,
103
83
  scale: number,
@@ -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
  }
@@ -23,10 +23,9 @@ export interface IUIEvent extends IEvent {
23
23
  path?: ILeafList
24
24
  throughPath?: ILeafList // 穿透path,不受层级影响,从上到下只要碰撞到区域就算,一般点击的时候
25
25
 
26
- origin?: IObject
27
-
28
- getInner?(target?: ILeaf): IPointData
29
- getLocal?(target?: ILeaf): IPointData
26
+ getPage?(): IPointData
27
+ getInner?(relative?: ILeaf): IPointData
28
+ getLocal?(relative?: ILeaf): IPointData
30
29
  }
31
30
 
32
31
 
@@ -48,10 +47,13 @@ export interface IDragEvent extends IPointerEvent {
48
47
  totalX?: number
49
48
  totalY?: number
50
49
 
51
- getInnerMove?(target?: ILeaf): IPointData
52
- getLocalMove?(target?: ILeaf): IPointData
53
- getInnerTotal?(target?: ILeaf): IPointData
54
- getLocalTotal?(target?: ILeaf): IPointData
50
+ getPageMove?(total?: boolean): IPointData
51
+ getInnerMove?(relative?: ILeaf): IPointData
52
+ getLocalMove?(relative?: ILeaf): IPointData
53
+
54
+ getPageTotal?(): IPointData
55
+ getInnerTotal?(relative?: ILeaf): IPointData
56
+ getLocalTotal?(relative?: ILeaf): IPointData
55
57
  }
56
58
 
57
59
  export interface IDropEvent extends IPointerEvent {
@@ -0,0 +1,24 @@
1
+ import { IBlob, ILeaferCanvas } from '../canvas/ILeaferCanvas'
2
+ import { IBoundsData } from '../math/IMath'
3
+
4
+
5
+ export interface IExportOptions {
6
+ quality?: number
7
+ blob?: boolean
8
+ scale?: number
9
+ pixelRatio?: number
10
+ slice?: boolean
11
+ trim?: boolean
12
+ fill?: string
13
+ screenshot?: IBoundsData | boolean
14
+ }
15
+
16
+ export interface IExportResult {
17
+ data: ILeaferCanvas | IBlob | string | boolean
18
+ renderBounds?: IBoundsData
19
+ trimBounds?: IBoundsData
20
+ }
21
+
22
+ export interface IExportResultFunction {
23
+ (data: IExportResult): void
24
+ }
@@ -1,2 +1,2 @@
1
1
  export type IExportImageType = 'jpg' | 'png' | 'webp'
2
- export type IExportFileType = IExportImageType | 'svg' | 'pdf' | 'json'
2
+ export type IExportFileType = IExportImageType | 'svg' | 'pdf' | 'json'
@@ -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
  }