@leafer/interface 1.0.0-beta.12 → 1.0.0-beta.16
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 +5 -2
- package/src/app/ILeafer.ts +9 -2
- package/src/canvas/ILeaferCanvas.ts +7 -0
- package/src/data/IData.ts +1 -2
- package/src/data/ILeafData.ts +5 -5
- package/src/display/IBranch.ts +1 -0
- package/src/display/ILeaf.ts +101 -11
- package/src/display/module/ILeafBounds.ts +2 -0
- package/src/event/IUIEvent.ts +6 -3
- package/src/image/ILeaferImage.ts +2 -0
- package/src/index.ts +2 -2
- package/src/interaction/IInteraction.ts +20 -6
- package/src/layout/ILeafLayout.ts +1 -2
- package/src/math/IMath.ts +7 -8
- package/src/path/IPathDrawer.ts +5 -0
- package/src/platform/IPlatform.ts +4 -2
- package/src/watcher/IWatcher.ts +5 -1
- package/types/index.d.ts +1672 -0
package/package.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer/interface",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.16",
|
|
4
4
|
"description": "@leafer/interface",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "src/index.ts",
|
|
8
|
+
"types": "types/index.d.ts",
|
|
8
9
|
"files": [
|
|
9
|
-
"src"
|
|
10
|
+
"src",
|
|
11
|
+
"types",
|
|
12
|
+
"dist"
|
|
10
13
|
],
|
|
11
14
|
"repository": {
|
|
12
15
|
"type": "git",
|
package/src/app/ILeafer.ts
CHANGED
|
@@ -27,12 +27,14 @@ export interface ILeaferConfig extends IRendererConfig, ILeaferCanvasConfig, IIn
|
|
|
27
27
|
export interface ILeafer extends IZoomView, IControl {
|
|
28
28
|
|
|
29
29
|
readonly isApp: boolean
|
|
30
|
+
readonly app: ILeafer
|
|
30
31
|
parent?: IApp
|
|
31
32
|
|
|
32
33
|
running: boolean
|
|
34
|
+
created: boolean
|
|
33
35
|
ready: boolean
|
|
34
36
|
viewReady: boolean
|
|
35
|
-
|
|
37
|
+
viewCompleted: boolean
|
|
36
38
|
|
|
37
39
|
pixelRatio: number
|
|
38
40
|
|
|
@@ -55,12 +57,17 @@ export interface ILeafer extends IZoomView, IControl {
|
|
|
55
57
|
config: ILeaferConfig
|
|
56
58
|
|
|
57
59
|
__eventIds: IEventListenerId[]
|
|
60
|
+
__nextRenderWait: IFunction[]
|
|
58
61
|
|
|
59
62
|
init(userConfig?: ILeaferConfig, parentApp?: IApp): void
|
|
60
63
|
setZoomLayer(zoomLayer: ILeaf, moveLayer?: ILeaf): void
|
|
61
64
|
forceFullRender(): void
|
|
65
|
+
updateCursor(): void
|
|
62
66
|
resize(size: IScreenSizeData): void
|
|
63
|
-
|
|
67
|
+
|
|
68
|
+
waitReady(item: IFunction): void
|
|
69
|
+
waitViewReady(item: IFunction): void
|
|
70
|
+
waitViewCompleted(item: IFunction): void
|
|
64
71
|
}
|
|
65
72
|
|
|
66
73
|
export interface ILeaferTypeCreator {
|
|
@@ -5,6 +5,7 @@ import { IResizeEventListener } from '../event/IEvent'
|
|
|
5
5
|
import { IPathDrawer } from '../path/IPathDrawer'
|
|
6
6
|
import { InnerId } from '../event/IEventer'
|
|
7
7
|
import { ICanvasManager } from './ICanvasManager'
|
|
8
|
+
import { ICursorType } from '../display/ILeaf'
|
|
8
9
|
|
|
9
10
|
export interface ILeaferCanvasConfig extends IAutoBoundsData {
|
|
10
11
|
view?: string | IObject
|
|
@@ -109,12 +110,15 @@ interface ICanvasMethod {
|
|
|
109
110
|
setStrokeOptions(options: ICanvasStrokeOptions): void
|
|
110
111
|
|
|
111
112
|
setWorld(matrix: IMatrixData, parentMatrix?: IMatrixData): void
|
|
113
|
+
useWorldTransform(worldTransform?: IMatrixData): void
|
|
112
114
|
|
|
113
115
|
setWorldShadow(x: number, y: number, blur: number, color?: string): void
|
|
114
116
|
setWorldBlur(blur: number): void
|
|
115
117
|
|
|
116
118
|
copyWorld(canvas: ILeaferCanvas, fromBounds?: IBoundsData, toBounds?: IBoundsData, blendMode?: string): void
|
|
119
|
+
copyWorldByReset(canvas: ILeaferCanvas, from?: IBoundsData, to?: IBoundsData, blendMode?: string): void
|
|
117
120
|
copyWorldToInner(canvas: ILeaferCanvas, fromWorld: IMatrixWithBoundsData, toInnerBounds: IBoundsData, blendMode?: string): void
|
|
121
|
+
|
|
118
122
|
useMask(maskCanvas: ILeaferCanvas, fromBounds?: IBoundsData, toBounds?: IBoundsData): void
|
|
119
123
|
useEraser(eraserCanvas: ILeaferCanvas, fromBounds?: IBoundsData, toBounds?: IBoundsData): void
|
|
120
124
|
|
|
@@ -175,12 +179,15 @@ export interface ILeaferCanvas extends ICanvasAttr, ICanvasMethod, IPathDrawer {
|
|
|
175
179
|
updateViewSize(): void
|
|
176
180
|
updateClientBounds(): void
|
|
177
181
|
|
|
182
|
+
setCursor(cursor: ICursorType | ICursorType[]): void
|
|
183
|
+
|
|
178
184
|
// other
|
|
179
185
|
isSameSize(options: ILeaferCanvasConfig): boolean
|
|
180
186
|
getSameCanvas(useSameWorldTransform?: boolean): ILeaferCanvas
|
|
181
187
|
getBiggerCanvas(addWidth: number, addHeight: number): ILeaferCanvas
|
|
182
188
|
recycle(): void
|
|
183
189
|
|
|
190
|
+
updateRender(): void
|
|
184
191
|
unrealCanvas(): void
|
|
185
192
|
destroy(): void
|
|
186
193
|
}
|
package/src/data/IData.ts
CHANGED
package/src/data/ILeafData.ts
CHANGED
|
@@ -9,15 +9,15 @@ export interface IDataProcessor extends IObject {
|
|
|
9
9
|
__single: boolean
|
|
10
10
|
__checkSingle(): void
|
|
11
11
|
|
|
12
|
-
__get(name: string):
|
|
12
|
+
__get(name: string): any
|
|
13
13
|
|
|
14
|
-
__setInput(name: string, value:
|
|
15
|
-
__getInput(name: string):
|
|
14
|
+
__setInput(name: string, value: any): void
|
|
15
|
+
__getInput(name: string): any
|
|
16
16
|
__removeInput(name: string): void
|
|
17
17
|
__getInputData(): IObject
|
|
18
18
|
|
|
19
|
-
__setMiddle(name: string, value:
|
|
20
|
-
__getMiddle(name: string):
|
|
19
|
+
__setMiddle(name: string, value: any): void
|
|
20
|
+
__getMiddle(name: string): any
|
|
21
21
|
|
|
22
22
|
destroy(): void
|
|
23
23
|
}
|
package/src/display/IBranch.ts
CHANGED
package/src/display/ILeaf.ts
CHANGED
|
@@ -5,7 +5,7 @@ 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, IPointData, IBoundsData,
|
|
8
|
+
import { IMatrixWithBoundsData, IMatrix, IPointData, IBoundsData, IRadiusPointData, IMatrixDecompositionAttr, IMatrixWithLayoutData } from '../math/IMath'
|
|
9
9
|
import { IFunction } from '../function/IFunction'
|
|
10
10
|
|
|
11
11
|
import { ILeafDataProxy } from './module/ILeafDataProxy'
|
|
@@ -35,7 +35,7 @@ export interface ILeafAttrData {
|
|
|
35
35
|
opacity: __Number
|
|
36
36
|
visible: __Boolean
|
|
37
37
|
isMask: __Boolean
|
|
38
|
-
isEraser
|
|
38
|
+
isEraser: __Boolean
|
|
39
39
|
zIndex: __Number
|
|
40
40
|
|
|
41
41
|
// layout data
|
|
@@ -49,6 +49,9 @@ export interface ILeafAttrData {
|
|
|
49
49
|
skewX: __Number
|
|
50
50
|
skewY: __Number
|
|
51
51
|
|
|
52
|
+
scale: __Number | IPointData // helper
|
|
53
|
+
around: 'center' | IPointData
|
|
54
|
+
|
|
52
55
|
draggable: __Boolean
|
|
53
56
|
|
|
54
57
|
hittable: __Boolean
|
|
@@ -56,6 +59,9 @@ export interface ILeafAttrData {
|
|
|
56
59
|
hitStroke: IHitType
|
|
57
60
|
hitChildren: __Boolean
|
|
58
61
|
hitSelf: __Boolean
|
|
62
|
+
hitRadius: __Number
|
|
63
|
+
|
|
64
|
+
cursor: ICursorType | ICursorType[]
|
|
59
65
|
}
|
|
60
66
|
|
|
61
67
|
export type IHitType =
|
|
@@ -91,7 +97,60 @@ export type IBlendMode =
|
|
|
91
97
|
| 'destination-out'
|
|
92
98
|
| 'destination-atop'
|
|
93
99
|
|
|
94
|
-
export
|
|
100
|
+
export type IResizeType = 'size' | 'scale'
|
|
101
|
+
export interface IImageCursor {
|
|
102
|
+
url: string
|
|
103
|
+
x?: number
|
|
104
|
+
y?: number
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export type IAround = 'center' | IPointData
|
|
108
|
+
|
|
109
|
+
export type ICursorType =
|
|
110
|
+
| IImageCursor
|
|
111
|
+
| 'auto'
|
|
112
|
+
| 'default'
|
|
113
|
+
| 'none'
|
|
114
|
+
| 'context-menu'
|
|
115
|
+
| 'help'
|
|
116
|
+
| 'pointer'
|
|
117
|
+
| 'progress'
|
|
118
|
+
| 'wait'
|
|
119
|
+
| 'cell'
|
|
120
|
+
| 'crosshair'
|
|
121
|
+
| 'text'
|
|
122
|
+
| 'vertical-text'
|
|
123
|
+
| 'alias'
|
|
124
|
+
| 'copy'
|
|
125
|
+
| 'move'
|
|
126
|
+
| 'no-drop'
|
|
127
|
+
| 'not-allowed'
|
|
128
|
+
| 'grab'
|
|
129
|
+
| 'grabbing'
|
|
130
|
+
| 'e-resize'
|
|
131
|
+
| 'n-resize'
|
|
132
|
+
| 'ne-resize'
|
|
133
|
+
| 'nw-resize'
|
|
134
|
+
| 's-resize'
|
|
135
|
+
| 'se-resize'
|
|
136
|
+
| 'sw-resize'
|
|
137
|
+
| 'w-resize'
|
|
138
|
+
| 'ew-resize'
|
|
139
|
+
| 'ns-resize'
|
|
140
|
+
| 'nesw-resize'
|
|
141
|
+
| 'nwse-resize'
|
|
142
|
+
| 'col-resize'
|
|
143
|
+
| 'row-resize'
|
|
144
|
+
| 'all-scroll'
|
|
145
|
+
| 'zoom -in'
|
|
146
|
+
| 'zoom-out'
|
|
147
|
+
|
|
148
|
+
export interface ICursorTypeMap {
|
|
149
|
+
[name: string]: ICursorType | ICursorType[]
|
|
150
|
+
}
|
|
151
|
+
export interface ILeafInputData extends IObject {
|
|
152
|
+
tag?: string
|
|
153
|
+
|
|
95
154
|
// layer data
|
|
96
155
|
id?: __String
|
|
97
156
|
name?: __String
|
|
@@ -115,6 +174,9 @@ export interface ILeafInputData {
|
|
|
115
174
|
skewX?: __Number
|
|
116
175
|
skewY?: __Number
|
|
117
176
|
|
|
177
|
+
scale?: __Number | IPointData // helper
|
|
178
|
+
around?: IAround
|
|
179
|
+
|
|
118
180
|
draggable?: __Boolean
|
|
119
181
|
|
|
120
182
|
hittable?: __Boolean
|
|
@@ -122,6 +184,11 @@ export interface ILeafInputData {
|
|
|
122
184
|
hitStroke?: IHitType
|
|
123
185
|
hitChildren?: __Boolean
|
|
124
186
|
hitSelf?: __Boolean
|
|
187
|
+
hitRadius?: __Number
|
|
188
|
+
|
|
189
|
+
cursor?: ICursorType | ICursorType[]
|
|
190
|
+
|
|
191
|
+
children?: ILeafInputData[]
|
|
125
192
|
}
|
|
126
193
|
export interface ILeafComputedData {
|
|
127
194
|
// layer data
|
|
@@ -147,6 +214,8 @@ export interface ILeafComputedData {
|
|
|
147
214
|
skewX?: number
|
|
148
215
|
skewY?: number
|
|
149
216
|
|
|
217
|
+
around?: IAround
|
|
218
|
+
|
|
150
219
|
draggable?: boolean
|
|
151
220
|
|
|
152
221
|
hittable?: boolean
|
|
@@ -154,6 +223,9 @@ export interface ILeafComputedData {
|
|
|
154
223
|
hitStroke?: IHitType
|
|
155
224
|
hitChildren?: boolean
|
|
156
225
|
hitSelf?: boolean
|
|
226
|
+
hitRadius?: number
|
|
227
|
+
|
|
228
|
+
cursor?: ICursorType | ICursorType[]
|
|
157
229
|
|
|
158
230
|
// other
|
|
159
231
|
__childBranchNumber?: number // 存在子分支的个数
|
|
@@ -181,13 +253,15 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
|
|
|
181
253
|
__: ILeafData
|
|
182
254
|
__layout: ILeafLayout
|
|
183
255
|
|
|
256
|
+
__world: IMatrixWithLayoutData
|
|
184
257
|
__local: IMatrixWithBoundsData
|
|
185
|
-
|
|
258
|
+
|
|
186
259
|
__worldOpacity: number
|
|
187
260
|
|
|
188
|
-
readonly worldTransform:
|
|
189
|
-
readonly localTransform:
|
|
261
|
+
readonly worldTransform: IMatrixWithLayoutData
|
|
262
|
+
readonly localTransform: IMatrixWithBoundsData
|
|
190
263
|
|
|
264
|
+
readonly boxBounds: IBoundsData
|
|
191
265
|
readonly worldBoxBounds: IBoundsData
|
|
192
266
|
readonly worldStrokeBounds: IBoundsData
|
|
193
267
|
readonly worldRenderBounds: IBoundsData
|
|
@@ -199,6 +273,10 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
|
|
|
199
273
|
__level: number // 图层级别 root(1) -> hight
|
|
200
274
|
__tempNumber?: number // 用于临时运算储存状态
|
|
201
275
|
|
|
276
|
+
readonly resizeable: boolean
|
|
277
|
+
|
|
278
|
+
readonly __hasMirror: boolean
|
|
279
|
+
|
|
202
280
|
__hasMask?: boolean
|
|
203
281
|
__hasEraser?: boolean
|
|
204
282
|
__hitCanvas?: IHitCanvas
|
|
@@ -213,11 +291,13 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
|
|
|
213
291
|
|
|
214
292
|
waitParent(item: IFunction): void
|
|
215
293
|
waitLeafer(item: IFunction): void
|
|
294
|
+
nextRender(item: IFunction): void
|
|
216
295
|
|
|
217
296
|
__bindLeafer(leafer: ILeafer | null): void
|
|
218
297
|
|
|
219
298
|
set(data: IObject): void
|
|
220
|
-
|
|
299
|
+
toJSON(): IObject
|
|
300
|
+
toString(): string
|
|
221
301
|
|
|
222
302
|
// ILeafData ->
|
|
223
303
|
__setAttr(attrName: string, newValue: __Value): void
|
|
@@ -240,6 +320,8 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
|
|
|
240
320
|
__updateStrokeBounds(): void
|
|
241
321
|
__updateRenderBounds(): void
|
|
242
322
|
|
|
323
|
+
__updateNaturalSize(): void
|
|
324
|
+
|
|
243
325
|
__updateStrokeSpread(): number
|
|
244
326
|
__updateRenderSpread(): number
|
|
245
327
|
|
|
@@ -255,14 +337,22 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
|
|
|
255
337
|
getWorld(attrName: IMatrixDecompositionAttr): number
|
|
256
338
|
getBounds(type: ILayoutBoundsType, locationType?: ILayoutLocationType): IBoundsData
|
|
257
339
|
|
|
258
|
-
worldToLocal(world: IPointData, to?: IPointData,
|
|
259
|
-
localToWorld(local: IPointData, to?: IPointData,
|
|
260
|
-
worldToInner(world: IPointData, to?: IPointData,
|
|
261
|
-
innerToWorld(inner: IPointData, to?: IPointData,
|
|
340
|
+
worldToLocal(world: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void
|
|
341
|
+
localToWorld(local: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void
|
|
342
|
+
worldToInner(world: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void
|
|
343
|
+
innerToWorld(inner: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void
|
|
344
|
+
|
|
345
|
+
getInnerPoint(world: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData
|
|
346
|
+
getInnerPointByLocal(local: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData
|
|
347
|
+
getLocalPoint(world: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData
|
|
348
|
+
getLocalPointByInner(inner: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData
|
|
349
|
+
getWorldPoint(inner: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData
|
|
350
|
+
getWorldPointByLocal(local: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData
|
|
262
351
|
|
|
263
352
|
move(x: number, y?: number): void
|
|
264
353
|
scaleOf(origin: IPointData, x: number, y?: number): void
|
|
265
354
|
rotateOf(origin: IPointData, rotation: number): void
|
|
355
|
+
skewOf(origin: IPointData, x: number, y: number): void
|
|
266
356
|
|
|
267
357
|
// ILeafHit ->
|
|
268
358
|
__hitWorld(point: IRadiusPointData): boolean
|
package/src/event/IUIEvent.ts
CHANGED
|
@@ -45,11 +45,13 @@ export type PointerType = 'mouse' | 'pen' | 'touch'
|
|
|
45
45
|
export interface IDragEvent extends IPointerEvent {
|
|
46
46
|
moveX: number
|
|
47
47
|
moveY: number
|
|
48
|
-
totalX
|
|
49
|
-
totalY
|
|
48
|
+
totalX?: number
|
|
49
|
+
totalY?: number
|
|
50
50
|
|
|
51
51
|
getInnerMove?(target?: ILeaf): IPointData
|
|
52
52
|
getLocalMove?(target?: ILeaf): IPointData
|
|
53
|
+
getInnerTotal?(target?: ILeaf): IPointData
|
|
54
|
+
getLocalTotal?(target?: ILeaf): IPointData
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
export interface IDropEvent extends IPointerEvent {
|
|
@@ -74,7 +76,8 @@ export interface ISwipeEvent extends IDragEvent {
|
|
|
74
76
|
}
|
|
75
77
|
|
|
76
78
|
export interface IKeyEvent extends IUIEvent {
|
|
77
|
-
|
|
79
|
+
code?: string
|
|
80
|
+
key?: string
|
|
78
81
|
}
|
|
79
82
|
|
|
80
83
|
export interface IImageEvent extends IEvent {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { IObject } from '../data/IData'
|
|
2
2
|
import { InnerId } from '../event/IEventer'
|
|
3
|
+
import { IExportFileType } from '../file/IFileType'
|
|
3
4
|
|
|
4
5
|
export interface ILeaferImageConfig {
|
|
5
6
|
url: string
|
|
6
7
|
thumb?: string
|
|
8
|
+
format?: IExportFileType
|
|
7
9
|
}
|
|
8
10
|
|
|
9
11
|
export interface ILeaferImageOnLoaded {
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { IApp } from './app/IApp'
|
|
2
2
|
export { ILeafer, ILeaferType, ILeaferTypeCreator, ILeaferTypeFunction, ILeaferTypeList, ILeaferConfig, ICreator, IUICreator } from './app/ILeafer'
|
|
3
|
-
export { ILeaf, ILeafAttrData, ILeafComputedData, ILeafInputData, ICachedLeaf, IHitType, IBlendMode } from './display/ILeaf'
|
|
3
|
+
export { ILeaf, ILeafAttrData, ILeafComputedData, ILeafInputData, ICachedLeaf, IHitType, IBlendMode, IResizeType, ICursorType, ICursorTypeMap, IAround } from './display/ILeaf'
|
|
4
4
|
export { IBranch } from './display/IBranch'
|
|
5
5
|
export { IZoomView } from './display/IView'
|
|
6
6
|
|
|
@@ -51,5 +51,5 @@ export { IInteraction, IInteractionCanvas, IInteractionConfig, IWheelConfig, IPo
|
|
|
51
51
|
|
|
52
52
|
export { __Number, __Boolean, __String, __Object, __Value, IPathString, ITimer, IObject, INumberMap, IStringMap, IBooleanMap, IDataTypeHandle } from './data/IData'
|
|
53
53
|
export { ILeafList, ILeafArrayMap, ILeafMap, ILeafLevelList, ILeafListItemCallback } from './data/IList'
|
|
54
|
-
export { IPoint, IPointData, IRadiusPointData, ISize, ISizeData, IScreenSizeData, IBounds, IBoundsData, IBoundsDataHandle, IOffsetBoundsData, ITwoPointBounds, ITwoPointBoundsData, IAutoBounds, IAutoBoundsData, IMatrix, IMatrixData, IMatrixWithBoundsData, IMatrixDecompositionData, IMatrixDecompositionAttr } from './math/IMath'
|
|
54
|
+
export { IPoint, IPointData, IRadiusPointData, ISize, ISizeData, IScreenSizeData, IBounds, IBoundsData, IBoundsDataHandle, IOffsetBoundsData, ITwoPointBounds, ITwoPointBoundsData, IAutoBounds, IAutoBoundsData, IMatrix, IMatrixData, IMatrixWithBoundsData, IMatrixWithLayoutData, IMatrixDecompositionData, IMatrixDecompositionAttr } from './math/IMath'
|
|
55
55
|
export { IFunction } from './function/IFunction'
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { INumberFunction, IPointDataFunction } from '../function/IFunction'
|
|
2
|
-
import { IPointerEvent, IMoveEvent, IZoomEvent, IRotateEvent, IUIEvent } from '../event/IUIEvent'
|
|
3
|
-
import { ILeaf } from '../display/ILeaf'
|
|
2
|
+
import { IPointerEvent, IMoveEvent, IZoomEvent, IRotateEvent, IUIEvent, IKeyEvent } from '../event/IUIEvent'
|
|
3
|
+
import { ILeaf, ICursorType } from '../display/ILeaf'
|
|
4
4
|
import { ILeafList } from '../data/IList'
|
|
5
5
|
import { IPointData } from '../math/IMath'
|
|
6
|
-
import { ISelector } from '../selector/ISelector'
|
|
6
|
+
import { ISelector, ISelectPathOptions } from '../selector/ISelector'
|
|
7
7
|
import { IBounds } from '../math/IMath'
|
|
8
8
|
import { IControl } from '../control/IControl'
|
|
9
9
|
import { IKeepTouchData } from '../event/IEvent'
|
|
@@ -17,21 +17,25 @@ export interface IInteraction extends IControl {
|
|
|
17
17
|
|
|
18
18
|
running: boolean
|
|
19
19
|
readonly dragging: boolean
|
|
20
|
+
readonly moveMode: boolean
|
|
20
21
|
|
|
21
22
|
config: IInteractionConfig
|
|
22
23
|
|
|
24
|
+
cursor: ICursorType | ICursorType[]
|
|
23
25
|
readonly hitRadius: number
|
|
26
|
+
|
|
24
27
|
shrinkCanvasBounds: IBounds
|
|
25
28
|
|
|
26
29
|
downData: IPointerEvent
|
|
30
|
+
hoverData: IPointerEvent
|
|
27
31
|
downTime: number
|
|
28
32
|
|
|
29
33
|
receive(event: any): void
|
|
30
34
|
|
|
31
|
-
pointerDown(data
|
|
32
|
-
pointerMove(data
|
|
35
|
+
pointerDown(data?: IPointerEvent, defaultPath?: boolean): void
|
|
36
|
+
pointerMove(data?: IPointerEvent): void
|
|
33
37
|
pointerMoveReal(data: IPointerEvent): void
|
|
34
|
-
pointerUp(data
|
|
38
|
+
pointerUp(data?: IPointerEvent): void
|
|
35
39
|
pointerCancel(): void
|
|
36
40
|
|
|
37
41
|
multiTouch(data: IUIEvent, list: IKeepTouchData[]): void
|
|
@@ -40,6 +44,15 @@ export interface IInteraction extends IControl {
|
|
|
40
44
|
zoom(data: IZoomEvent): void
|
|
41
45
|
rotate(data: IRotateEvent): void
|
|
42
46
|
|
|
47
|
+
keyDown(data: IKeyEvent): void
|
|
48
|
+
keyUp(data: IKeyEvent): void
|
|
49
|
+
|
|
50
|
+
findPath(data: IPointerEvent, options?: ISelectPathOptions): ILeafList
|
|
51
|
+
|
|
52
|
+
updateDownData(data?: IPointerEvent): void
|
|
53
|
+
updateHoverData(data: IPointerEvent): void
|
|
54
|
+
updateCursor(hoverData?: IPointerEvent): void
|
|
55
|
+
|
|
43
56
|
emit(type: string, data: IUIEvent, path?: ILeafList, excludePath?: ILeafList): void
|
|
44
57
|
}
|
|
45
58
|
|
|
@@ -61,6 +74,7 @@ export interface IZoomConfig {
|
|
|
61
74
|
}
|
|
62
75
|
|
|
63
76
|
export interface IMoveConfig {
|
|
77
|
+
holdSpaceKey?: boolean
|
|
64
78
|
dragEmpty?: boolean
|
|
65
79
|
dragOut?: boolean
|
|
66
80
|
autoDistance?: number
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IBoundsData, IMatrixData
|
|
1
|
+
import { IBoundsData, IMatrixData } from '../math/IMath'
|
|
2
2
|
import { ILeaf } from '../display/ILeaf'
|
|
3
3
|
|
|
4
4
|
export type ILayoutLocationType = 'world' | 'local' | 'inner'
|
|
@@ -65,7 +65,6 @@ export interface ILeafLayout {
|
|
|
65
65
|
checkUpdate(force?: boolean): void
|
|
66
66
|
|
|
67
67
|
getTransform(locationType: ILayoutLocationType): IMatrixData
|
|
68
|
-
decomposeTransform(locationType: ILayoutLocationType): IMatrixDecompositionData
|
|
69
68
|
getBounds(type: ILayoutBoundsType, locationType: ILayoutLocationType): IBoundsData
|
|
70
69
|
|
|
71
70
|
// 独立 / 引用 boxBounds
|
package/src/math/IMath.ts
CHANGED
|
@@ -56,12 +56,13 @@ export interface IBounds extends IBoundsData {
|
|
|
56
56
|
copy(bounds: IBoundsData): IBounds
|
|
57
57
|
clone(): IBounds
|
|
58
58
|
|
|
59
|
-
scale(
|
|
59
|
+
scale(scaleX: number, scaleY?: number): IBounds
|
|
60
60
|
toOuterOf(matrix: IMatrixData, to?: IBoundsData): IBounds
|
|
61
61
|
getFitMatrix(put: IBoundsData): IMatrix
|
|
62
62
|
|
|
63
63
|
spread(size: number): IBounds
|
|
64
64
|
ceil(): IBounds
|
|
65
|
+
unsign(): IBounds
|
|
65
66
|
|
|
66
67
|
add(bounds: IBoundsData): IBounds
|
|
67
68
|
addList(boundsList: IBounds[]): IBounds
|
|
@@ -71,7 +72,7 @@ export interface IBounds extends IBoundsData {
|
|
|
71
72
|
setByPoints(points: IPointData[]): IBounds
|
|
72
73
|
|
|
73
74
|
hitPoint(point: IPointData, pointMatrix?: IMatrixData): boolean
|
|
74
|
-
hitRadiusPoint(point: IRadiusPointData, pointMatrix?:
|
|
75
|
+
hitRadiusPoint(point: IRadiusPointData, pointMatrix?: IMatrixWithLayoutData): boolean
|
|
75
76
|
hit(bounds: IBoundsData, boundsMatrix?: IMatrixData): boolean
|
|
76
77
|
includes(bounds: IBoundsData, boundsMatrix?: IMatrixData): boolean
|
|
77
78
|
|
|
@@ -168,16 +169,14 @@ export interface IMatrix extends IMatrixData {
|
|
|
168
169
|
preMultiply(matrix: IMatrixData): IMatrix
|
|
169
170
|
invert(): IMatrix
|
|
170
171
|
|
|
171
|
-
toOuterPoint(inner: IPointData, to?: IPointData): void
|
|
172
|
-
toInnerPoint(outer: IPointData, to?: IPointData): void
|
|
172
|
+
toOuterPoint(inner: IPointData, to?: IPointData, distance?: boolean): void
|
|
173
|
+
toInnerPoint(outer: IPointData, to?: IPointData, distance?: boolean): void
|
|
173
174
|
|
|
174
175
|
decompose(): IMatrixDecompositionData
|
|
175
176
|
|
|
176
177
|
reset(): void
|
|
177
178
|
}
|
|
178
179
|
|
|
180
|
+
export interface IMatrixWithBoundsData extends IMatrixData, IBoundsData { }
|
|
179
181
|
|
|
180
|
-
export interface
|
|
181
|
-
scaleX?: number
|
|
182
|
-
scaleY?: number
|
|
183
|
-
}
|
|
182
|
+
export interface IMatrixWithLayoutData extends IMatrixData, IMatrixDecompositionData, IBoundsData { }
|
package/src/path/IPathDrawer.ts
CHANGED
|
@@ -33,4 +33,9 @@ export interface IPathCreator {
|
|
|
33
33
|
|
|
34
34
|
rect(x: number, y: number, width: number, height: number): IPathCreator
|
|
35
35
|
roundRect(x: number, y: number, width: number, height: number, radius?: number | number[]): IPathCreator
|
|
36
|
+
|
|
37
|
+
// new
|
|
38
|
+
drawEllipse(x: number, y: number, radiusX: number, radiusY: number, rotation?: number, startAngle?: number, endAngle?: number, anticlockwise?: boolean): IPathCreator
|
|
39
|
+
drawArc(x: number, y: number, radius: number, startAngle?: number, endAngle?: number, anticlockwise?: boolean): IPathCreator
|
|
40
|
+
drawPoints(points: number[], curve?: boolean | number, close?: boolean): IPathCreator
|
|
36
41
|
}
|
|
@@ -11,11 +11,13 @@ export interface IPlatform {
|
|
|
11
11
|
requestRender?(render: IFunction): void
|
|
12
12
|
canvas?: ILeaferCanvas
|
|
13
13
|
isWorker?: boolean
|
|
14
|
+
isMobile?: boolean
|
|
14
15
|
devicePixelRatio?: number
|
|
15
|
-
intWheelDeltaY?: boolean //
|
|
16
|
+
intWheelDeltaY?: boolean // firefox / Windows need
|
|
16
17
|
conicGradientSupport?: boolean
|
|
17
|
-
conicGradientRotate90?: boolean //
|
|
18
|
+
conicGradientRotate90?: boolean // firefox need rotate
|
|
18
19
|
fullImageShadow?: boolean // safari need
|
|
20
|
+
syncDomFont?: boolean // firefox need
|
|
19
21
|
layout?(target: ILeaf): void
|
|
20
22
|
realtimeLayout?: boolean
|
|
21
23
|
origin?: {
|
package/src/watcher/IWatcher.ts
CHANGED
|
@@ -18,7 +18,11 @@ export interface IWatcher extends IControl {
|
|
|
18
18
|
disabled: boolean
|
|
19
19
|
running: boolean
|
|
20
20
|
changed: boolean
|
|
21
|
-
|
|
21
|
+
|
|
22
|
+
hasVisible: boolean
|
|
23
|
+
hasAdd: boolean
|
|
24
|
+
hasRemove: boolean
|
|
25
|
+
readonly childrenChanged: boolean
|
|
22
26
|
|
|
23
27
|
config: IWatcherConfig
|
|
24
28
|
|