@leafer/interface 1.0.0-alpha.7 → 1.0.0-bate

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.
@@ -5,15 +5,16 @@ import { ILeaferCanvas, IHitCanvas } from '../canvas/ILeaferCanvas'
5
5
  import { IRenderOptions } from '../renderer/IRenderer'
6
6
 
7
7
  import { IObject, __Number, __Boolean, __Value, __String } from '../data/IData'
8
- import { IMatrixWithBoundsData, IMatrix, IBoundsData, IRadiusPointData } from '../math/IMath'
8
+ import { IMatrixWithBoundsData, IMatrix, IPointData, IBoundsData, IMatrixData, IRadiusPointData, IMatrixDecompositionAttr } 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 } from '../layout/ILeafLayout'
14
+ import { ILeafLayout, ILayoutBoundsType, ILayoutLocationType } from '../layout/ILeafLayout'
15
15
  import { ILeafHit } from './module/ILeafHit'
16
16
  import { ILeafRender } from './module/ILeafRender'
17
+ import { ILeafMask } from './module/ILeafMask'
17
18
  import { ILeafData } from '../data/ILeafData'
18
19
 
19
20
 
@@ -23,14 +24,17 @@ export interface ICachedLeaf {
23
24
  bounds: IBoundsData
24
25
  }
25
26
 
27
+
26
28
  export interface ILeafAttrData {
27
29
  // layer data
28
30
  id: __String
29
31
  name: __String
30
32
  className: __String
31
33
 
34
+ blendMode: IBlendMode
32
35
  opacity: __Number
33
36
  visible: __Boolean
37
+ isMask: __Boolean
34
38
  zIndex: __Number
35
39
 
36
40
  // layout data
@@ -45,16 +49,57 @@ export interface ILeafAttrData {
45
49
  skewY: __Number
46
50
 
47
51
  draggable: __Boolean
52
+
53
+ hittable: __Boolean
54
+ hitFill: IHitType
55
+ hitStroke: IHitType
56
+ hitChildren: __Boolean
57
+ hitSelf: __Boolean
48
58
  }
49
59
 
60
+ export type IHitType =
61
+ | 'path'
62
+ | 'pixel'
63
+ | 'all'
64
+ | 'none'
65
+
66
+ export type IBlendMode =
67
+ | 'pass-through'
68
+ | 'normal'
69
+ | 'multiply'
70
+ | 'screen'
71
+ | 'overlay'
72
+ | 'darken'
73
+ | 'lighten'
74
+ | 'color-dodge'
75
+ | 'color-burn'
76
+ | 'hard-light'
77
+ | 'soft-light'
78
+ | 'difference'
79
+ | 'exclusion'
80
+ | 'hue'
81
+ | 'saturation'
82
+ | 'color'
83
+ | 'luminosity'
84
+ | 'source-over' // other
85
+ | 'source-in'
86
+ | 'source-out'
87
+ | 'source-atop'
88
+ | 'destination-over'
89
+ | 'destination-in'
90
+ | 'destination-out'
91
+ | 'destination-atop'
92
+
50
93
  export interface ILeafInputData {
51
94
  // layer data
52
95
  id?: __String
53
96
  name?: __String
54
97
  className?: __String
55
98
 
99
+ blendMode?: IBlendMode
56
100
  opacity?: __Number
57
101
  visible?: __Boolean
102
+ isMask?: __Boolean
58
103
  zIndex?: __Number
59
104
 
60
105
  // layout data
@@ -69,6 +114,12 @@ export interface ILeafInputData {
69
114
  skewY?: __Number
70
115
 
71
116
  draggable?: __Boolean
117
+
118
+ hittable?: __Boolean
119
+ hitFill?: IHitType
120
+ hitStroke?: IHitType
121
+ hitChildren?: __Boolean
122
+ hitSelf?: __Boolean
72
123
  }
73
124
  export interface ILeafComputedData {
74
125
  // layer data
@@ -76,8 +127,10 @@ export interface ILeafComputedData {
76
127
  name?: string
77
128
  className?: string
78
129
 
130
+ blendMode?: IBlendMode
79
131
  opacity?: number
80
132
  visible?: boolean
133
+ isMask?: boolean
81
134
  zIndex?: number
82
135
 
83
136
  // layout data
@@ -92,77 +145,116 @@ export interface ILeafComputedData {
92
145
  skewY?: number
93
146
 
94
147
  draggable?: boolean
148
+
149
+ hittable?: boolean
150
+ hitFill?: IHitType
151
+ hitStroke?: IHitType
152
+ hitChildren?: boolean
153
+ hitSelf?: boolean
154
+
155
+ // other
156
+ __childBranchNumber?: number // 存在子分支的个数
157
+ __complex?: boolean // 外观是否复杂
95
158
  }
96
159
 
97
- export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDataProxy, ILeafInputData, IEventer {
98
- readonly tag: string
160
+ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDataProxy, ILeafInputData, IEventer {
161
+ tag: string
162
+ readonly __tag: string
163
+ readonly innerName: string
164
+
99
165
  readonly __DataProcessor: IObject // IDataProcessor
100
166
  readonly __LayoutProcessor: IObject // ILeafLayout
101
167
 
102
168
  leafer?: ILeafer
103
- root?: ILeaf
104
169
  parent?: ILeaf
105
170
 
106
- __interactionOff?: boolean
107
- __childrenInteractionOff?: boolean
108
-
109
- __isRoot?: boolean
110
- __isBranch?: boolean
111
- __isBranchLeaf?: boolean
171
+ readonly isApp?: boolean
172
+ isLeafer?: boolean
173
+ isBranch?: boolean
174
+ isBranchLeaf?: boolean
112
175
 
113
176
  __: ILeafData
114
177
  __layout: ILeafLayout
115
178
 
116
- __relative: IMatrixWithBoundsData
179
+ __local: IMatrixWithBoundsData
117
180
  __world: IMatrixWithBoundsData
118
-
119
181
  __worldOpacity: number
120
- __renderTime: number // μs 1000微秒 = 1毫秒
121
- __complex: boolean // 外观是否复杂, 将调用__drawComplex()
182
+
183
+ readonly worldTransform: IMatrixData
184
+ readonly localTransform: IMatrixData
185
+
186
+ readonly worldBoxBounds: IBoundsData
187
+ readonly worldStrokeBounds: IBoundsData
188
+ readonly worldRenderBounds: IBoundsData
189
+
190
+ readonly worldOpacity: number
191
+
192
+ __renderTime?: number // μs 1000微秒 = 1毫秒
122
193
 
123
194
  __level: number // 图层级别 root(1) -> hight
124
195
  __tempNumber?: number // 用于临时运算储存状态
125
196
 
197
+ __hasMask?: boolean
126
198
  __hitCanvas?: IHitCanvas
127
199
 
200
+ readonly __onlyHitMask: boolean
201
+ readonly __ignoreHitWorld: boolean
202
+
128
203
  __parentWait?: IFunction[]
204
+ __leaferWait?: IFunction[]
129
205
 
130
- __addParentWait(item: IFunction): void
131
- __runParentWait(): void
206
+ waitParent(item: IFunction): void
207
+ waitLeafer(item: IFunction): void
132
208
 
133
- __setAsLeafer(): void
134
- __setAsRoot(): void
209
+ __bindLeafer(leafer: ILeafer | null): void
135
210
 
136
- __bindRoot(root: ILeaf): void
211
+ set(data: IObject): void
212
+ get(attrNames?: string[]): IObject
137
213
 
138
214
  // ILeafData ->
139
- __set(attrName: string, newValue: __Value): void
140
- __get(attrName: string): __Value
141
- __updateAttr(attrName: string): void
215
+ __setAttr(attrName: string, newValue: __Value): void
216
+ __getAttr(attrName: string): __Value
217
+
218
+ forceUpdate(attrName?: string): void
142
219
 
143
220
  // ILeafMatrix ->
144
221
  __updateWorldMatrix(): void
145
- __updateRelativeMatrix(): void
222
+ __updateLocalMatrix(): void
146
223
 
147
224
  // ILeafBounds ->
148
225
  __updateWorldBounds(): void
149
226
 
150
- __updateRelativeBoxBounds(): void
151
- __updateRelativeEventBounds(): void
152
- __updateRelativeRenderBounds(): void
227
+ __updateLocalBoxBounds(): void
228
+ __updateLocalStrokeBounds(): void
229
+ __updateLocalRenderBounds(): void
153
230
 
154
231
  __updateBoxBounds(): void
155
- __updateEventBounds(): void
232
+ __updateStrokeBounds(): void
156
233
  __updateRenderBounds(): void
157
234
 
158
- __updateEventBoundsSpreadWidth(): number
159
- __updateRenderBoundsSpreadWidth(): number
235
+ __updateStrokeSpread(): number
236
+ __updateRenderSpread(): number
160
237
 
161
238
  __onUpdateSize(): void
162
239
 
240
+ // IBranchMask ->
241
+ __updateMask(value?: boolean): void
242
+ __renderMask(canvas: ILeaferCanvas, content: ILeaferCanvas, mask: ILeaferCanvas): void
243
+ __removeMask(child?: ILeaf): void
244
+
245
+ // convert
246
+ getWorld(attrName: IMatrixDecompositionAttr): number
247
+ getBounds(type: ILayoutBoundsType, locationType?: ILayoutLocationType): IBoundsData
248
+
249
+ worldToLocal(world: IPointData, to?: IPointData, isMovePoint?: boolean): void
250
+ localToWorld(local: IPointData, to?: IPointData, isMovePoint?: boolean): void
251
+ worldToInner(world: IPointData, to?: IPointData, isMovePoint?: boolean): void
252
+ innerToWorld(inner: IPointData, to?: IPointData, isMovePoint?: boolean): void
253
+
163
254
  // ILeafHit ->
164
255
  __hitWorld(point: IRadiusPointData): boolean
165
256
  __hit(local: IRadiusPointData): boolean
257
+ __drawHitPath(canvas: ILeaferCanvas): void
166
258
  __updateHitCanvas(): void
167
259
 
168
260
  // ILeafRender ->
@@ -170,6 +262,8 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
170
262
  __drawFast(canvas: ILeaferCanvas, options: IRenderOptions): void
171
263
  __draw(canvas: ILeaferCanvas, options: IRenderOptions): void
172
264
 
265
+ __renderShape(canvas: ILeaferCanvas, options: IRenderOptions): void
266
+
173
267
  __updateWorldOpacity(): void
174
268
  __updateChange(): void
175
269
 
@@ -181,11 +275,8 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
181
275
 
182
276
  // branch
183
277
  children?: ILeaf[]
184
- __childBranchNumber?: number // 存在子分支的个数
185
278
 
186
279
  __updateSortChildren(): void
187
280
  add(child: ILeaf, index?: number): void
188
281
  remove(child?: ILeaf): void
189
- }
190
-
191
-
282
+ }
@@ -6,4 +6,5 @@ export interface IZoomView extends IBranch {
6
6
  zoomLayer?: ILeaf
7
7
  moveLayer?: ILeaf
8
8
  transformData?: ITransformEventData
9
+ setZoomLayer(zoomLayer: ILeaf, moveLayer?: ILeaf): void
9
10
  }
@@ -5,16 +5,16 @@ export type ILeafBoundsModule = ILeafBounds & ThisType<ILeaf>
5
5
  export interface ILeafBounds {
6
6
  __updateWorldBounds?(): void
7
7
 
8
- __updateRelativeBoxBounds?(): void
9
- __updateRelativeEventBounds?(): void
10
- __updateRelativeRenderBounds?(): void
8
+ __updateLocalBoxBounds?(): void
9
+ __updateLocalStrokeBounds?(): void
10
+ __updateLocalRenderBounds?(): void
11
11
 
12
12
  __updateBoxBounds?(): void
13
- __updateEventBounds?(): void
13
+ __updateStrokeBounds?(): void
14
14
  __updateRenderBounds?(): void
15
15
 
16
- __updateEventBoundsSpreadWidth?(): number
17
- __updateRenderBoundsSpreadWidth?(): number
16
+ __updateStrokeSpread?(): number
17
+ __updateRenderSpread?(): number
18
18
 
19
19
  __onUpdateSize?(): void
20
20
  }
@@ -4,8 +4,7 @@ import { __Value } from '../../data/IData'
4
4
  export type ILeafDataProxyModule = ILeafDataProxy & ThisType<ILeaf>
5
5
 
6
6
  export interface ILeafDataProxy {
7
- __set?(attrName: string, newValue: __Value): void
8
- __get?(attrName: string): __Value
9
- __updateAttr?(attrName: string): void
7
+ __setAttr?(name: string, newValue: __Value): void
8
+ __getAttr?(name: string): __Value
10
9
  }
11
10
 
@@ -9,8 +9,8 @@ export type ILeafEventerModule = ILeafEventer & ThisType<ILeaf>
9
9
  export interface ILeafEventer {
10
10
  on?(type: string | string[], listener: IEventListener, options?: IEventListenerOptions | boolean): void
11
11
  off?(type: string | string[], listener: IEventListener, options?: IEventListenerOptions | boolean): void
12
- on__?(type: string | string[], listener: IEventListener, bind?: IObject, options?: IEventListenerOptions | boolean): IEventListenerId
13
- off__?(id: IEventListenerId | IEventListenerId[]): void
12
+ on_?(type: string | string[], listener: IEventListener, bind?: IObject, options?: IEventListenerOptions | boolean): IEventListenerId
13
+ off_?(id: IEventListenerId | IEventListenerId[]): void
14
14
  once?(type: string | string[], listener: IEventListener, capture?: boolean): void
15
15
  emit?(type: string, event?: IEvent | IObject, capture?: boolean): void
16
16
  emitEvent?(event?: IEvent, capture?: boolean): void
@@ -1,10 +1,12 @@
1
1
  import { IRadiusPointData } from '../../math/IMath'
2
2
  import { ILeaf } from '../ILeaf'
3
+ import { ILeaferCanvas } from '../../canvas/ILeaferCanvas'
3
4
 
4
5
  export type ILeafHitModule = ILeafHit & ThisType<ILeaf>
5
6
 
6
7
  export interface ILeafHit {
7
8
  __hitWorld?(point: IRadiusPointData): boolean
8
9
  __hit?(local: IRadiusPointData): boolean
10
+ __drawHitPath?(canvas: ILeaferCanvas): void
9
11
  __updateHitCanvas?(): void
10
12
  }
@@ -0,0 +1,11 @@
1
+ import { ILeaf } from '../ILeaf'
2
+ import { ILeaferCanvas } from '../../canvas/ILeaferCanvas'
3
+
4
+ export type ILeafMaskModule = ILeafMask & ThisType<ILeaf>
5
+
6
+ export interface ILeafMask {
7
+ __updateMask?(value?: boolean): void
8
+ __renderMask?(canvas: ILeaferCanvas, content: ILeaferCanvas, mask: ILeaferCanvas): void
9
+ __removeMask?(child?: ILeaf): void
10
+ }
11
+
@@ -4,5 +4,5 @@ export type ILeafMatrixModule = ILeafMatrix & ThisType<ILeaf>
4
4
 
5
5
  export interface ILeafMatrix {
6
6
  __updateWorldMatrix?(): void
7
- __updateRelativeMatrix?(): void
7
+ __updateLocalMatrix?(): void
8
8
  }
@@ -6,11 +6,10 @@ export type ILeafRenderModule = ILeafRender & ThisType<ILeaf>
6
6
 
7
7
  export interface ILeafRender {
8
8
  __render?(canvas: ILeaferCanvas, options: IRenderOptions): void
9
- __drawFast?(canvas: ILeaferCanvas, options: IRenderOptions): void
10
9
  __draw?(canvas: ILeaferCanvas, options: IRenderOptions): void
10
+ __drawFast?(canvas: ILeaferCanvas, options: IRenderOptions): void
11
11
 
12
- __drawBefore?(canvas: ILeaferCanvas, options: IRenderOptions): void
13
- __drawAfter?(canvas: ILeaferCanvas, options: IRenderOptions): void
12
+ __renderShape?(canvas: ILeaferCanvas, options: IRenderOptions): void
14
13
 
15
14
  __updateWorldOpacity?(): void
16
15
  __updateChange?(): void
@@ -24,6 +24,10 @@ export interface IEventTarget extends IEventer {
24
24
 
25
25
  }
26
26
 
27
+ export interface ILeaferEvent {
28
+
29
+ }
30
+
27
31
  export interface IRenderEvent {
28
32
 
29
33
  }
@@ -52,7 +56,7 @@ export interface IUpdateEvent extends IEvent {
52
56
 
53
57
  }
54
58
 
55
- export interface IAttrEvent extends IEvent {
59
+ export interface IPropertyEvent extends IEvent {
56
60
  readonly attrName: string
57
61
  readonly oldValue: unknown
58
62
  readonly newValue: unknown
@@ -60,6 +64,7 @@ export interface IAttrEvent extends IEvent {
60
64
 
61
65
  export interface ILayoutEvent extends IEvent {
62
66
  readonly data: ILayoutBlockData[]
67
+ readonly times: number
63
68
  }
64
69
 
65
70
  export interface IWatchEvent extends IEvent {
@@ -32,8 +32,8 @@ export interface IEventer extends ILeafEventer {
32
32
 
33
33
  on(type: string | string[], listener: IEventListener, options?: IEventListenerOptions | boolean): void
34
34
  off(type: string | string[], listener: IEventListener, options?: IEventListenerOptions | boolean): void
35
- on__(type: string | string[], listener: IEventListener, bind?: IObject, options?: IEventListenerOptions | boolean): IEventListenerId
36
- off__(id: IEventListenerId | IEventListenerId[]): void
35
+ on_(type: string | string[], listener: IEventListener, bind?: IObject, options?: IEventListenerOptions | boolean): IEventListenerId
36
+ off_(id: IEventListenerId | IEventListenerId[]): void
37
37
  once(type: string | string[], listener: IEventListener): void
38
38
  emit(type: string, event?: IEvent | IObject, capture?: boolean): void
39
39
  emitEvent(event?: IEvent, capture?: boolean): void
@@ -1,5 +1,7 @@
1
+ import { IObject } from '../data/IData'
1
2
  import { ILeafList } from '../data/IList'
2
3
  import { IEvent } from './IEvent'
4
+ import { ILeaferImage } from '../image/ILeaferImage'
3
5
 
4
6
  export interface IUIEvent extends IEvent {
5
7
  x: number
@@ -19,6 +21,8 @@ export interface IUIEvent extends IEvent {
19
21
  path: ILeafList
20
22
  throughPath?: ILeafList // 穿透path,不受层级影响,从上到下只要碰撞到区域就算,一般点击的时候
21
23
 
24
+ origin: IObject
25
+
22
26
  stopDefault(): void
23
27
  stopNow(): void
24
28
  stop(): void
@@ -46,6 +50,7 @@ export interface IDragEvent extends IPointerEvent {
46
50
 
47
51
  export interface IDropEvent extends IPointerEvent {
48
52
  list: ILeafList
53
+ data?: IObject
49
54
  }
50
55
 
51
56
  export interface IRotateEvent extends IUIEvent {
@@ -66,4 +71,9 @@ export interface ISwipeEvent extends IDragEvent {
66
71
 
67
72
  export interface IKeyEvent extends IUIEvent {
68
73
 
74
+ }
75
+
76
+ export interface IImageEvent extends IEvent {
77
+ image: ILeaferImage
78
+ error: string | IObject
69
79
  }
@@ -1,3 +1,7 @@
1
+ import { ILeaferImage, ILeaferImageConfig } from './ILeaferImage'
2
+
3
+
1
4
  export interface IImageManager {
5
+ get(config: ILeaferImageConfig): ILeaferImage
2
6
  destory(): void
3
7
  }
@@ -1,8 +1,25 @@
1
+ import { IObject } from '../data/IData'
2
+
1
3
  export interface ILeaferImageConfig {
2
4
  url: string
3
5
  thumb?: string
4
6
  }
5
7
 
8
+ export interface ILeaferImageOnLoaded {
9
+ (image?: ILeaferImage): any
10
+ }
11
+
12
+ export interface ILeaferImageOnError {
13
+ (error?: string | IObject, image?: ILeaferImage): any
14
+ }
15
+
6
16
  export interface ILeaferImage {
17
+ view: unknown
18
+ width: number
19
+ height: number
20
+ ready: boolean
21
+ load(onSuccess?: ILeaferImageOnLoaded, onError?: ILeaferImageOnError): void
22
+ getCanvas(width: number, height: number, opacity?: number, _filters?: IObject): unknown
23
+ }
7
24
 
8
- }
25
+ export type IImageStatus = 'wait' | 'thumb-loading' | 'thumb-success' | 'thumb-error' | 'loading' | 'success' | 'error'
package/src/index.ts CHANGED
@@ -1,6 +1,6 @@
1
- export { ISupperLeafer } from './app/ISupperLeafer'
2
- export { ILeafer, ILeaferConfig, ICreator, IUICreator } from './app/ILeafer'
3
- export { ILeaf, ILeafAttrData, ILeafComputedData, ILeafInputData, ICachedLeaf } from './display/ILeaf'
1
+ export { IApp } from './app/IApp'
2
+ export { ILeafer, ILeaferType, ILeaferTypeFunction, ILeaferTypeList, ILeaferConfig, ICreator, IUICreator } from './app/ILeafer'
3
+ export { ILeaf, ILeafAttrData, ILeafComputedData, ILeafInputData, ICachedLeaf, IHitType, IBlendMode } from './display/ILeaf'
4
4
  export { IBranch } from './display/IBranch'
5
5
  export { IZoomView } from './display/IView'
6
6
 
@@ -14,35 +14,37 @@ export { ILeafBounds, ILeafBoundsModule } from './display/module/ILeafBounds'
14
14
  export { ILeafHit, ILeafHitModule } from './display/module/ILeafHit'
15
15
  export { ILeafRender, ILeafRenderModule } from './display/module/ILeafRender'
16
16
  export { ILeafEventer, ILeafEventerModule } from './display/module/ILeafEventer'
17
+ export { ILeafMask, ILeafMaskModule } from './display/module/ILeafMask'
17
18
 
18
19
  export { IRenderer, IRendererConfig, IRenderOptions } from './renderer/IRenderer'
19
20
  export { IWatcher, IWatchEventData, IWatcherConfig } from './watcher/IWatcher'
20
21
  export { ILayouter, ILayoutChangedData, ILayoutBlockData, ILayouterConfig, IPartLayoutConfig } from './layouter/ILayouter'
21
- export { ISelector, ISelectPathResult, ISelectPathOptions } from './selector/ISelector'
22
+ export { ISelector, ISelectorConfig, ISelectPathResult, ISelectPathOptions } from './selector/ISelector'
22
23
 
23
24
  export { ICanvasManager } from './canvas/ICanvasManager'
24
25
  export { IHitCanvasManager } from './canvas/IHitCanvasManager'
25
26
  export { IImageManager } from './image/IImageManager'
26
27
 
27
28
 
29
+ export { IControl } from './control/IControl'
28
30
  export { IPlatform } from './platform/IPlatform'
29
31
  export { IPlugin } from './plugin/IPlugin'
30
32
 
31
33
 
32
- export { ILeaferCanvas, IHitCanvas, ICanvasAttr, ICanvasStrokeOptions, ILeaferCanvasContext, ILeaferCanvasConfig, IHitCanvasConfig } from './canvas/ILeaferCanvas'
33
- export { ICanvasDrawPath } from './canvas/ICanvasPathDrawer'
34
- export { ICanvasFillRule as ICanvasFillRule, ICanvasRenderingContext2D, ITextMetrics, IPath2D } from './canvas/ICanvas'
34
+ export { ILeaferCanvas, IHitCanvas, ICanvasAttr, ICanvasStrokeOptions, ILeaferCanvasConfig, IHitCanvasConfig } from './canvas/ILeaferCanvas'
35
+ export { IPathDrawer, IPathCreator } from './path/IPathDrawer'
36
+ export { IWindingRule, ICanvasContext2D, ITextMetrics, IPath2D } from './canvas/ICanvas'
35
37
  export { CanvasPathCommand, IPathCommandData, MCommandData, HCommandData, VCommandData, LCommandData, CCommandData, SCommandData, QCommandData, TCommandData, ZCommandData, ACommandData, RectCommandData, RoundRectCommandData, EllipseCommandData, ArcCommandData, ArcToCommandData } from './path/IPathCommand'
36
38
 
37
- export { ILeaferImage, ILeaferImageConfig } from './image/ILeaferImage'
39
+ export { ILeaferImage, ILeaferImageConfig, ILeaferImageOnLoaded, ILeaferImageOnError } from './image/ILeaferImage'
38
40
 
39
41
  export { InnerId, IEventer, IEventListener, IEventListenerOptions, IEventListenerMap, IEventListenerItem, IEventListenerId } from './event/IEventer'
40
- export { IEventTarget, IEvent, IAttrEvent, ILayoutEvent, IRenderEvent, IChildEvent, IResizeEvent, IResizeEventListener, IUpdateEvent, IWatchEvent, ITransformEvent, ITransformEventData, TransformMode } from './event/IEvent'
41
- export { IUIEvent, IPointerEvent, PointerType, IDragEvent, IDropEvent, ISwipeEvent, IMoveEvent, IZoomEvent, IRotateEvent, IKeyEvent } from './event/IUIEvent'
42
- export { IInteraction, IInteractionConfig, IWheelConfig, IPointerConfig } from './interaction/IInteraction'
42
+ export { IEventTarget, IEvent, ILeaferEvent, IPropertyEvent, ILayoutEvent, IRenderEvent, IChildEvent, IResizeEvent, IResizeEventListener, IUpdateEvent, IWatchEvent, ITransformEvent, ITransformEventData, TransformMode } from './event/IEvent'
43
+ export { IUIEvent, IPointerEvent, PointerType, IDragEvent, IDropEvent, ISwipeEvent, IMoveEvent, IZoomEvent, IRotateEvent, IKeyEvent, IImageEvent } from './event/IUIEvent'
44
+ export { IInteraction, IInteractionCanvas, IInteractionConfig, IWheelConfig, IPointerConfig } from './interaction/IInteraction'
43
45
 
44
46
 
45
- export { __Number, __Boolean, __String, __Object, __Value, IObject, INumberMap, IStringMap, IBooleanMap, IDataTypeHandle } from './data/IData'
47
+ export { __Number, __Boolean, __String, __Object, __Value, ITimer, IObject, INumberMap, IStringMap, IBooleanMap, IDataTypeHandle } from './data/IData'
46
48
  export { ILeafList, ILeafArrayMap, ILeafMap, ILeafLevelList, ILeafListItemCallback } from './data/IList'
47
- export { IPoint, IPointData, IRadiusPointData, ISize, ISizeData, IScreenSizeData, IBounds, IBoundsData, IBoundsDataHandle, IOffsetBoundsData, ITwoPointBounds, ITwoPointBoundsData, IAutoBounds, IAutoBoundsData, IMatrix, IMatrixData, IMatrixWithBoundsData } from './math/IMath'
49
+ export { IPoint, IPointData, IRadiusPointData, ISize, ISizeData, IScreenSizeData, IBounds, IBoundsData, IBoundsDataHandle, IOffsetBoundsData, ITwoPointBounds, ITwoPointBoundsData, IAutoBounds, IAutoBoundsData, IMatrix, IMatrixData, IMatrixWithBoundsData, IMatrixDecompositionData, IMatrixDecompositionAttr } from './math/IMath'
48
50
  export { IFunction } from './function/IFunction'
@@ -1,20 +1,31 @@
1
1
  import { INumberFunction, IPointDataFunction } from '../function/IFunction'
2
- import { IPointerEvent, IMoveEvent, IZoomEvent, IRotateEvent } from '../event/IUIEvent'
2
+ import { IPointerEvent, IMoveEvent, IZoomEvent, IRotateEvent, IUIEvent } from '../event/IUIEvent'
3
3
  import { ILeaf } from '../display/ILeaf'
4
+ import { ILeafList } from '../data/IList'
4
5
  import { IPointData } from '../math/IMath'
6
+ import { ISelector } from '../selector/ISelector'
7
+ import { IBounds } from '../math/IMath'
8
+ import { IControl } from '../control/IControl'
5
9
 
6
- export interface IInteraction {
10
+ export interface IInteraction extends IControl {
7
11
  target: ILeaf
8
- config: IInteractionConfig
12
+ canvas: IInteractionCanvas
13
+ selector: ISelector
14
+
9
15
  running: boolean
16
+ readonly dragging: boolean
10
17
 
11
- pointerMoveIgnore: boolean
18
+ config: IInteractionConfig
12
19
 
13
- start(): void
14
- stop(): void
20
+ readonly hitRadius: number
21
+ shrinkCanvasBounds: IBounds
22
+
23
+ downData: IPointerEvent
24
+ downTime: number
15
25
 
16
26
  pointerDown(data: IPointerEvent): void
17
27
  pointerMove(data: IPointerEvent): void
28
+ pointerMoveReal(data: IPointerEvent): void
18
29
  pointerUp(data: IPointerEvent): void
19
30
  pointerCancel(): void
20
31
 
@@ -22,13 +33,30 @@ export interface IInteraction {
22
33
  zoom(data: IZoomEvent): void
23
34
  rotate(data: IRotateEvent): void
24
35
 
25
- destroy(): void
36
+ emit(type: string, data: IUIEvent, path?: ILeafList, excludePath?: ILeafList): void
37
+ }
38
+
39
+ export interface IInteractionCanvas {
40
+ bounds: IBounds
41
+ view: unknown
26
42
  }
27
43
 
28
44
  export interface IInteractionConfig {
29
45
  wheel?: IWheelConfig
30
46
  pointer?: IPointerConfig
47
+ zoom?: IZoomConfig
48
+ move?: IMoveConfig
49
+ }
50
+
51
+ export interface IZoomConfig {
52
+ min?: number
53
+ max?: number
54
+ }
31
55
 
56
+ export interface IMoveConfig {
57
+ dragEmpty?: boolean
58
+ dragOut?: boolean
59
+ autoDistance?: number
32
60
  }
33
61
 
34
62
  export interface IWheelConfig {
@@ -36,18 +64,22 @@ export interface IWheelConfig {
36
64
  zoomSpeed?: number // 取值范围 0 ~ 1, 默认0.5
37
65
  moveSpeed?: number
38
66
  rotateSpeed?: number // 取值范围 0 ~ 1, 默认0.5
39
- delta?: IPointData
67
+ delta?: IPointData // 以chrome为基准, 鼠标滚动一格的距离
40
68
  getScale?: INumberFunction
41
69
  getMove?: IPointDataFunction
70
+ preventDefault?: boolean
42
71
  }
43
72
 
44
73
  export interface IPointerConfig {
45
74
  hitRadius?: number
46
75
  through?: boolean
47
- clickTime?: number
76
+ tapMore?: boolean
77
+ tapTime?: number
48
78
  longPressTime?: number
49
79
  transformTime?: number
80
+ dragHover?: boolean
50
81
  dragDistance?: number
51
82
  swipeDistance?: number
52
- autoMoveDistance?: number
83
+ ignoreMove?: boolean // 性能优化字段, 控制move事件触发次数
84
+ preventDefault?: boolean
53
85
  }