@leafer/interface 1.0.0-alpha.23 → 1.0.0-alpha.30

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer/interface",
3
- "version": "1.0.0-alpha.23",
3
+ "version": "1.0.0-alpha.30",
4
4
  "description": "@leafer/interface",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
package/src/app/IApp.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ILeafer } from './ILeafer'
2
2
 
3
3
  export interface IApp extends ILeafer {
4
- virtualCanvas: boolean
5
4
  children: ILeafer[]
5
+ realCanvas: boolean
6
6
  }
@@ -2,40 +2,41 @@ import { ILeaf } from '../display/ILeaf'
2
2
  import { IRenderer, IRendererConfig } from '../renderer/IRenderer'
3
3
  import { IHitCanvas, ILeaferCanvas, ILeaferCanvasConfig, IHitCanvasConfig } from '../canvas/ILeaferCanvas'
4
4
  import { ILayouter, ILayouterConfig } from '../layouter/ILayouter'
5
- import { ISelector } from '../selector/ISelector'
5
+ import { ISelector, ISelectorConfig } from '../selector/ISelector'
6
6
  import { IInteraction, IInteractionCanvas, IInteractionConfig } from '../interaction/IInteraction'
7
- import { IWatcher } from '../watcher/IWatcher'
7
+ import { IWatcher, IWatcherConfig } from '../watcher/IWatcher'
8
8
  import { IAutoBounds, IScreenSizeData } from '../math/IMath'
9
9
  import { ICanvasManager } from '../canvas/ICanvasManager'
10
10
  import { IHitCanvasManager } from '../canvas/IHitCanvasManager'
11
11
  import { IImageManager } from '../image/IImageManager'
12
+ import { IEventListenerId } from '../event/IEventer'
12
13
  import { IObject } from '../data/IData'
13
14
  import { IZoomView } from '../display/IView'
14
15
  import { IApp } from './IApp'
15
16
  import { ILeaferImage, ILeaferImageConfig } from '../image/ILeaferImage'
17
+ import { IControl } from '../control/IControl'
18
+
16
19
 
17
20
  export type ILeaferType = 'draw' | 'design' | 'board' | 'document' | 'user'
18
21
  export interface ILeaferConfig extends IRendererConfig, ILeaferCanvasConfig, IInteractionConfig, ILayouterConfig {
19
22
  start?: boolean
20
23
  type?: ILeaferType
21
- virtualCanvas?: boolean
24
+ realCanvas?: boolean
22
25
  }
23
26
 
24
- export interface ILeafer extends IZoomView {
25
-
26
- creator: ICreator
27
+ export interface ILeafer extends IZoomView, IControl {
27
28
 
28
29
  readonly isApp: boolean
29
30
  parent?: IApp
30
31
 
31
32
  running: boolean
32
33
  ready: boolean
34
+ viewReady: boolean
33
35
 
34
- startTimer: number
35
-
36
- autoLayout?: IAutoBounds
36
+ pixelRatio: number
37
37
 
38
38
  view: unknown
39
+
39
40
  canvas: ILeaferCanvas
40
41
  renderer: IRenderer
41
42
 
@@ -49,23 +50,37 @@ export interface ILeafer extends IZoomView {
49
50
  hitCanvasManager?: IHitCanvasManager
50
51
  imageManager: IImageManager
51
52
 
53
+ autoLayout?: IAutoBounds
54
+
52
55
  config: ILeaferConfig
53
56
 
54
- start(): void
55
- stop(): void
57
+ __eventIds: IEventListenerId[]
58
+
59
+ init(userConfig?: ILeaferConfig, parentApp?: IApp): void
60
+
61
+ forceFullRender(): void
56
62
 
57
63
  resize(size: IScreenSizeData): void
58
64
  }
59
65
 
66
+ export interface ILeaferTypeFunction {
67
+ (leafer: ILeafer): void
68
+ }
69
+
70
+ export interface ILeaferTypeList {
71
+ [key: string]: ILeaferTypeFunction
72
+ }
73
+
74
+
60
75
  export interface ICreator {
61
76
  image?(options?: ILeaferImageConfig): ILeaferImage
62
77
  canvas?(options?: ILeaferCanvasConfig, manager?: ICanvasManager): ILeaferCanvas
63
78
  hitCanvas?(options?: IHitCanvasConfig, manager?: ICanvasManager): IHitCanvas
64
79
 
65
- watcher?(target: ILeaf): IWatcher
66
- layouter?(target: ILeaf): ILayouter
67
- renderer?(target: ILeaf, canvas: ILeaferCanvas, options: IRendererConfig): IRenderer
68
- selector?(target: ILeaf): ISelector
80
+ watcher?(target: ILeaf, options?: IWatcherConfig): IWatcher
81
+ layouter?(target: ILeaf, options?: ILayouterConfig): ILayouter
82
+ renderer?(target: ILeaf, canvas: ILeaferCanvas, options?: IRendererConfig): IRenderer
83
+ selector?(target: ILeaf, options?: ISelectorConfig): ISelector
69
84
 
70
85
  interaction?(target: ILeaf, canvas: IInteractionCanvas, selector: ISelector, options?: IInteractionConfig): IInteraction
71
86
  }
@@ -81,11 +81,11 @@ interface CanvasImageSmoothing {
81
81
  }
82
82
 
83
83
  interface CanvasPath {
84
- arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, counterclockwise?: boolean): void
84
+ arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void
85
85
  arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void
86
86
  bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void
87
87
  closePath(): void
88
- ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, counterclockwise?: boolean): void
88
+ ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void
89
89
  lineTo(x: number, y: number): void
90
90
  moveTo(x: number, y: number): void
91
91
  quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void
@@ -10,6 +10,7 @@ export interface ILeaferCanvasConfig extends IAutoBoundsData {
10
10
  view?: string | IObject
11
11
  fill?: string
12
12
  pixelRatio?: number
13
+ smooth?: boolean
13
14
  hittable?: boolean
14
15
  offscreen?: boolean
15
16
  webgl?: boolean
@@ -28,7 +29,7 @@ export interface ICanvasStrokeOptions {
28
29
  miterLimit?: number
29
30
  }
30
31
 
31
- export interface ICanvasAttr extends ICanvasStrokeOptions {
32
+ export interface ICanvasAttr extends ICanvasStrokeOptions, IObject {
32
33
 
33
34
  smooth: boolean // imageSmoothingEnabled: boolean
34
35
  smoothLevel: string // imageSmoothingQuality: string
@@ -103,9 +104,10 @@ interface ICanvasMethod {
103
104
  restoreBlendMode(): void
104
105
 
105
106
  hitFill(point: IPointData, fillRule?: string): boolean
106
- hitStroke(point: IPointData): boolean
107
+ hitStroke(point: IPointData, strokeWidth?: number): boolean
107
108
 
108
109
  setStroke(strokeStyle: string | object, strokeWidth: number, options?: ICanvasStrokeOptions): void
110
+ setStrokeOptions(options: ICanvasStrokeOptions): void
109
111
 
110
112
  setWorld(matrix: IMatrixData, parentMatrix?: IMatrixData): void
111
113
 
@@ -114,6 +116,8 @@ interface ICanvasMethod {
114
116
 
115
117
  copyWorld(canvas: ILeaferCanvas, fromBounds?: IBoundsData, toBounds?: IBoundsData, blendMode?: string): void
116
118
  copyWorldToInner(canvas: ILeaferCanvas, fromWorld: IMatrixWithBoundsData, toInnerBounds: IBoundsData, blendMode?: string): void
119
+ useMask(maskCanvas: ILeaferCanvas, fromBounds?: IBoundsData, toBounds?: IBoundsData): void
120
+
117
121
  fillWorld(bounds: IBoundsData, color: string | object, blendMode?: string): void
118
122
  strokeWorld(bounds: IBoundsData, color: string | object, blendMode?: string): void
119
123
  clipWorld(bounds: IBoundsData, ceilPixel?: boolean): void
@@ -124,9 +128,10 @@ interface ICanvasMethod {
124
128
 
125
129
  export interface ILeaferCanvas extends ICanvasAttr, ICanvasMethod, IPathDrawer {
126
130
 
127
- manager: ICanvasManager
128
-
129
131
  readonly innerId: InnerId
132
+ name: string
133
+
134
+ manager: ICanvasManager
130
135
 
131
136
  width: number
132
137
  height: number
@@ -134,24 +139,35 @@ export interface ILeaferCanvas extends ICanvasAttr, ICanvasMethod, IPathDrawer {
134
139
  pixelRatio: number
135
140
  readonly pixelWidth: number
136
141
  readonly pixelHeight: number
142
+ readonly allowBackgroundColor?: boolean
137
143
 
138
144
  bounds: IBounds
139
145
 
146
+ config: ILeaferCanvasConfig
147
+
148
+ autoLayout: boolean
149
+
140
150
  view: unknown
141
151
  parentView: unknown
152
+
153
+ unreal?: boolean
154
+
142
155
  offscreen: boolean
143
156
 
144
157
  context: ICanvasContext2D
145
158
 
146
159
  recycled?: boolean
147
160
 
148
- debug(): void
161
+ init(): void
162
+
163
+ setBackgroundColor(color: string): void
164
+ setHittable(hittable: boolean): void
149
165
 
150
166
  startAutoLayout(autoBounds: IAutoBounds, listener: IResizeEventListener): void
151
167
  stopAutoLayout(): void
152
168
 
153
169
  resize(size: IScreenSizeData): void
154
- pixel(num: number): number
170
+ setViewSize(size: IScreenSizeData): void
155
171
 
156
172
  // other
157
173
  isSameSize(options: ILeaferCanvasConfig): boolean
@@ -160,7 +176,7 @@ export interface ILeaferCanvas extends ICanvasAttr, ICanvasMethod, IPathDrawer {
160
176
  useSameTransform(canvas: ILeaferCanvas): void
161
177
  recycle(): void
162
178
 
163
- unloadView(): void
179
+ unrealCanvas(): void
164
180
  destroy(): void
165
181
  }
166
182
 
@@ -0,0 +1,5 @@
1
+ export interface IControl {
2
+ start(): void
3
+ stop(): void
4
+ destroy(): void
5
+ }
package/src/data/IData.ts CHANGED
@@ -3,8 +3,7 @@ export type __Boolean = boolean // boolean | string will convert to boolean
3
3
  export type __String = string // string | other will convert to string
4
4
  export type __Object = IObject // will convert to object
5
5
  export type __Value = __Number | __Boolean | __String | __Object //
6
-
7
-
6
+ export type ITimer = any
8
7
  export interface IObject {
9
8
  [name: string]: any
10
9
  }
@@ -6,9 +6,12 @@ export interface IDataProcessor extends IObject {
6
6
  __input: IObject
7
7
  __middle: IObject
8
8
  __get(name: string): unknown
9
+
9
10
  __setInput(name: string, value: unknown): void
10
11
  __getInput(name: string): unknown
12
+ __removeInput(name: string): void
11
13
  __getInputData(): IObject
14
+
12
15
  __setMiddle(name: string, value: unknown): void
13
16
  __getMiddle(name: string): unknown
14
17
  destroy(): void
@@ -14,6 +14,7 @@ import { ILeafBounds } from './module/ILeafBounds'
14
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
 
@@ -50,17 +51,16 @@ export interface ILeafAttrData {
50
51
  draggable: __Boolean
51
52
 
52
53
  hittable: __Boolean
53
- hitType: IHitType
54
+ hitFill: IHitType
55
+ hitStroke: IHitType
54
56
  hitChildren: __Boolean
57
+ hitSelf: __Boolean
55
58
  }
56
59
 
57
60
  export type IHitType =
58
61
  | 'visible'
59
- | 'fill-visible'
60
- | 'stroke-visible'
61
- | 'all'
62
- | 'fill'
63
- | 'stroke'
62
+ | 'always'
63
+ | 'none'
64
64
 
65
65
  export type IBlendMode =
66
66
  | 'pass-through'
@@ -107,8 +107,10 @@ export interface ILeafInputData {
107
107
  draggable?: __Boolean
108
108
 
109
109
  hittable?: __Boolean
110
- hitType?: IHitType
110
+ hitFill?: IHitType
111
+ hitStroke?: IHitType
111
112
  hitChildren?: __Boolean
113
+ hitSelf?: __Boolean
112
114
  }
113
115
  export interface ILeafComputedData {
114
116
  // layer data
@@ -136,17 +138,20 @@ export interface ILeafComputedData {
136
138
  draggable?: boolean
137
139
 
138
140
  hittable?: boolean
139
- hitType?: IHitType
141
+ hitFill?: IHitType
142
+ hitStroke?: IHitType
140
143
  hitChildren?: boolean
144
+ hitSelf?: boolean
141
145
 
142
146
  // other
143
147
  __childBranchNumber?: number // 存在子分支的个数
144
148
  __complex?: boolean // 外观是否复杂
145
149
  }
146
150
 
147
- export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDataProxy, ILeafInputData, IEventer {
151
+ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDataProxy, ILeafInputData, IEventer {
148
152
  tag: string
149
153
  readonly __tag: string
154
+ readonly innerName: string
150
155
 
151
156
  readonly __DataProcessor: IObject // IDataProcessor
152
157
  readonly __LayoutProcessor: IObject // ILeafLayout
@@ -154,9 +159,10 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
154
159
  leafer?: ILeafer
155
160
  parent?: ILeaf
156
161
 
162
+ readonly isApp?: boolean
157
163
  isLeafer?: boolean
158
- __isBranch?: boolean
159
- __isBranchLeaf?: boolean
164
+ isBranch?: boolean
165
+ isBranchLeaf?: boolean
160
166
 
161
167
  __: ILeafData
162
168
  __layout: ILeafLayout
@@ -182,12 +188,16 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
182
188
  __hasMask?: boolean
183
189
  __hitCanvas?: IHitCanvas
184
190
 
191
+ readonly __onlyHitMask: boolean
192
+ readonly __ignoreHitWorld: boolean
193
+
185
194
  __parentWait?: IFunction[]
195
+ __leaferWait?: IFunction[]
186
196
 
187
- __addParentWait(item: IFunction): void
188
- __runParentWait(): void
197
+ waitParent(item: IFunction): void
198
+ waitLeafer(item: IFunction): void
189
199
 
190
- __bindLeafer(leafer: ILeafer): void
200
+ __bindLeafer(leafer: ILeafer | null): void
191
201
 
192
202
  set(data: IObject): void
193
203
  get(attrNames?: string[]): IObject
@@ -195,9 +205,8 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
195
205
  // ILeafData ->
196
206
  __setAttr(attrName: string, newValue: __Value): void
197
207
  __getAttr(attrName: string): __Value
198
- __updateAttr(attrName?: string, value?: __Value): void
199
208
 
200
- forceUpdate(): void
209
+ forceUpdate(attrName?: string): void
201
210
 
202
211
  // ILeafMatrix ->
203
212
  __updateWorldMatrix(): void
@@ -219,6 +228,11 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
219
228
 
220
229
  __onUpdateSize(): void
221
230
 
231
+ // IBranchMask ->
232
+ __updateMask(value?: boolean): void
233
+ __renderMask(canvas: ILeaferCanvas, content: ILeaferCanvas, mask: ILeaferCanvas): void
234
+ __removeMask(child?: ILeaf): void
235
+
222
236
  // convert
223
237
  getWorld(attrName: IMatrixDecompositionAttr): number
224
238
  getBounds(type: ILayoutBoundsType, locationType?: ILayoutLocationType): IBoundsData
@@ -6,6 +6,5 @@ export type ILeafDataProxyModule = ILeafDataProxy & ThisType<ILeaf>
6
6
  export interface ILeafDataProxy {
7
7
  __setAttr?(name: string, newValue: __Value): void
8
8
  __getAttr?(name: string): __Value
9
- __updateAttr?(name?: string, value?: __Value): void
10
9
  }
11
10
 
@@ -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
+
@@ -64,6 +64,7 @@ export interface IPropertyEvent extends IEvent {
64
64
 
65
65
  export interface ILayoutEvent extends IEvent {
66
66
  readonly data: ILayoutBlockData[]
67
+ readonly times: number
67
68
  }
68
69
 
69
70
  export interface IWatchEvent extends IEvent {
package/src/index.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { IApp } from './app/IApp'
2
- export { ILeafer, ILeaferType, ILeaferConfig, ICreator, IUICreator } from './app/ILeafer'
2
+ export { ILeafer, ILeaferType, ILeaferTypeFunction, ILeaferTypeList, ILeaferConfig, ICreator, IUICreator } from './app/ILeafer'
3
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'
@@ -14,23 +14,25 @@ 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
34
  export { ILeaferCanvas, IHitCanvas, ICanvasAttr, ICanvasStrokeOptions, ILeaferCanvasConfig, IHitCanvasConfig } from './canvas/ILeaferCanvas'
33
- export { IPathDrawer } from './path/IPathDrawer'
35
+ export { IPathDrawer, IPathCreator } from './path/IPathDrawer'
34
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
 
@@ -42,7 +44,7 @@ export { IUIEvent, IPointerEvent, PointerType, IDragEvent, IDropEvent, ISwipeEve
42
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
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'
@@ -5,8 +5,9 @@ import { ILeafList } from '../data/IList'
5
5
  import { IPointData } from '../math/IMath'
6
6
  import { ISelector } from '../selector/ISelector'
7
7
  import { IBounds } from '../math/IMath'
8
+ import { IControl } from '../control/IControl'
8
9
 
9
- export interface IInteraction {
10
+ export interface IInteraction extends IControl {
10
11
  target: ILeaf
11
12
  canvas: IInteractionCanvas
12
13
  selector: ISelector
@@ -20,9 +21,7 @@ export interface IInteraction {
20
21
  shrinkCanvasBounds: IBounds
21
22
 
22
23
  downData: IPointerEvent
23
-
24
- start(): void
25
- stop(): void
24
+ downTime: number
26
25
 
27
26
  pointerDown(data: IPointerEvent): void
28
27
  pointerMove(data: IPointerEvent): void
@@ -35,8 +34,6 @@ export interface IInteraction {
35
34
  rotate(data: IRotateEvent): void
36
35
 
37
36
  emit(type: string, data: IUIEvent, path?: ILeafList, excludePath?: ILeafList): void
38
-
39
- destroy(): void
40
37
  }
41
38
 
42
39
  export interface IInteractionCanvas {
@@ -64,7 +61,7 @@ export interface IWheelConfig {
64
61
  export interface IPointerConfig {
65
62
  hitRadius?: number
66
63
  through?: boolean
67
- tapMulti?: boolean
64
+ tapMore?: boolean
68
65
  tapTime?: number
69
66
  longPressTime?: number
70
67
  transformTime?: number
@@ -58,7 +58,7 @@ export interface ILeafLayout {
58
58
  renderBoundsSpreadWidth: number
59
59
  renderShapeBoundsSpreadWidth: number
60
60
 
61
- update(): void
61
+ checkUpdate(): void
62
62
 
63
63
  getTransform(locationType: ILayoutLocationType): IMatrixData
64
64
  getMatrixDecompositionData(locationType: ILayoutLocationType): IMatrixDecompositionData
@@ -1,6 +1,7 @@
1
1
  import { IBounds } from '../math/IMath'
2
2
  import { ILeaf } from '../display/ILeaf'
3
3
  import { ILeafList } from '../data/IList'
4
+ import { IControl } from '../control/IControl'
4
5
 
5
6
  export interface ILayoutChangedData {
6
7
  matrixList: ILeaf[]
@@ -30,30 +31,30 @@ export interface ILayouterConfig {
30
31
  partLayout?: IPartLayoutConfig
31
32
  }
32
33
 
33
- export interface ILayouter {
34
+ export interface ILayouter extends IControl {
34
35
  target: ILeaf
35
36
  layoutedBlocks: ILayoutBlockData[]
36
37
 
37
38
  totalTimes: number
38
39
  times: number
39
40
 
41
+ disabled: boolean
40
42
  running: boolean
41
- changed: boolean
43
+ layouting: boolean
44
+
45
+ waitAgain: boolean
42
46
 
43
47
  config: ILayouterConfig
44
48
 
45
- start(): void
46
- stop(): void
47
- update(): void
49
+ disable(): void
48
50
 
49
51
  layout(): void
52
+ layoutAgain(): void
50
53
  layoutOnce(): void
51
54
  partLayout(): void
52
55
  fullLayout(): void
53
56
 
54
57
  createBlock(data: ILeafList | ILeaf[]): ILayoutBlockData
55
58
  getBlocks(list: ILeafList): ILayoutBlockData[]
56
- setBlocks(current: ILayoutBlockData[]): void
57
-
58
- destroy(): void
59
+ addBlocks(current: ILayoutBlockData[]): void
59
60
  }
package/src/math/IMath.ts CHANGED
@@ -92,6 +92,7 @@ export interface ITwoPointBoundsData {
92
92
 
93
93
  export interface ITwoPointBounds extends ITwoPointBoundsData {
94
94
  addPoint(x: number, y: number): void
95
+ addBounds(x: number, y: number, width: number, height: number): void
95
96
  add(pointBounds: ITwoPointBoundsData): void
96
97
  }
97
98
 
@@ -164,6 +165,7 @@ export interface IMatrix extends IMatrixData {
164
165
 
165
166
  multiply(matrix: IMatrixData): IMatrix
166
167
  divide(matrix: IMatrixData): IMatrix
168
+ preMultiply(matrix: IMatrixData): IMatrix
167
169
  invert(): IMatrix
168
170
 
169
171
  toOuterPoint(inner: IPointData, to?: IPointData): void
@@ -34,14 +34,14 @@ type height = number
34
34
  type rotation = number
35
35
  type startAngle = number
36
36
  type endAngle = number
37
- type counterclockwise = boolean
37
+ type anticlockwise = boolean
38
38
  type cornerRadius = number | number[]
39
39
  type radius = number
40
40
 
41
41
  export type RectCommandData = [Command, x, y, width, height]
42
42
  export type RoundRectCommandData = [Command, x, y, width, height, cornerRadius]
43
- export type EllipseCommandData = [Command, x, y, radiusX, radiusY, rotation, startAngle, endAngle, counterclockwise]
44
- export type ArcCommandData = [Command, x, y, radius, startAngle, endAngle, counterclockwise]
43
+ export type EllipseCommandData = [Command, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise]
44
+ export type ArcCommandData = [Command, x, y, radius, startAngle, endAngle, anticlockwise]
45
45
  export type ArcToCommandData = [Command, x1, y1, x2, y2, radius]
46
46
 
47
47
 
@@ -1,3 +1,4 @@
1
+ import { IPathCommandData } from './IPathCommand'
1
2
  export interface IPathDrawer {
2
3
  beginPath?(): void
3
4
 
@@ -7,10 +8,29 @@ export interface IPathDrawer {
7
8
  quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void
8
9
  closePath(): void
9
10
 
10
- arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, counterclockwise?: boolean): void
11
+ arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void
11
12
  arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void
12
- ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, counterclockwise?: boolean): void
13
+ ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void
13
14
 
14
15
  rect(x: number, y: number, width: number, height: number): void
15
16
  roundRect(x: number, y: number, width: number, height: number, radius?: number | number[]): void
17
+ }
18
+
19
+ export interface IPathCreator {
20
+ path: IPathCommandData
21
+
22
+ beginPath(): IPathCreator
23
+
24
+ moveTo(x: number, y: number): IPathCreator
25
+ lineTo(x: number, y: number): IPathCreator
26
+ bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): IPathCreator
27
+ quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): IPathCreator
28
+ closePath(): IPathCreator
29
+
30
+ arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): IPathCreator
31
+ arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): IPathCreator
32
+ ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: boolean): IPathCreator
33
+
34
+ rect(x: number, y: number, width: number, height: number): IPathCreator
35
+ roundRect(x: number, y: number, width: number, height: number, radius?: number | number[]): IPathCreator
16
36
  }
@@ -1,9 +1,11 @@
1
1
  import { IFunction } from '../function/IFunction'
2
2
  import { ILeaferCanvas } from '../canvas/ILeaferCanvas'
3
+ import { ILeaf } from '../display/ILeaf'
3
4
 
4
5
  export interface IPlatform {
5
6
  requestRender?(render: IFunction): void
6
7
  canvas?: ILeaferCanvas
7
8
  isWorker?: boolean
8
9
  conicGradientRotate90?: boolean // fixfox need rotate
10
+ layout(target: ILeaf): void
9
11
  }
@@ -2,6 +2,7 @@ import { ILeaferCanvas } from '../canvas/ILeaferCanvas'
2
2
  import { ILeaf } from '../display/ILeaf'
3
3
  import { IBounds, IMatrix } from '../math/IMath'
4
4
  import { IFunction } from '../function/IFunction'
5
+ import { IControl } from '../control/IControl'
5
6
 
6
7
  export interface IRenderOptions {
7
8
  bounds?: IBounds,
@@ -13,9 +14,10 @@ export interface IRenderOptions {
13
14
  export interface IRendererConfig {
14
15
  usePartRender?: boolean
15
16
  maxFPS?: number
17
+ fill?: string
16
18
  }
17
19
 
18
- export interface IRenderer {
20
+ export interface IRenderer extends IControl {
19
21
  target: ILeaf
20
22
  canvas: ILeaferCanvas
21
23
  updateBlocks: IBounds[]
@@ -25,24 +27,27 @@ export interface IRenderer {
25
27
  times: number
26
28
 
27
29
  running: boolean
30
+ rendering: boolean
31
+
32
+ waitAgain: boolean
28
33
  changed: boolean
29
34
 
30
35
  config: IRendererConfig
31
36
 
32
- start(): void
33
- stop(): void
34
37
  update(): void
35
38
 
36
39
  requestLayout(): void
37
40
 
38
41
  render(callback?: IFunction): void
42
+ renderAgain(): void
39
43
  renderOnce(callback?: IFunction): void
40
44
  partRender(): void
41
45
  clipRender(bounds: IBounds): void
42
46
  fullRender(): void
43
47
 
48
+ renderHitView(options: IRenderOptions): void
49
+ renderBoundsView(options: IRenderOptions): void
50
+
44
51
  addBlock(block: IBounds): void
45
52
  mergeBlocks(): void
46
-
47
- destroy(): void
48
53
  }
@@ -9,15 +9,22 @@ export interface ISelectPathResult {
9
9
  }
10
10
 
11
11
  export interface ISelectPathOptions {
12
+ name?: string
12
13
  through?: boolean
13
14
  exclude?: ILeafList
15
+ ignoreHittable?: boolean
16
+ }
17
+
18
+ export interface ISelectorConfig {
19
+
14
20
  }
15
21
 
16
22
  export interface ISelector {
17
23
  target: ILeaf
18
- defaultPath: ILeafList
19
24
 
20
- getHitPointPath(hitPoint: IPointData, hitRadius: number, options?: ISelectPathOptions): ISelectPathResult
25
+ config: ISelectorConfig
26
+
27
+ getByPoint(hitPoint: IPointData, hitRadius: number, options?: ISelectPathOptions): ISelectPathResult
21
28
 
22
29
  find(name: number | string, branch?: ILeaf): ILeaf | ILeaf[]
23
30
  getByInnerId(name: number, branch?: ILeaf): ILeaf
@@ -1,5 +1,6 @@
1
1
  import { ILeaf } from '../display/ILeaf'
2
2
  import { ILeafList } from '../data/IList'
3
+ import { IControl } from '../control/IControl'
3
4
 
4
5
  export interface IWatchEventData {
5
6
  updatedList: ILeafList
@@ -9,20 +10,19 @@ export interface IWatcherConfig {
9
10
 
10
11
  }
11
12
 
12
- export interface IWatcher {
13
+ export interface IWatcher extends IControl {
13
14
  target: ILeaf
14
15
  updatedList: ILeafList
15
16
 
16
17
  totalTimes: number
17
18
 
19
+ disabled: boolean
18
20
  running: boolean
19
21
  changed: boolean
20
22
 
21
23
  config: IWatcherConfig
22
24
 
23
- start(): void
24
- stop(): void
25
+ disable(): void
25
26
 
26
27
  update(): void
27
- destroy(): void
28
28
  }