@leafer/interface 1.0.0-beta.9 → 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.
Files changed (41) hide show
  1. package/package.json +5 -2
  2. package/src/app/IApp.ts +3 -3
  3. package/src/app/ILeafer.ts +41 -17
  4. package/src/canvas/ICanvas.ts +2 -0
  5. package/src/canvas/IHitCanvasManager.ts +0 -1
  6. package/src/canvas/ILeaferCanvas.ts +13 -9
  7. package/src/canvas/ISkiaCanvas.ts +20 -1
  8. package/src/data/IData.ts +5 -7
  9. package/src/data/ILeafData.ts +12 -6
  10. package/src/data/IList.ts +9 -6
  11. package/src/display/IBranch.ts +4 -2
  12. package/src/display/ILeaf.ts +251 -73
  13. package/src/display/IView.ts +1 -4
  14. package/src/display/module/IBranchRender.ts +2 -2
  15. package/src/display/module/ILeafBounds.ts +4 -0
  16. package/src/display/module/ILeafDataProxy.ts +5 -3
  17. package/src/display/module/ILeafHit.ts +3 -1
  18. package/src/display/module/ILeafRender.ts +1 -0
  19. package/src/event/IEvent.ts +3 -23
  20. package/src/event/IEventer.ts +6 -1
  21. package/src/event/IUIEvent.ts +18 -11
  22. package/src/file/IExport.ts +24 -0
  23. package/src/file/IFileType.ts +1 -1
  24. package/src/function/IFunction.ts +9 -0
  25. package/src/image/IImageManager.ts +13 -2
  26. package/src/image/ILeaferImage.ts +32 -1
  27. package/src/index.ts +17 -16
  28. package/src/interaction/ICursor.ts +16 -0
  29. package/src/interaction/IInteraction.ts +35 -7
  30. package/src/layout/ILeafLayout.ts +33 -15
  31. package/src/layouter/ILayouter.ts +3 -0
  32. package/src/math/IMath.ts +70 -36
  33. package/src/path/IPathDrawer.ts +5 -0
  34. package/src/platform/IPlatform.ts +21 -4
  35. package/src/plugin/IPlugin.ts +2 -2
  36. package/src/renderer/IRenderer.ts +3 -2
  37. package/src/selector/ISelector.ts +26 -9
  38. package/src/task/ITaskProcessor.ts +19 -3
  39. package/src/watcher/IWatcher.ts +5 -1
  40. package/types/index.d.ts +1859 -0
  41. package/src/display/module/ILeafMask.ts +0 -12
@@ -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, IMatrixData, IRadiusPointData, IMatrixDecompositionAttr } 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,35 +27,49 @@ 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
- draggable: __Boolean
53
-
54
- 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
55
65
  hitFill: IHitType
56
66
  hitStroke: IHitType
57
- hitChildren: __Boolean
58
- hitSelf: __Boolean
67
+ hitBox: IBoolean
68
+ hitChildren: IBoolean
69
+ hitSelf: IBoolean
70
+ hitRadius: INumber
71
+
72
+ cursor: ICursorType | ICursorType[]
59
73
  }
60
74
 
61
75
  export type IHitType =
@@ -64,6 +78,11 @@ export type IHitType =
64
78
  | 'all'
65
79
  | 'none'
66
80
 
81
+ export type IMaskType =
82
+ | 'path'
83
+ | 'pixel'
84
+ | 'clipping'
85
+
67
86
  export type IBlendMode =
68
87
  | 'pass-through'
69
88
  | 'normal'
@@ -90,38 +109,121 @@ export type IBlendMode =
90
109
  | 'destination-in'
91
110
  | 'destination-out'
92
111
  | 'destination-atop'
112
+ | 'xor'
113
+
114
+ export type IEditSize = 'size' | 'scale'
115
+ export interface IImageCursor {
116
+ url: string
117
+ x?: number
118
+ y?: number
119
+ rotation?: number
120
+ }
121
+
122
+ export type IAround =
123
+ | 'topLeft'
124
+ | 'top'
125
+ | 'topRight'
126
+ | 'right'
127
+ | 'bottomRight'
128
+ | 'bottom'
129
+ | 'bottomLeft'
130
+ | 'left'
131
+ | 'center'
132
+ | IPointData
133
+
134
+ export type ICursorType =
135
+ | IImageCursor
136
+ | ''
137
+ | 'auto'
138
+ | 'default'
139
+ | 'none'
140
+ | 'context-menu'
141
+ | 'help'
142
+ | 'pointer'
143
+ | 'progress'
144
+ | 'wait'
145
+ | 'cell'
146
+ | 'crosshair'
147
+ | 'text'
148
+ | 'vertical-text'
149
+ | 'alias'
150
+ | 'copy'
151
+ | 'move'
152
+ | 'no-drop'
153
+ | 'not-allowed'
154
+ | 'grab'
155
+ | 'grabbing'
156
+ | 'e-resize'
157
+ | 'n-resize'
158
+ | 'ne-resize'
159
+ | 'nw-resize'
160
+ | 's-resize'
161
+ | 'se-resize'
162
+ | 'sw-resize'
163
+ | 'w-resize'
164
+ | 'ew-resize'
165
+ | 'ns-resize'
166
+ | 'nesw-resize'
167
+ | 'nwse-resize'
168
+ | 'col-resize'
169
+ | 'row-resize'
170
+ | 'all-scroll'
171
+ | 'zoom-in'
172
+ | 'zoom-out'
173
+
93
174
 
94
175
  export interface ILeafInputData {
176
+ tag?: string
177
+
95
178
  // layer data
96
- id?: __String
97
- name?: __String
98
- className?: __String
179
+ id?: IString
180
+ name?: IString
181
+ className?: IString
99
182
 
100
183
  blendMode?: IBlendMode
101
- opacity?: __Number
102
- visible?: __Boolean
103
- isMask?: __Boolean
104
- isEraser?: __Boolean
105
- zIndex?: __Number
184
+ opacity?: INumber
185
+ visible?: IBoolean
186
+ locked?: IBoolean
187
+ zIndex?: INumber
188
+
189
+ mask?: IBoolean
190
+ maskType?: IMaskType
191
+ eraser?: IBoolean
106
192
 
107
193
  // layout data
108
- x?: __Number
109
- y?: __Number
110
- width?: __Number
111
- height?: __Number
112
- scaleX?: __Number
113
- scaleY?: __Number
114
- rotation?: __Number
115
- skewX?: __Number
116
- skewY?: __Number
117
-
118
- draggable?: __Boolean
119
-
120
- hittable?: __Boolean
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
205
+ around?: IAround
206
+ lazy?: IBoolean
207
+
208
+ draggable?: IBoolean
209
+
210
+ editable?: IBoolean
211
+ editSize?: IEditSize
212
+
213
+ hittable?: IBoolean
121
214
  hitFill?: IHitType
122
215
  hitStroke?: IHitType
123
- hitChildren?: __Boolean
124
- hitSelf?: __Boolean
216
+ hitBox?: IBoolean
217
+ hitChildren?: IBoolean
218
+ hitSelf?: IBoolean
219
+ hitRadius?: INumber
220
+
221
+ cursor?: ICursorType | ICursorType[]
222
+
223
+ children?: ILeafInputData[]
224
+
225
+ // other
226
+ noBounds?: boolean
125
227
  }
126
228
  export interface ILeafComputedData {
127
229
  // layer data
@@ -132,10 +234,13 @@ export interface ILeafComputedData {
132
234
  blendMode?: IBlendMode
133
235
  opacity?: number
134
236
  visible?: boolean
135
- isMask?: boolean
136
- isEraser?: boolean
237
+ locked?: boolean
137
238
  zIndex?: number
138
239
 
240
+ mask?: boolean
241
+ maskType?: IMaskType
242
+ eraser?: boolean
243
+
139
244
  // layout data
140
245
  x?: number
141
246
  y?: number
@@ -147,22 +252,34 @@ export interface ILeafComputedData {
147
252
  skewX?: number
148
253
  skewY?: number
149
254
 
255
+ around?: IAround
256
+ lazy?: boolean
257
+ windingRule?: any
258
+
150
259
  draggable?: boolean
151
260
 
261
+ editable?: boolean
262
+ editSize?: IEditSize
263
+
152
264
  hittable?: boolean
153
265
  hitFill?: IHitType
154
266
  hitStroke?: IHitType
267
+ hitBox?: boolean
155
268
  hitChildren?: boolean
156
269
  hitSelf?: boolean
270
+ hitRadius?: number
271
+
272
+ cursor?: ICursorType | ICursorType[]
157
273
 
158
274
  // other
159
275
  __childBranchNumber?: number // 存在子分支的个数
160
276
  __complex?: boolean // 外观是否复杂
161
277
  __naturalWidth?: number
162
278
  __naturalHeight?: number
279
+ readonly __blendMode: string
163
280
  }
164
281
 
165
- export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDataProxy, ILeafInputData, IEventer {
282
+ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDataProxy, ILeafInputData, IEventer {
166
283
  tag: string
167
284
  readonly __tag: string
168
285
  readonly innerName: string
@@ -170,7 +287,8 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
170
287
  readonly __DataProcessor: IObject // IDataProcessor
171
288
  readonly __LayoutProcessor: IObject // ILeafLayout
172
289
 
173
- leafer?: ILeafer
290
+ readonly app?: ILeaferBase
291
+ leafer?: ILeaferBase
174
292
  parent?: ILeaf
175
293
 
176
294
  readonly isApp?: boolean
@@ -179,26 +297,40 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
179
297
  isBranchLeaf?: boolean
180
298
 
181
299
  __: ILeafData
300
+
301
+ proxyData?: ILeafInputData
302
+ __proxyData?: ILeafInputData
303
+
182
304
  __layout: ILeafLayout
183
305
 
184
- __local: IMatrixWithBoundsData
185
- __world: 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
314
+
186
315
  __worldOpacity: number
187
316
 
188
317
  readonly worldTransform: IMatrixData
189
318
  readonly localTransform: IMatrixData
190
319
 
320
+ readonly boxBounds: IBoundsData
321
+ readonly renderBounds: IBoundsData
191
322
  readonly worldBoxBounds: IBoundsData
192
323
  readonly worldStrokeBounds: IBoundsData
193
324
  readonly worldRenderBounds: IBoundsData
194
325
 
195
326
  readonly worldOpacity: number
196
327
 
197
- __renderTime?: number // μs 1000微秒 = 1毫秒
198
-
199
328
  __level: number // 图层级别 root(1) -> hight
200
329
  __tempNumber?: number // 用于临时运算储存状态
201
330
 
331
+ readonly __worldFlipped: boolean
332
+
333
+ __hasAutoLayout?: boolean
202
334
  __hasMask?: boolean
203
335
  __hasEraser?: boolean
204
336
  __hitCanvas?: IHitCanvas
@@ -209,26 +341,45 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
209
341
  __parentWait?: IFunction[]
210
342
  __leaferWait?: IFunction[]
211
343
 
344
+ destroyed: boolean
345
+
346
+ reset(data?: ILeafInputData): void
347
+ resetCustom(): void
348
+
212
349
  waitParent(item: IFunction): void
213
350
  waitLeafer(item: IFunction): void
351
+ nextRender(item: IFunction, off?: 'off'): void
214
352
 
215
- __bindLeafer(leafer: ILeafer | null): void
353
+ __bindLeafer(leafer: ILeaferBase | null): void
216
354
 
217
355
  set(data: IObject): void
218
- get(attrNames?: string[]): IObject
356
+ get(): ILeafInputData
357
+ toJSON(): IObject
358
+ toString(): string
359
+ toSVG?(): string
360
+ toHTML?(): string
219
361
 
220
362
  // ILeafData ->
221
- __setAttr(attrName: string, newValue: __Value): void
222
- __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
223
371
 
224
372
  forceUpdate(attrName?: string): void
225
373
 
374
+ updateLayout(): void
375
+
226
376
  // ILeafMatrix ->
227
377
  __updateWorldMatrix(): void
228
378
  __updateLocalMatrix(): void
229
379
 
230
380
  // ILeafBounds ->
231
381
  __updateWorldBounds(): void
382
+ __updateLocalBounds(): void
232
383
 
233
384
  __updateLocalBoxBounds(): void
234
385
  __updateLocalStrokeBounds(): void
@@ -238,6 +389,9 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
238
389
  __updateStrokeBounds(): void
239
390
  __updateRenderBounds(): void
240
391
 
392
+ __updateAutoLayout(): void
393
+ __updateNaturalSize(): void
394
+
241
395
  __updateStrokeSpread(): number
242
396
  __updateRenderSpread(): number
243
397
 
@@ -246,25 +400,47 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
246
400
  // IBranchMask ->
247
401
  __updateEraser(value?: boolean): void
248
402
  __updateMask(value?: boolean): void
249
- __renderMask(canvas: ILeaferCanvas, content: ILeaferCanvas, mask: ILeaferCanvas): void
250
- __removeMask(child?: ILeaf): void
403
+ __renderMask(canvas: ILeaferCanvas, options: IRenderOptions): void
251
404
 
252
405
  // convert
253
- getWorld(attrName: IMatrixDecompositionAttr): number
254
- getBounds(type: ILayoutBoundsType, locationType?: ILayoutLocationType): IBoundsData
406
+ __getNowWorld(options: IRenderOptions): IMatrixWithBoundsScaleData // when render use other matrix
255
407
 
256
- worldToLocal(world: IPointData, to?: IPointData, isMovePoint?: boolean): void
257
- localToWorld(local: IPointData, to?: IPointData, isMovePoint?: boolean): void
258
- worldToInner(world: IPointData, to?: IPointData, isMovePoint?: boolean): void
259
- innerToWorld(inner: IPointData, to?: IPointData, isMovePoint?: boolean): void
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
411
+
412
+ worldToLocal(world: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void
413
+ localToWorld(local: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void
414
+ worldToInner(world: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void
415
+ innerToWorld(inner: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void
416
+
417
+ getInnerPoint(world: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData
418
+ getInnerPointByLocal(local: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData
419
+ getLocalPoint(world: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData
420
+ getLocalPointByInner(inner: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData
421
+ getWorldPoint(inner: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData
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
260
430
 
261
431
  move(x: number, y?: number): void
262
- scaleOf(origin: IPointData, x: number, y?: number): void
432
+ scaleOf(origin: IPointData, scaleX: number, scaleY?: number, resize?: boolean): void
263
433
  rotateOf(origin: IPointData, rotation: 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
264
438
 
265
439
  // ILeafHit ->
266
440
  __hitWorld(point: IRadiusPointData): boolean
267
441
  __hit(local: IRadiusPointData): boolean
442
+ __hitFill(inner: IRadiusPointData, windingRule?: string): boolean
443
+ __hitStroke(inner: IRadiusPointData, strokeWidth: number): boolean
268
444
  __drawHitPath(canvas: ILeaferCanvas): void
269
445
  __updateHitCanvas(): void
270
446
 
@@ -273,6 +449,7 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
273
449
  __drawFast(canvas: ILeaferCanvas, options: IRenderOptions): void
274
450
  __draw(canvas: ILeaferCanvas, options: IRenderOptions): void
275
451
 
452
+ __clip(canvas: ILeaferCanvas, options: IRenderOptions): void
276
453
  __renderShape(canvas: ILeaferCanvas, options: IRenderOptions): void
277
454
 
278
455
  __updateWorldOpacity(): void
@@ -289,5 +466,6 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
289
466
 
290
467
  __updateSortChildren(): void
291
468
  add(child: ILeaf, index?: number): void
292
- remove(child?: ILeaf): void
469
+ remove(child?: ILeaf, destroy?: boolean): void
470
+ dropTo(parent: ILeaf, index?: number, resize?: boolean): void
293
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,9 @@ export interface ILeafBounds {
13
14
  __updateStrokeBounds?(): void
14
15
  __updateRenderBounds?(): void
15
16
 
17
+ __updateAutoLayout?(): void
18
+ __updateNaturalSize?(): void
19
+
16
20
  __updateStrokeSpread?(): number
17
21
  __updateRenderSpread?(): number
18
22
 
@@ -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
 
@@ -45,11 +44,16 @@ export type PointerType = 'mouse' | 'pen' | 'touch'
45
44
  export interface IDragEvent extends IPointerEvent {
46
45
  moveX: number
47
46
  moveY: number
48
- totalX: number
49
- totalY: number
47
+ totalX?: number
48
+ totalY?: number
49
+
50
+ getPageMove?(total?: boolean): IPointData
51
+ getInnerMove?(relative?: ILeaf): IPointData
52
+ getLocalMove?(relative?: ILeaf): IPointData
50
53
 
51
- getInnerMove?(target?: ILeaf): IPointData
52
- getLocalMove?(target?: ILeaf): IPointData
54
+ getPageTotal?(): IPointData
55
+ getInnerTotal?(relative?: ILeaf): IPointData
56
+ getLocalTotal?(relative?: ILeaf): IPointData
53
57
  }
54
58
 
55
59
  export interface IDropEvent extends IPointerEvent {
@@ -74,10 +78,13 @@ export interface ISwipeEvent extends IDragEvent {
74
78
  }
75
79
 
76
80
  export interface IKeyEvent extends IUIEvent {
77
-
81
+ code?: string
82
+ key?: string
78
83
  }
79
84
 
80
85
  export interface IImageEvent extends IEvent {
81
- image: ILeaferImage
82
- error: string | IObject
86
+ image?: ILeaferImage
87
+ attrName?: string
88
+ attrValue?: IObject
89
+ error?: string | IObject
83
90
  }