@leafer/interface 1.0.0-beta.8 → 1.0.0-rc.1
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 -5
- package/src/canvas/ICanvasManager.ts +1 -1
- package/src/canvas/IHitCanvasManager.ts +0 -1
- package/src/canvas/ILeaferCanvas.ts +9 -5
- package/src/data/IData.ts +1 -2
- package/src/data/ILeafData.ts +5 -5
- package/src/display/IBranch.ts +2 -1
- package/src/display/ILeaf.ts +104 -12
- package/src/display/module/ILeafBounds.ts +2 -0
- package/src/event/IUIEvent.ts +10 -5
- package/src/image/IImageManager.ts +11 -3
- package/src/image/ILeaferImage.ts +19 -1
- package/src/index.ts +3 -3
- package/src/interaction/IInteraction.ts +22 -6
- package/src/layout/ILeafLayout.ts +5 -3
- package/src/math/IMath.ts +7 -5
- package/src/path/IPathDrawer.ts +5 -0
- package/src/platform/IPlatform.ts +7 -3
- package/src/task/ITaskProcessor.ts +20 -4
- 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-
|
|
3
|
+
"version": "1.0.0-rc.1",
|
|
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
|
@@ -8,7 +8,6 @@ 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
|
-
import { IImageManager } from '../image/IImageManager'
|
|
12
11
|
import { IEventListenerId } from '../event/IEventer'
|
|
13
12
|
import { IObject } from '../data/IData'
|
|
14
13
|
import { IZoomView } from '../display/IView'
|
|
@@ -28,12 +27,14 @@ export interface ILeaferConfig extends IRendererConfig, ILeaferCanvasConfig, IIn
|
|
|
28
27
|
export interface ILeafer extends IZoomView, IControl {
|
|
29
28
|
|
|
30
29
|
readonly isApp: boolean
|
|
30
|
+
readonly app: ILeafer
|
|
31
31
|
parent?: IApp
|
|
32
32
|
|
|
33
33
|
running: boolean
|
|
34
|
+
created: boolean
|
|
34
35
|
ready: boolean
|
|
35
36
|
viewReady: boolean
|
|
36
|
-
|
|
37
|
+
viewCompleted: boolean
|
|
37
38
|
|
|
38
39
|
pixelRatio: number
|
|
39
40
|
|
|
@@ -50,20 +51,23 @@ export interface ILeafer extends IZoomView, IControl {
|
|
|
50
51
|
|
|
51
52
|
canvasManager: ICanvasManager
|
|
52
53
|
hitCanvasManager?: IHitCanvasManager
|
|
53
|
-
imageManager: IImageManager
|
|
54
54
|
|
|
55
55
|
autoLayout?: IAutoBounds
|
|
56
56
|
|
|
57
57
|
config: ILeaferConfig
|
|
58
58
|
|
|
59
59
|
__eventIds: IEventListenerId[]
|
|
60
|
+
__nextRenderWait: IFunction[]
|
|
60
61
|
|
|
61
62
|
init(userConfig?: ILeaferConfig, parentApp?: IApp): void
|
|
62
63
|
setZoomLayer(zoomLayer: ILeaf, moveLayer?: ILeaf): void
|
|
63
64
|
forceFullRender(): void
|
|
65
|
+
updateCursor(): void
|
|
64
66
|
resize(size: IScreenSizeData): void
|
|
65
|
-
|
|
66
|
-
|
|
67
|
+
|
|
68
|
+
waitReady(item: IFunction): void
|
|
69
|
+
waitViewReady(item: IFunction): void
|
|
70
|
+
waitViewCompleted(item: IFunction): void
|
|
67
71
|
}
|
|
68
72
|
|
|
69
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
|
|
@@ -12,7 +13,6 @@ export interface ILeaferCanvasConfig extends IAutoBoundsData {
|
|
|
12
13
|
pixelRatio?: number
|
|
13
14
|
smooth?: boolean
|
|
14
15
|
hittable?: boolean
|
|
15
|
-
offscreen?: boolean
|
|
16
16
|
webgl?: boolean
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -74,7 +74,7 @@ interface ICanvasMethod {
|
|
|
74
74
|
strokeRect(x: number, y: number, width: number, height: number): void
|
|
75
75
|
clearRect(x: number, y: number, width: number, height: number): void
|
|
76
76
|
|
|
77
|
-
transform(a: number, b
|
|
77
|
+
transform(a: number | IMatrixData, b?: number, c?: number, d?: number, e?: number, f?: number): void
|
|
78
78
|
translate(x: number, y: number): void
|
|
79
79
|
scale(x: number, y: number): void
|
|
80
80
|
rotate(angle: number): void
|
|
@@ -110,12 +110,15 @@ interface ICanvasMethod {
|
|
|
110
110
|
setStrokeOptions(options: ICanvasStrokeOptions): void
|
|
111
111
|
|
|
112
112
|
setWorld(matrix: IMatrixData, parentMatrix?: IMatrixData): void
|
|
113
|
+
useWorldTransform(worldTransform?: IMatrixData): void
|
|
113
114
|
|
|
114
115
|
setWorldShadow(x: number, y: number, blur: number, color?: string): void
|
|
115
116
|
setWorldBlur(blur: number): void
|
|
116
117
|
|
|
117
118
|
copyWorld(canvas: ILeaferCanvas, fromBounds?: IBoundsData, toBounds?: IBoundsData, blendMode?: string): void
|
|
119
|
+
copyWorldByReset(canvas: ILeaferCanvas, from?: IBoundsData, to?: IBoundsData, blendMode?: string): void
|
|
118
120
|
copyWorldToInner(canvas: ILeaferCanvas, fromWorld: IMatrixWithBoundsData, toInnerBounds: IBoundsData, blendMode?: string): void
|
|
121
|
+
|
|
119
122
|
useMask(maskCanvas: ILeaferCanvas, fromBounds?: IBoundsData, toBounds?: IBoundsData): void
|
|
120
123
|
useEraser(eraserCanvas: ILeaferCanvas, fromBounds?: IBoundsData, toBounds?: IBoundsData): void
|
|
121
124
|
|
|
@@ -157,8 +160,6 @@ export interface ILeaferCanvas extends ICanvasAttr, ICanvasMethod, IPathDrawer {
|
|
|
157
160
|
|
|
158
161
|
unreal?: boolean
|
|
159
162
|
|
|
160
|
-
offscreen: boolean
|
|
161
|
-
|
|
162
163
|
context: ICanvasContext2D
|
|
163
164
|
|
|
164
165
|
recycled?: boolean
|
|
@@ -168,7 +169,7 @@ export interface ILeaferCanvas extends ICanvasAttr, ICanvasMethod, IPathDrawer {
|
|
|
168
169
|
init(): void
|
|
169
170
|
|
|
170
171
|
toBlob(type?: string, quality?: number): Promise<IBlob>
|
|
171
|
-
toDataURL(type?: string, quality?: number): string
|
|
172
|
+
toDataURL(type?: string, quality?: number): string | Promise<string>
|
|
172
173
|
saveAs(filename: string, quality?: number): Promise<boolean>
|
|
173
174
|
|
|
174
175
|
startAutoLayout(autoBounds: IAutoBounds, listener: IResizeEventListener): void
|
|
@@ -178,12 +179,15 @@ export interface ILeaferCanvas extends ICanvasAttr, ICanvasMethod, IPathDrawer {
|
|
|
178
179
|
updateViewSize(): void
|
|
179
180
|
updateClientBounds(): void
|
|
180
181
|
|
|
182
|
+
setCursor(cursor: ICursorType | ICursorType[]): void
|
|
183
|
+
|
|
181
184
|
// other
|
|
182
185
|
isSameSize(options: ILeaferCanvasConfig): boolean
|
|
183
186
|
getSameCanvas(useSameWorldTransform?: boolean): ILeaferCanvas
|
|
184
187
|
getBiggerCanvas(addWidth: number, addHeight: number): ILeaferCanvas
|
|
185
188
|
recycle(): void
|
|
186
189
|
|
|
190
|
+
updateRender(): void
|
|
187
191
|
unrealCanvas(): void
|
|
188
192
|
destroy(): void
|
|
189
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
|
|
@@ -209,13 +287,17 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
|
|
|
209
287
|
__parentWait?: IFunction[]
|
|
210
288
|
__leaferWait?: IFunction[]
|
|
211
289
|
|
|
290
|
+
destroyed: boolean
|
|
291
|
+
|
|
212
292
|
waitParent(item: IFunction): void
|
|
213
293
|
waitLeafer(item: IFunction): void
|
|
294
|
+
nextRender(item: IFunction): void
|
|
214
295
|
|
|
215
296
|
__bindLeafer(leafer: ILeafer | null): void
|
|
216
297
|
|
|
217
298
|
set(data: IObject): void
|
|
218
|
-
|
|
299
|
+
toJSON(): IObject
|
|
300
|
+
toString(): string
|
|
219
301
|
|
|
220
302
|
// ILeafData ->
|
|
221
303
|
__setAttr(attrName: string, newValue: __Value): void
|
|
@@ -238,6 +320,8 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
|
|
|
238
320
|
__updateStrokeBounds(): void
|
|
239
321
|
__updateRenderBounds(): void
|
|
240
322
|
|
|
323
|
+
__updateNaturalSize(): void
|
|
324
|
+
|
|
241
325
|
__updateStrokeSpread(): number
|
|
242
326
|
__updateRenderSpread(): number
|
|
243
327
|
|
|
@@ -253,14 +337,22 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
|
|
|
253
337
|
getWorld(attrName: IMatrixDecompositionAttr): number
|
|
254
338
|
getBounds(type: ILayoutBoundsType, locationType?: ILayoutLocationType): IBoundsData
|
|
255
339
|
|
|
256
|
-
worldToLocal(world: IPointData, to?: IPointData,
|
|
257
|
-
localToWorld(local: IPointData, to?: IPointData,
|
|
258
|
-
worldToInner(world: IPointData, to?: IPointData,
|
|
259
|
-
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
|
|
260
351
|
|
|
261
352
|
move(x: number, y?: number): void
|
|
262
353
|
scaleOf(origin: IPointData, x: number, y?: number): void
|
|
263
354
|
rotateOf(origin: IPointData, rotation: number): void
|
|
355
|
+
skewOf(origin: IPointData, x: number, y: number): void
|
|
264
356
|
|
|
265
357
|
// ILeafHit ->
|
|
266
358
|
__hitWorld(point: IRadiusPointData): boolean
|
|
@@ -289,5 +381,5 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
|
|
|
289
381
|
|
|
290
382
|
__updateSortChildren(): void
|
|
291
383
|
add(child: ILeaf, index?: number): void
|
|
292
|
-
remove(child?: ILeaf): void
|
|
384
|
+
remove(child?: ILeaf, destroy?: boolean): void
|
|
293
385
|
}
|
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,10 +76,13 @@ 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 {
|
|
81
|
-
image
|
|
82
|
-
|
|
84
|
+
image?: ILeaferImage
|
|
85
|
+
attrName?: string
|
|
86
|
+
attrValue?: IObject
|
|
87
|
+
error?: string | IObject
|
|
83
88
|
}
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import { ILeaferImage, ILeaferImageConfig } from './ILeaferImage'
|
|
2
2
|
import { ITaskProcessor } from '../task/ITaskProcessor'
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
interface ILeaferImageMap {
|
|
5
|
+
[name: string]: ILeaferImage
|
|
6
|
+
}
|
|
4
7
|
|
|
5
8
|
export interface IImageManager {
|
|
9
|
+
map: ILeaferImageMap
|
|
10
|
+
recycledList: ILeaferImage[]
|
|
6
11
|
tasker: ITaskProcessor
|
|
12
|
+
patternTasker: ITaskProcessor
|
|
13
|
+
readonly isComplete: boolean
|
|
7
14
|
get(config: ILeaferImageConfig): ILeaferImage
|
|
8
|
-
|
|
9
|
-
|
|
15
|
+
recycle(image: ILeaferImage): void
|
|
16
|
+
clearRecycled(): void
|
|
17
|
+
destroy(): void
|
|
10
18
|
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { IObject } from '../data/IData'
|
|
2
|
+
import { InnerId } from '../event/IEventer'
|
|
3
|
+
import { IExportFileType } from '../file/IFileType'
|
|
2
4
|
|
|
3
5
|
export interface ILeaferImageConfig {
|
|
4
6
|
url: string
|
|
5
7
|
thumb?: string
|
|
8
|
+
format?: IExportFileType
|
|
6
9
|
}
|
|
7
10
|
|
|
8
11
|
export interface ILeaferImageOnLoaded {
|
|
@@ -14,12 +17,27 @@ export interface ILeaferImageOnError {
|
|
|
14
17
|
}
|
|
15
18
|
|
|
16
19
|
export interface ILeaferImage {
|
|
20
|
+
readonly innerId: InnerId
|
|
21
|
+
readonly url: string
|
|
22
|
+
|
|
17
23
|
view: unknown
|
|
18
24
|
width: number
|
|
19
25
|
height: number
|
|
26
|
+
|
|
27
|
+
isSVG: boolean
|
|
28
|
+
|
|
29
|
+
readonly completed: boolean
|
|
20
30
|
ready: boolean
|
|
21
|
-
|
|
31
|
+
error: IObject
|
|
32
|
+
loading: boolean
|
|
33
|
+
|
|
34
|
+
use: number
|
|
35
|
+
config: ILeaferImageConfig
|
|
36
|
+
|
|
37
|
+
load(onSuccess?: ILeaferImageOnLoaded, onError?: ILeaferImageOnError): number
|
|
38
|
+
unload(index: number, stopEvent?: boolean): void
|
|
22
39
|
getCanvas(width: number, height: number, opacity?: number, _filters?: IObject): unknown
|
|
40
|
+
destroy(): void
|
|
23
41
|
}
|
|
24
42
|
|
|
25
43
|
export type IImageStatus = 'wait' | 'thumb-loading' | 'thumb-success' | 'thumb-error' | 'loading' | 'success' | 'error'
|
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
|
|
|
@@ -26,7 +26,7 @@ export { ICanvasManager } from './canvas/ICanvasManager'
|
|
|
26
26
|
export { IHitCanvasManager } from './canvas/IHitCanvasManager'
|
|
27
27
|
export { IImageManager } from './image/IImageManager'
|
|
28
28
|
|
|
29
|
-
export { ITaskProcessor, ITaskProcessorConfig } from './task/ITaskProcessor'
|
|
29
|
+
export { ITaskProcessor, ITaskProcessorConfig, ITaskItem, ITaskOptions } from './task/ITaskProcessor'
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
export { IControl } from './control/IControl'
|
|
@@ -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,13 +1,14 @@
|
|
|
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'
|
|
10
10
|
import { ILeaferCanvas } from '../canvas/ILeaferCanvas'
|
|
11
|
+
import { IObject } from '../data/IData'
|
|
11
12
|
|
|
12
13
|
export interface IInteraction extends IControl {
|
|
13
14
|
target: ILeaf
|
|
@@ -16,21 +17,25 @@ export interface IInteraction extends IControl {
|
|
|
16
17
|
|
|
17
18
|
running: boolean
|
|
18
19
|
readonly dragging: boolean
|
|
20
|
+
readonly moveMode: boolean
|
|
19
21
|
|
|
20
22
|
config: IInteractionConfig
|
|
21
23
|
|
|
24
|
+
cursor: ICursorType | ICursorType[]
|
|
22
25
|
readonly hitRadius: number
|
|
26
|
+
|
|
23
27
|
shrinkCanvasBounds: IBounds
|
|
24
28
|
|
|
25
29
|
downData: IPointerEvent
|
|
30
|
+
hoverData: IPointerEvent
|
|
26
31
|
downTime: number
|
|
27
32
|
|
|
28
33
|
receive(event: any): void
|
|
29
34
|
|
|
30
|
-
pointerDown(data
|
|
31
|
-
pointerMove(data
|
|
35
|
+
pointerDown(data?: IPointerEvent, defaultPath?: boolean): void
|
|
36
|
+
pointerMove(data?: IPointerEvent): void
|
|
32
37
|
pointerMoveReal(data: IPointerEvent): void
|
|
33
|
-
pointerUp(data
|
|
38
|
+
pointerUp(data?: IPointerEvent): void
|
|
34
39
|
pointerCancel(): void
|
|
35
40
|
|
|
36
41
|
multiTouch(data: IUIEvent, list: IKeepTouchData[]): void
|
|
@@ -39,6 +44,15 @@ export interface IInteraction extends IControl {
|
|
|
39
44
|
zoom(data: IZoomEvent): void
|
|
40
45
|
rotate(data: IRotateEvent): void
|
|
41
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
|
+
|
|
42
56
|
emit(type: string, data: IUIEvent, path?: ILeafList, excludePath?: ILeafList): void
|
|
43
57
|
}
|
|
44
58
|
|
|
@@ -51,6 +65,7 @@ export interface IInteractionConfig {
|
|
|
51
65
|
pointer?: IPointerConfig
|
|
52
66
|
zoom?: IZoomConfig
|
|
53
67
|
move?: IMoveConfig
|
|
68
|
+
eventer?: IObject
|
|
54
69
|
}
|
|
55
70
|
|
|
56
71
|
export interface IZoomConfig {
|
|
@@ -59,6 +74,7 @@ export interface IZoomConfig {
|
|
|
59
74
|
}
|
|
60
75
|
|
|
61
76
|
export interface IMoveConfig {
|
|
77
|
+
holdSpaceKey?: boolean
|
|
62
78
|
dragEmpty?: boolean
|
|
63
79
|
dragOut?: boolean
|
|
64
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'
|
|
@@ -10,7 +10,7 @@ export interface ILeafLayout {
|
|
|
10
10
|
|
|
11
11
|
useZoomProxy: boolean
|
|
12
12
|
|
|
13
|
-
//
|
|
13
|
+
// inner
|
|
14
14
|
|
|
15
15
|
boxBounds: IBoundsData // | content + padding |
|
|
16
16
|
strokeBounds: IBoundsData // | boxBounds + border |
|
|
@@ -55,6 +55,7 @@ export interface ILeafLayout {
|
|
|
55
55
|
// keep state
|
|
56
56
|
affectScaleOrRotation: boolean
|
|
57
57
|
affectRotation: boolean
|
|
58
|
+
affectChildrenSort?: boolean
|
|
58
59
|
|
|
59
60
|
strokeSpread: number
|
|
60
61
|
renderSpread: number
|
|
@@ -64,7 +65,6 @@ export interface ILeafLayout {
|
|
|
64
65
|
checkUpdate(force?: boolean): void
|
|
65
66
|
|
|
66
67
|
getTransform(locationType: ILayoutLocationType): IMatrixData
|
|
67
|
-
decomposeTransform(locationType: ILayoutLocationType): IMatrixDecompositionData
|
|
68
68
|
getBounds(type: ILayoutBoundsType, locationType: ILayoutLocationType): IBoundsData
|
|
69
69
|
|
|
70
70
|
// 独立 / 引用 boxBounds
|
|
@@ -88,5 +88,7 @@ export interface ILeafLayout {
|
|
|
88
88
|
surfaceChange(): void
|
|
89
89
|
opacityChange(): void
|
|
90
90
|
|
|
91
|
+
childrenSortChange(): void
|
|
92
|
+
|
|
91
93
|
destroy(): void
|
|
92
94
|
}
|