@leafer/interface 1.0.0-rc.8 → 1.0.0
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 +1 -1
- package/src/app/ILeafer.ts +21 -11
- package/src/canvas/ICanvas.ts +7 -2
- package/src/canvas/IHitCanvasManager.ts +3 -3
- package/src/canvas/ILeaferCanvas.ts +22 -10
- package/src/data/IData.ts +9 -1
- package/src/data/ILeafData.ts +5 -5
- package/src/display/IBranch.ts +2 -1
- package/src/display/ILeaf.ts +375 -90
- package/src/display/IView.ts +2 -3
- package/src/display/module/IBranchRender.ts +2 -2
- package/src/display/module/ILeafBounds.ts +1 -0
- package/src/display/module/ILeafDataProxy.ts +1 -1
- package/src/display/module/ILeafEventer.ts +1 -1
- package/src/display/module/ILeafHit.ts +4 -1
- package/src/display/module/ILeafRender.ts +2 -1
- package/src/event/IEventer.ts +1 -1
- package/src/event/IUIEvent.ts +8 -1
- package/src/file/IExport.ts +41 -0
- package/src/file/IFileType.ts +1 -1
- package/src/function/IFunction.ts +9 -0
- package/src/image/IImageManager.ts +2 -1
- package/src/image/ILeaferImage.ts +13 -0
- package/src/index.ts +11 -10
- package/src/interaction/ICursor.ts +16 -0
- package/src/interaction/IInteraction.ts +32 -5
- package/src/layout/ILeafLayout.ts +24 -11
- package/src/math/IMath.ts +52 -7
- package/src/path/IPathDrawer.ts +6 -3
- package/src/platform/IPlatform.ts +9 -3
- package/src/renderer/IRenderer.ts +3 -2
- package/src/selector/ISelector.ts +21 -10
- package/types/index.d.ts +658 -298
- package/src/display/module/ILeafMask.ts +0 -12
package/types/index.d.ts
CHANGED
|
@@ -1,102 +1,33 @@
|
|
|
1
1
|
import { ILeaferCanvas as ILeaferCanvas$1, IScreenSizeData as IScreenSizeData$1 } from '@leafer/interface';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
type IValue = INumber | IBoolean | IString | IObject;
|
|
7
|
-
type ITimer = any;
|
|
8
|
-
type IPathString = string;
|
|
9
|
-
interface IObject {
|
|
10
|
-
[name: string]: any;
|
|
11
|
-
}
|
|
12
|
-
interface IBooleanMap {
|
|
13
|
-
[name: string]: boolean;
|
|
14
|
-
}
|
|
15
|
-
interface INumberMap {
|
|
16
|
-
[name: string]: number;
|
|
17
|
-
}
|
|
18
|
-
interface IStringMap {
|
|
19
|
-
[name: string]: string;
|
|
20
|
-
}
|
|
21
|
-
interface IDataTypeHandle {
|
|
22
|
-
(target: any): void;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
interface ILeafMap {
|
|
26
|
-
[name: string]: ILeaf;
|
|
27
|
-
}
|
|
28
|
-
interface ILeafArrayMap {
|
|
29
|
-
[name: string]: ILeaf[];
|
|
30
|
-
}
|
|
31
|
-
type ILeafListItemCallback = (item: ILeaf, index?: number) => void;
|
|
32
|
-
interface ILeafList {
|
|
33
|
-
list: ILeaf[];
|
|
34
|
-
keys: INumberMap;
|
|
35
|
-
readonly length: number;
|
|
36
|
-
has(leaf: ILeaf): boolean;
|
|
37
|
-
indexAt(index: number): ILeaf;
|
|
38
|
-
indexOf(leaf: ILeaf): number;
|
|
39
|
-
add(leaf: ILeaf): void;
|
|
40
|
-
addAt(leaf: ILeaf, index: number): void;
|
|
41
|
-
addList(list: ILeaf[]): void;
|
|
42
|
-
remove(leaf: ILeaf): void;
|
|
43
|
-
forEach(itemCallback: ILeafListItemCallback): void;
|
|
44
|
-
sort(reverse?: boolean): void;
|
|
45
|
-
clone(): ILeafList;
|
|
46
|
-
update(): void;
|
|
47
|
-
reset(): void;
|
|
48
|
-
destroy(): void;
|
|
49
|
-
}
|
|
50
|
-
interface ILeafLevelList {
|
|
51
|
-
levelMap: ILeafArrayMap;
|
|
52
|
-
keys: INumberMap;
|
|
53
|
-
levels: number[];
|
|
54
|
-
readonly length: number;
|
|
55
|
-
has(leaf: ILeaf): boolean;
|
|
56
|
-
without(leaf: ILeaf): boolean;
|
|
57
|
-
sort(reverse?: boolean): void;
|
|
58
|
-
addList(list: ILeaf[]): void;
|
|
59
|
-
add(leaf: ILeaf): void;
|
|
60
|
-
forEach(itemCallback: ILeafListItemCallback): void;
|
|
61
|
-
reset(): void;
|
|
62
|
-
destroy(): void;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
interface IControl {
|
|
66
|
-
start(): void;
|
|
67
|
-
stop(): void;
|
|
68
|
-
destroy(): void;
|
|
3
|
+
interface IPointData {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
69
6
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
7
|
+
interface IUnitPointData {
|
|
8
|
+
type?: 'percent' | 'px';
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
73
11
|
}
|
|
74
|
-
interface
|
|
12
|
+
interface IFromToData {
|
|
13
|
+
from: IPointData;
|
|
14
|
+
to: IPointData;
|
|
75
15
|
}
|
|
76
|
-
interface
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
disabled: boolean;
|
|
80
|
-
running: boolean;
|
|
81
|
-
changed: boolean;
|
|
82
|
-
hasVisible: boolean;
|
|
83
|
-
hasAdd: boolean;
|
|
84
|
-
hasRemove: boolean;
|
|
85
|
-
readonly childrenChanged: boolean;
|
|
86
|
-
config: IWatcherConfig;
|
|
87
|
-
updatedList: ILeafList;
|
|
88
|
-
disable(): void;
|
|
89
|
-
update(): void;
|
|
16
|
+
interface IScrollPointData {
|
|
17
|
+
scrollX: number;
|
|
18
|
+
scrollY: number;
|
|
90
19
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
y: number;
|
|
20
|
+
interface IClientPointData {
|
|
21
|
+
clientX: number;
|
|
22
|
+
clientY: number;
|
|
95
23
|
}
|
|
96
24
|
interface IPoint extends IPointData {
|
|
97
25
|
set(x?: number | IPointData, y?: number): IPoint;
|
|
98
26
|
get(): IPointData;
|
|
99
27
|
clone(): IPoint;
|
|
28
|
+
move(x: number, y: number): IPoint;
|
|
29
|
+
scale(scaleX: number, scaleY?: number): IPoint;
|
|
30
|
+
scaleOf(origin: IPointData, scaleX: number, scaleY?: number): IPoint;
|
|
100
31
|
rotate(rotation: number, origin?: IPointData): IPoint;
|
|
101
32
|
rotateOf(origin: IPointData, rotation: number): IPoint;
|
|
102
33
|
getRotation(origin: IPointData, to: IPointData, toOrigin?: IPointData): number;
|
|
@@ -104,7 +35,7 @@ interface IPoint extends IPointData {
|
|
|
104
35
|
toOuterOf(matrix: IMatrixData, to?: IPointData): IPoint;
|
|
105
36
|
getCenter(to: IPointData): IPoint;
|
|
106
37
|
getDistance(to: IPointData): number;
|
|
107
|
-
getDistancePoint(to: IPointData, distance: number): IPoint;
|
|
38
|
+
getDistancePoint(to: IPointData, distance: number, changeTo?: boolean): IPoint;
|
|
108
39
|
getAngle(to: IPointData): number;
|
|
109
40
|
getAtan2(to: IPointData): number;
|
|
110
41
|
reset(): IPoint;
|
|
@@ -135,19 +66,25 @@ interface IBounds extends IBoundsData, ITwoPointBoundsData {
|
|
|
135
66
|
set(x?: number | IBoundsData, y?: number, width?: number, height?: number): IBounds;
|
|
136
67
|
get(): IBoundsData;
|
|
137
68
|
clone(): IBounds;
|
|
69
|
+
move(x: number, y: number): IBounds;
|
|
138
70
|
scale(scaleX: number, scaleY?: number): IBounds;
|
|
139
71
|
scaleOf(origin: IPointData, scaleX: number, scaleY?: number): IBounds;
|
|
140
72
|
toOuterOf(matrix: IMatrixData, to?: IBoundsData): IBounds;
|
|
141
|
-
|
|
142
|
-
|
|
73
|
+
toInnerOf(matrix: IMatrixData, to?: IBoundsData): IBounds;
|
|
74
|
+
getFitMatrix(put: IBoundsData, baseScale?: number): IMatrix;
|
|
75
|
+
spread(fourNumber: IFourNumber): IBounds;
|
|
76
|
+
shrink(fourNumber: IFourNumber): IBounds;
|
|
143
77
|
ceil(): IBounds;
|
|
144
78
|
unsign(): IBounds;
|
|
79
|
+
float(maxLength?: number): IBounds;
|
|
145
80
|
add(bounds: IBoundsData): IBounds;
|
|
146
81
|
addList(boundsList: IBoundsData[]): IBounds;
|
|
147
82
|
setList(boundsList: IBoundsData[]): IBounds;
|
|
148
83
|
addListWithFn(list: IObject[], boundsDataHandle: IBoundsDataFn): IBounds;
|
|
149
84
|
setListWithFn(list: IObject[], boundsDataHandle: IBoundsDataFn): IBounds;
|
|
85
|
+
setPoint(point: IPointData): IBounds;
|
|
150
86
|
setPoints(points: IPointData[]): IBounds;
|
|
87
|
+
addPoint(point: IPointData): IBounds;
|
|
151
88
|
getPoints(): IPointData[];
|
|
152
89
|
hitPoint(point: IPointData, pointMatrix?: IMatrixData): boolean;
|
|
153
90
|
hitRadiusPoint(point: IRadiusPointData, pointMatrix?: IMatrixWithLayoutData): boolean;
|
|
@@ -165,11 +102,13 @@ interface ITwoPointBoundsData {
|
|
|
165
102
|
maxX: number;
|
|
166
103
|
maxY: number;
|
|
167
104
|
}
|
|
168
|
-
interface
|
|
105
|
+
interface IAutoBoxData {
|
|
169
106
|
top?: number;
|
|
170
107
|
right?: number;
|
|
171
108
|
bottom?: number;
|
|
172
109
|
left?: number;
|
|
110
|
+
}
|
|
111
|
+
interface IAutoBoundsData extends IAutoBoxData {
|
|
173
112
|
width?: number;
|
|
174
113
|
height?: number;
|
|
175
114
|
}
|
|
@@ -202,13 +141,15 @@ interface ILayoutData extends IScaleRotationData, ISkewData, IPointData {
|
|
|
202
141
|
type ILayoutAttr = 'x' | 'y' | 'scaleX' | 'scaleY' | 'rotation' | 'skewX' | 'skewY';
|
|
203
142
|
interface ILayoutBoundsData extends ILayoutData, IBoundsData {
|
|
204
143
|
}
|
|
205
|
-
interface IMatrix extends
|
|
144
|
+
interface IMatrix extends IMatrixWithScaleData {
|
|
206
145
|
set(a: number | IMatrixData, b: number, c: number, d: number, e: number, f: number): IMatrix;
|
|
146
|
+
setWith(dataWithScale: IMatrixWithScaleData): IMatrix;
|
|
207
147
|
get(): IMatrixData;
|
|
208
148
|
clone(): IMatrix;
|
|
209
149
|
translate(x: number, y: number): IMatrix;
|
|
210
150
|
translateInner(x: number, y: number): IMatrix;
|
|
211
151
|
scale(x: number, y?: number): IMatrix;
|
|
152
|
+
scaleWith(x: number, y?: number): IMatrix;
|
|
212
153
|
scaleOfOuter(origin: IPointData, x: number, y?: number): IMatrix;
|
|
213
154
|
scaleOfInner(origin: IPointData, x: number, y?: number): IMatrix;
|
|
214
155
|
rotate(angle: number): IMatrix;
|
|
@@ -222,19 +163,120 @@ interface IMatrix extends IMatrixData {
|
|
|
222
163
|
divide(child: IMatrixData): IMatrix;
|
|
223
164
|
divideParent(parent: IMatrixData): IMatrix;
|
|
224
165
|
invert(): IMatrix;
|
|
166
|
+
invertWith(): IMatrix;
|
|
225
167
|
toOuterPoint(inner: IPointData, to?: IPointData, distance?: boolean): void;
|
|
226
168
|
toInnerPoint(outer: IPointData, to?: IPointData, distance?: boolean): void;
|
|
227
169
|
setLayout(data: ILayoutData, origin?: IPointData): IMatrix;
|
|
228
170
|
getLayout(origin?: IPointData, firstSkewY?: boolean): ILayoutData;
|
|
171
|
+
withScale(scaleX?: number, scaleY?: number): IMatrixWithScaleData;
|
|
229
172
|
reset(): void;
|
|
230
173
|
}
|
|
231
174
|
interface IMatrixWithBoundsData extends IMatrixData, IBoundsData {
|
|
232
175
|
}
|
|
233
176
|
interface IMatrixWithScaleData extends IMatrixData, IScaleData {
|
|
234
177
|
}
|
|
178
|
+
interface IMatrixWithOptionScaleData extends IMatrixData {
|
|
179
|
+
scaleX?: number;
|
|
180
|
+
scaleY?: number;
|
|
181
|
+
}
|
|
182
|
+
interface IMatrixWithBoundsScaleData extends IMatrixData, IBoundsData, IScaleData {
|
|
183
|
+
}
|
|
235
184
|
interface IMatrixWithLayoutData extends IMatrixData, ILayoutBoundsData {
|
|
236
185
|
}
|
|
237
186
|
|
|
187
|
+
type INumber = number;
|
|
188
|
+
type IBoolean = boolean;
|
|
189
|
+
type IString = string;
|
|
190
|
+
type IValue = INumber | IBoolean | IString | IObject;
|
|
191
|
+
type ITimer = any;
|
|
192
|
+
type IPathString = string;
|
|
193
|
+
type IFourNumber = number | number[];
|
|
194
|
+
interface IObject {
|
|
195
|
+
[name: string]: any;
|
|
196
|
+
}
|
|
197
|
+
interface IBooleanMap {
|
|
198
|
+
[name: string]: boolean;
|
|
199
|
+
}
|
|
200
|
+
interface INumberMap {
|
|
201
|
+
[name: string]: number;
|
|
202
|
+
}
|
|
203
|
+
interface IStringMap {
|
|
204
|
+
[name: string]: string;
|
|
205
|
+
}
|
|
206
|
+
interface IPointDataMap {
|
|
207
|
+
[name: string]: IPointData;
|
|
208
|
+
}
|
|
209
|
+
interface IDataTypeHandle {
|
|
210
|
+
(target: any): void;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
interface ILeafMap {
|
|
214
|
+
[name: string]: ILeaf;
|
|
215
|
+
}
|
|
216
|
+
interface ILeafArrayMap {
|
|
217
|
+
[name: string]: ILeaf[];
|
|
218
|
+
}
|
|
219
|
+
type ILeafListItemCallback = (item: ILeaf, index?: number) => void;
|
|
220
|
+
interface ILeafList {
|
|
221
|
+
list: ILeaf[];
|
|
222
|
+
keys: INumberMap;
|
|
223
|
+
readonly length: number;
|
|
224
|
+
has(leaf: ILeaf): boolean;
|
|
225
|
+
indexAt(index: number): ILeaf;
|
|
226
|
+
indexOf(leaf: ILeaf): number;
|
|
227
|
+
add(leaf: ILeaf): void;
|
|
228
|
+
addAt(leaf: ILeaf, index: number): void;
|
|
229
|
+
addList(list: ILeaf[]): void;
|
|
230
|
+
remove(leaf: ILeaf): void;
|
|
231
|
+
forEach(itemCallback: ILeafListItemCallback): void;
|
|
232
|
+
sort(reverse?: boolean): void;
|
|
233
|
+
clone(): ILeafList;
|
|
234
|
+
update(): void;
|
|
235
|
+
reset(): void;
|
|
236
|
+
destroy(): void;
|
|
237
|
+
}
|
|
238
|
+
interface ILeafLevelList {
|
|
239
|
+
levelMap: ILeafArrayMap;
|
|
240
|
+
keys: INumberMap;
|
|
241
|
+
levels: number[];
|
|
242
|
+
readonly length: number;
|
|
243
|
+
has(leaf: ILeaf): boolean;
|
|
244
|
+
without(leaf: ILeaf): boolean;
|
|
245
|
+
sort(reverse?: boolean): void;
|
|
246
|
+
addList(list: ILeaf[]): void;
|
|
247
|
+
add(leaf: ILeaf): void;
|
|
248
|
+
forEach(itemCallback: ILeafListItemCallback): void;
|
|
249
|
+
reset(): void;
|
|
250
|
+
destroy(): void;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
interface IControl {
|
|
254
|
+
start(): void;
|
|
255
|
+
stop(): void;
|
|
256
|
+
destroy(): void;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
interface IWatchEventData {
|
|
260
|
+
updatedList: ILeafList;
|
|
261
|
+
}
|
|
262
|
+
interface IWatcherConfig {
|
|
263
|
+
}
|
|
264
|
+
interface IWatcher extends IControl {
|
|
265
|
+
target: ILeaf;
|
|
266
|
+
totalTimes: number;
|
|
267
|
+
disabled: boolean;
|
|
268
|
+
running: boolean;
|
|
269
|
+
changed: boolean;
|
|
270
|
+
hasVisible: boolean;
|
|
271
|
+
hasAdd: boolean;
|
|
272
|
+
hasRemove: boolean;
|
|
273
|
+
readonly childrenChanged: boolean;
|
|
274
|
+
config: IWatcherConfig;
|
|
275
|
+
updatedList: ILeafList;
|
|
276
|
+
disable(): void;
|
|
277
|
+
update(): void;
|
|
278
|
+
}
|
|
279
|
+
|
|
238
280
|
interface ILayoutChangedData {
|
|
239
281
|
matrixList: ILeaf[];
|
|
240
282
|
boundsList: ILeaf[];
|
|
@@ -346,7 +388,7 @@ interface IKeepTouchData {
|
|
|
346
388
|
type ILeafEventerModule = ILeafEventer & ThisType<ILeaf>;
|
|
347
389
|
interface ILeafEventer {
|
|
348
390
|
on?(type: string | string[], listener: IEventListener, options?: IEventListenerOptions | boolean): void;
|
|
349
|
-
off?(type
|
|
391
|
+
off?(type?: string | string[], listener?: IEventListener, options?: IEventListenerOptions | boolean): void;
|
|
350
392
|
on_?(type: string | string[], listener: IEventListener, bind?: IObject, options?: IEventListenerOptions | boolean): IEventListenerId;
|
|
351
393
|
off_?(id: IEventListenerId | IEventListenerId[]): void;
|
|
352
394
|
once?(type: string | string[], listener: IEventListener, capture?: boolean): void;
|
|
@@ -361,6 +403,12 @@ interface IFunction {
|
|
|
361
403
|
interface INumberFunction {
|
|
362
404
|
(...arg: any): number;
|
|
363
405
|
}
|
|
406
|
+
interface IStringFunction {
|
|
407
|
+
(...arg: any): string;
|
|
408
|
+
}
|
|
409
|
+
interface IObjectFunction {
|
|
410
|
+
(...arg: any): IObject;
|
|
411
|
+
}
|
|
364
412
|
interface IPointDataFunction {
|
|
365
413
|
(...arg: any): IPointData;
|
|
366
414
|
}
|
|
@@ -394,7 +442,7 @@ interface IEventer extends ILeafEventer {
|
|
|
394
442
|
__captureMap?: IEventListenerMap;
|
|
395
443
|
__bubbleMap?: IEventListenerMap;
|
|
396
444
|
on(type: string | string[], listener: IEventListener, options?: IEventListenerOptions | boolean): void;
|
|
397
|
-
off(type
|
|
445
|
+
off(type?: string | string[], listener?: IEventListener, options?: IEventListenerOptions | boolean): void;
|
|
398
446
|
on_(type: string | string[], listener: IEventListener, bind?: IObject, options?: IEventListenerOptions | boolean): IEventListenerId;
|
|
399
447
|
off_(id: IEventListenerId | IEventListenerId[]): void;
|
|
400
448
|
once(type: string | string[], listener: IEventListener): void;
|
|
@@ -489,21 +537,23 @@ interface CanvasPathDrawingStyles {
|
|
|
489
537
|
interface CanvasPattern {
|
|
490
538
|
setTransform(transform?: DOMMatrix2DInit): void;
|
|
491
539
|
}
|
|
540
|
+
type ICanvasPattern = CanvasPattern;
|
|
492
541
|
interface CanvasRect {
|
|
493
542
|
clearRect(x: number, y: number, w: number, h: number): void;
|
|
494
543
|
fillRect(x: number, y: number, w: number, h: number): void;
|
|
495
544
|
strokeRect(x: number, y: number, w: number, h: number): void;
|
|
496
545
|
}
|
|
497
546
|
type PredefinedColorSpace = 'display-p3' | 'srgb';
|
|
498
|
-
interface
|
|
547
|
+
interface ICanvasRenderingContext2DSettings {
|
|
499
548
|
alpha?: boolean;
|
|
500
549
|
colorSpace?: PredefinedColorSpace;
|
|
501
550
|
desynchronized?: boolean;
|
|
502
551
|
willReadFrequently?: boolean;
|
|
503
552
|
}
|
|
553
|
+
type ICanvasContext2DSettings = ICanvasRenderingContext2DSettings;
|
|
504
554
|
interface ICanvasContext2D extends CanvasCompositing, CanvasDrawImage, CanvasDrawPath, CanvasFillStrokeStyles, CanvasFilters, CanvasImageData, CanvasImageSmoothing, CanvasPath, CanvasPathDrawingStyles, CanvasRect, CanvasShadowStyles, CanvasState, CanvasText, CanvasTextDrawingStyles, CanvasTransform, CanvasUserInterface {
|
|
505
555
|
readonly canvas: HTMLCanvasElement;
|
|
506
|
-
getContextAttributes():
|
|
556
|
+
getContextAttributes(): ICanvasRenderingContext2DSettings;
|
|
507
557
|
}
|
|
508
558
|
interface CanvasShadowStyles {
|
|
509
559
|
shadowBlur: number;
|
|
@@ -723,22 +773,24 @@ interface IPathDrawer {
|
|
|
723
773
|
rect(x: number, y: number, width: number, height: number): void;
|
|
724
774
|
roundRect(x: number, y: number, width: number, height: number, radius?: number | number[]): void;
|
|
725
775
|
}
|
|
726
|
-
interface IPathCreator {
|
|
776
|
+
interface IPathCreator extends IPathDrawer {
|
|
727
777
|
path: IPathCommandData;
|
|
778
|
+
__path: IPathCommandData;
|
|
728
779
|
beginPath(): IPathCreator;
|
|
729
780
|
moveTo(x: number, y: number): IPathCreator;
|
|
730
781
|
lineTo(x: number, y: number): IPathCreator;
|
|
731
782
|
bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): IPathCreator;
|
|
732
783
|
quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): IPathCreator;
|
|
733
784
|
closePath(): IPathCreator;
|
|
734
|
-
arc(x: number, y: number, radius: number, startAngle
|
|
785
|
+
arc(x: number, y: number, radius: number, startAngle?: number, endAngle?: number, anticlockwise?: boolean): IPathCreator;
|
|
735
786
|
arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): IPathCreator;
|
|
736
|
-
ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation
|
|
787
|
+
ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation?: number, startAngle?: number, endAngle?: number, anticlockwise?: boolean): IPathCreator;
|
|
737
788
|
rect(x: number, y: number, width: number, height: number): IPathCreator;
|
|
738
789
|
roundRect(x: number, y: number, width: number, height: number, radius?: number | number[]): IPathCreator;
|
|
739
790
|
drawEllipse(x: number, y: number, radiusX: number, radiusY: number, rotation?: number, startAngle?: number, endAngle?: number, anticlockwise?: boolean): IPathCreator;
|
|
740
791
|
drawArc(x: number, y: number, radius: number, startAngle?: number, endAngle?: number, anticlockwise?: boolean): IPathCreator;
|
|
741
792
|
drawPoints(points: number[], curve?: boolean | number, close?: boolean): IPathCreator;
|
|
793
|
+
clearPath(): IPathCreator;
|
|
742
794
|
}
|
|
743
795
|
|
|
744
796
|
interface ICanvasManager {
|
|
@@ -750,6 +802,112 @@ interface ICanvasManager {
|
|
|
750
802
|
destroy(): void;
|
|
751
803
|
}
|
|
752
804
|
|
|
805
|
+
type IExportImageType = 'jpg' | 'png' | 'webp';
|
|
806
|
+
type IExportFileType = IExportImageType | 'svg' | 'pdf' | 'json';
|
|
807
|
+
|
|
808
|
+
type ILocationType = 'world' | 'page' | 'local' | 'inner';
|
|
809
|
+
type IBoundsType = 'content' | 'box' | 'stroke' | 'render';
|
|
810
|
+
interface ILeafLayout {
|
|
811
|
+
leaf: ILeaf;
|
|
812
|
+
proxyZoom: boolean;
|
|
813
|
+
contentBounds: IBoundsData;
|
|
814
|
+
boxBounds: IBoundsData;
|
|
815
|
+
strokeBounds: IBoundsData;
|
|
816
|
+
renderBounds: IBoundsData;
|
|
817
|
+
localContentBounds: IBoundsData;
|
|
818
|
+
localStrokeBounds: IBoundsData;
|
|
819
|
+
localRenderBounds: IBoundsData;
|
|
820
|
+
worldContentBounds: IBoundsData;
|
|
821
|
+
worldBoxBounds: IBoundsData;
|
|
822
|
+
worldStrokeBounds: IBoundsData;
|
|
823
|
+
resized: boolean;
|
|
824
|
+
waitAutoLayout: boolean;
|
|
825
|
+
matrixChanged: boolean;
|
|
826
|
+
scaleChanged: boolean;
|
|
827
|
+
rotationChanged: boolean;
|
|
828
|
+
boundsChanged: boolean;
|
|
829
|
+
boxChanged: boolean;
|
|
830
|
+
strokeChanged: boolean;
|
|
831
|
+
renderChanged: boolean;
|
|
832
|
+
localBoxChanged: boolean;
|
|
833
|
+
surfaceChanged: boolean;
|
|
834
|
+
opacityChanged: boolean;
|
|
835
|
+
hitCanvasChanged: boolean;
|
|
836
|
+
childrenSortChanged?: boolean;
|
|
837
|
+
affectScaleOrRotation: boolean;
|
|
838
|
+
affectRotation: boolean;
|
|
839
|
+
affectChildrenSort?: boolean;
|
|
840
|
+
strokeSpread: number;
|
|
841
|
+
strokeBoxSpread: number;
|
|
842
|
+
renderSpread: number;
|
|
843
|
+
renderShapeSpread: number;
|
|
844
|
+
a: number;
|
|
845
|
+
b: number;
|
|
846
|
+
c: number;
|
|
847
|
+
d: number;
|
|
848
|
+
e: number;
|
|
849
|
+
f: number;
|
|
850
|
+
x: number;
|
|
851
|
+
y: number;
|
|
852
|
+
width: number;
|
|
853
|
+
height: number;
|
|
854
|
+
createLocal(): void;
|
|
855
|
+
update(): void;
|
|
856
|
+
getTransform(relative?: ILocationType | ILeaf): IMatrixData;
|
|
857
|
+
getBounds(type?: IBoundsType, relative?: ILocationType | ILeaf): IBoundsData;
|
|
858
|
+
getLayoutBounds(type?: IBoundsType, relative?: ILocationType | ILeaf, unscale?: boolean): ILayoutBoundsData;
|
|
859
|
+
getLayoutPoints(type?: IBoundsType, relative?: ILocationType | ILeaf): IPointData[];
|
|
860
|
+
shrinkContent(): void;
|
|
861
|
+
spreadStroke(): void;
|
|
862
|
+
spreadRender(): void;
|
|
863
|
+
shrinkContentCancel(): void;
|
|
864
|
+
spreadStrokeCancel(): void;
|
|
865
|
+
spreadRenderCancel(): void;
|
|
866
|
+
boxChange(): void;
|
|
867
|
+
localBoxChange(): void;
|
|
868
|
+
strokeChange(): void;
|
|
869
|
+
renderChange(): void;
|
|
870
|
+
scaleChange(): void;
|
|
871
|
+
rotationChange(): void;
|
|
872
|
+
matrixChange(): void;
|
|
873
|
+
surfaceChange(): void;
|
|
874
|
+
opacityChange(): void;
|
|
875
|
+
childrenSortChange(): void;
|
|
876
|
+
destroy(): void;
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
interface IExportOptions {
|
|
880
|
+
quality?: number;
|
|
881
|
+
blob?: boolean;
|
|
882
|
+
scale?: number;
|
|
883
|
+
smooth?: boolean;
|
|
884
|
+
pixelRatio?: number;
|
|
885
|
+
slice?: boolean;
|
|
886
|
+
trim?: boolean;
|
|
887
|
+
fill?: string;
|
|
888
|
+
screenshot?: IBoundsData | boolean;
|
|
889
|
+
relative?: ILocationType | ILeaf;
|
|
890
|
+
json?: IJSONOptions;
|
|
891
|
+
contextSettings?: ICanvasContext2DSettings;
|
|
892
|
+
onCanvas?: IExportOnCanvasFunction;
|
|
893
|
+
}
|
|
894
|
+
interface IJSONOptions {
|
|
895
|
+
matrix?: boolean;
|
|
896
|
+
}
|
|
897
|
+
interface IExportResult {
|
|
898
|
+
data: ILeaferCanvas | IBlob | string | boolean;
|
|
899
|
+
width?: number;
|
|
900
|
+
height?: number;
|
|
901
|
+
renderBounds?: IBoundsData;
|
|
902
|
+
trimBounds?: IBoundsData;
|
|
903
|
+
}
|
|
904
|
+
interface IExportResultFunction {
|
|
905
|
+
(data: IExportResult): void;
|
|
906
|
+
}
|
|
907
|
+
interface IExportOnCanvasFunction {
|
|
908
|
+
(data: ILeaferCanvas): void;
|
|
909
|
+
}
|
|
910
|
+
|
|
753
911
|
interface ILeaferCanvasConfig extends IAutoBoundsData {
|
|
754
912
|
view?: string | IObject;
|
|
755
913
|
fill?: string;
|
|
@@ -757,6 +915,7 @@ interface ILeaferCanvasConfig extends IAutoBoundsData {
|
|
|
757
915
|
smooth?: boolean;
|
|
758
916
|
hittable?: boolean;
|
|
759
917
|
webgl?: boolean;
|
|
918
|
+
contextSettings?: ICanvasContext2DSettings;
|
|
760
919
|
}
|
|
761
920
|
type IHitCanvasConfig = ILeaferCanvasConfig;
|
|
762
921
|
interface ICanvasStrokeOptions {
|
|
@@ -768,6 +927,10 @@ interface ICanvasStrokeOptions {
|
|
|
768
927
|
dashOffset?: number;
|
|
769
928
|
miterLimit?: number;
|
|
770
929
|
}
|
|
930
|
+
interface ICanvasCacheOptions extends ICanvasStrokeOptions {
|
|
931
|
+
fillStyle?: string | object;
|
|
932
|
+
strokeStyle?: string | object;
|
|
933
|
+
}
|
|
771
934
|
interface ICanvasAttr extends ICanvasStrokeOptions, IObject {
|
|
772
935
|
smooth: boolean;
|
|
773
936
|
smoothLevel: string;
|
|
@@ -822,6 +985,7 @@ interface ICanvasMethod {
|
|
|
822
985
|
restoreBlendMode(): void;
|
|
823
986
|
hitFill(point: IPointData, fillRule?: string): boolean;
|
|
824
987
|
hitStroke(point: IPointData, strokeWidth?: number): boolean;
|
|
988
|
+
hitPixel(radiusPoint: IRadiusPointData, offset?: IPointData, scale?: number): boolean;
|
|
825
989
|
setStroke(strokeStyle: string | object, strokeWidth: number, options?: ICanvasStrokeOptions): void;
|
|
826
990
|
setStrokeOptions(options: ICanvasStrokeOptions): void;
|
|
827
991
|
setWorld(matrix: IMatrixData, parentMatrix?: IMatrixData): void;
|
|
@@ -829,7 +993,7 @@ interface ICanvasMethod {
|
|
|
829
993
|
setWorldShadow(x: number, y: number, blur: number, color?: string): void;
|
|
830
994
|
setWorldBlur(blur: number): void;
|
|
831
995
|
copyWorld(canvas: ILeaferCanvas, fromBounds?: IBoundsData, toBounds?: IBoundsData, blendMode?: string): void;
|
|
832
|
-
copyWorldByReset(canvas: ILeaferCanvas, from?: IBoundsData, to?: IBoundsData, blendMode?: string): void;
|
|
996
|
+
copyWorldByReset(canvas: ILeaferCanvas, from?: IBoundsData, to?: IBoundsData, blendMode?: string, onlyResetTransform?: boolean): void;
|
|
833
997
|
copyWorldToInner(canvas: ILeaferCanvas, fromWorld: IMatrixWithBoundsData, toInnerBounds: IBoundsData, blendMode?: string): void;
|
|
834
998
|
useMask(maskCanvas: ILeaferCanvas, fromBounds?: IBoundsData, toBounds?: IBoundsData): void;
|
|
835
999
|
useEraser(eraserCanvas: ILeaferCanvas, fromBounds?: IBoundsData, toBounds?: IBoundsData): void;
|
|
@@ -839,6 +1003,7 @@ interface ICanvasMethod {
|
|
|
839
1003
|
clearWorld(bounds: IBoundsData, ceilPixel?: boolean): void;
|
|
840
1004
|
clear(): void;
|
|
841
1005
|
}
|
|
1006
|
+
type ILeaferCanvasView = any;
|
|
842
1007
|
interface ILeaferCanvas extends ICanvasAttr, ICanvasMethod, IPathDrawer {
|
|
843
1008
|
readonly innerId: InnerId;
|
|
844
1009
|
name: string;
|
|
@@ -851,17 +1016,20 @@ interface ILeaferCanvas extends ICanvasAttr, ICanvasMethod, IPathDrawer {
|
|
|
851
1016
|
readonly allowBackgroundColor?: boolean;
|
|
852
1017
|
backgroundColor?: string;
|
|
853
1018
|
hittable?: boolean;
|
|
1019
|
+
zIndex?: number;
|
|
1020
|
+
childIndex?: number;
|
|
854
1021
|
bounds: IBounds;
|
|
855
1022
|
clientBounds: IBoundsData;
|
|
856
1023
|
config: ILeaferCanvasConfig;
|
|
857
1024
|
autoLayout: boolean;
|
|
858
|
-
view:
|
|
1025
|
+
view: ILeaferCanvasView;
|
|
859
1026
|
parentView: any;
|
|
860
1027
|
unreal?: boolean;
|
|
861
1028
|
context: ICanvasContext2D;
|
|
862
1029
|
recycled?: boolean;
|
|
863
1030
|
worldTransform: IMatrixData;
|
|
864
1031
|
init(): void;
|
|
1032
|
+
export(filename: IExportFileType | string, options?: IExportOptions | number | boolean): string | Promise<any>;
|
|
865
1033
|
toBlob(type?: string, quality?: number): Promise<IBlob>;
|
|
866
1034
|
toDataURL(type?: string, quality?: number): string | Promise<string>;
|
|
867
1035
|
saveAs(filename: string, quality?: number): Promise<boolean>;
|
|
@@ -870,16 +1038,16 @@ interface ILeaferCanvas extends ICanvasAttr, ICanvasMethod, IPathDrawer {
|
|
|
870
1038
|
resize(size: IScreenSizeData): void;
|
|
871
1039
|
updateViewSize(): void;
|
|
872
1040
|
updateClientBounds(): void;
|
|
873
|
-
|
|
1041
|
+
getClientBounds(update?: boolean): IBoundsData;
|
|
874
1042
|
isSameSize(options: ILeaferCanvasConfig): boolean;
|
|
875
1043
|
getSameCanvas(useSameWorldTransform?: boolean, useSameSmooth?: boolean): ILeaferCanvas;
|
|
876
|
-
|
|
877
|
-
recycle(): void;
|
|
1044
|
+
recycle(clearBounds?: IBoundsData): void;
|
|
878
1045
|
updateRender(): void;
|
|
879
1046
|
unrealCanvas(): void;
|
|
880
1047
|
destroy(): void;
|
|
881
1048
|
}
|
|
882
1049
|
interface IHitCanvas extends ILeaferCanvas {
|
|
1050
|
+
hitScale?: number;
|
|
883
1051
|
}
|
|
884
1052
|
interface IBlobFunction {
|
|
885
1053
|
(blob: IBlob | null): void;
|
|
@@ -890,7 +1058,7 @@ interface IRenderOptions {
|
|
|
890
1058
|
includes?: boolean;
|
|
891
1059
|
bounds?: IBounds;
|
|
892
1060
|
hideBounds?: IBounds;
|
|
893
|
-
matrix?:
|
|
1061
|
+
matrix?: IMatrixWithScaleData;
|
|
894
1062
|
inCamera?: boolean;
|
|
895
1063
|
}
|
|
896
1064
|
interface IRendererConfig {
|
|
@@ -909,6 +1077,7 @@ interface IRenderer extends IControl {
|
|
|
909
1077
|
rendering: boolean;
|
|
910
1078
|
waitAgain: boolean;
|
|
911
1079
|
changed: boolean;
|
|
1080
|
+
ignore: boolean;
|
|
912
1081
|
config: IRendererConfig;
|
|
913
1082
|
update(): void;
|
|
914
1083
|
requestLayout(): void;
|
|
@@ -926,7 +1095,7 @@ interface IRenderer extends IControl {
|
|
|
926
1095
|
|
|
927
1096
|
type ILeafDataProxyModule = ILeafDataProxy & ThisType<ILeaf>;
|
|
928
1097
|
interface ILeafDataProxy {
|
|
929
|
-
__setAttr?(name: string, newValue: IValue):
|
|
1098
|
+
__setAttr?(name: string, newValue: IValue): boolean;
|
|
930
1099
|
__getAttr?(name: string): IValue;
|
|
931
1100
|
setProxyAttr?(name: string, newValue: IValue): void;
|
|
932
1101
|
getProxyAttr?(name: string): IValue;
|
|
@@ -949,77 +1118,20 @@ interface ILeafBounds {
|
|
|
949
1118
|
__updateStrokeBounds?(): void;
|
|
950
1119
|
__updateRenderBounds?(): void;
|
|
951
1120
|
__updateAutoLayout?(): void;
|
|
1121
|
+
__updateFlowLayout?(): void;
|
|
952
1122
|
__updateNaturalSize?(): void;
|
|
953
1123
|
__updateStrokeSpread?(): number;
|
|
954
1124
|
__updateRenderSpread?(): number;
|
|
955
1125
|
__onUpdateSize?(): void;
|
|
956
1126
|
}
|
|
957
1127
|
|
|
958
|
-
type ILocationType = 'world' | 'local' | 'inner';
|
|
959
|
-
type IBoundsType = 'content' | 'box' | 'stroke' | 'margin' | 'render';
|
|
960
|
-
interface ILeafLayout {
|
|
961
|
-
leaf: ILeaf;
|
|
962
|
-
proxyZoom: boolean;
|
|
963
|
-
boxBounds: IBoundsData;
|
|
964
|
-
strokeBounds: IBoundsData;
|
|
965
|
-
renderBounds: IBoundsData;
|
|
966
|
-
marginBounds: IBoundsData;
|
|
967
|
-
contentBounds: IBoundsData;
|
|
968
|
-
localStrokeBounds?: IBoundsData;
|
|
969
|
-
localRenderBounds?: IBoundsData;
|
|
970
|
-
resized: boolean;
|
|
971
|
-
waitAutoLayout: boolean;
|
|
972
|
-
matrixChanged: boolean;
|
|
973
|
-
scaleChanged: boolean;
|
|
974
|
-
rotationChanged: boolean;
|
|
975
|
-
boundsChanged: boolean;
|
|
976
|
-
boxChanged: boolean;
|
|
977
|
-
strokeChanged: boolean;
|
|
978
|
-
renderChanged: boolean;
|
|
979
|
-
localBoxChanged: boolean;
|
|
980
|
-
surfaceChanged: boolean;
|
|
981
|
-
opacityChanged: boolean;
|
|
982
|
-
hitCanvasChanged: boolean;
|
|
983
|
-
childrenSortChanged?: boolean;
|
|
984
|
-
affectScaleOrRotation: boolean;
|
|
985
|
-
affectRotation: boolean;
|
|
986
|
-
affectChildrenSort?: boolean;
|
|
987
|
-
strokeSpread: number;
|
|
988
|
-
renderSpread: number;
|
|
989
|
-
strokeBoxSpread: number;
|
|
990
|
-
renderShapeSpread: number;
|
|
991
|
-
a: number;
|
|
992
|
-
b: number;
|
|
993
|
-
c: number;
|
|
994
|
-
d: number;
|
|
995
|
-
e: number;
|
|
996
|
-
f: number;
|
|
997
|
-
update(): void;
|
|
998
|
-
getTransform(relative?: ILocationType | ILeaf): IMatrixData;
|
|
999
|
-
getBounds(type?: IBoundsType, relative?: ILocationType | ILeaf): IBoundsData;
|
|
1000
|
-
getLayoutBounds(type?: IBoundsType, relative?: ILocationType | ILeaf, unscale?: boolean): ILayoutBoundsData;
|
|
1001
|
-
getLayoutPoints(type?: IBoundsType, relative?: ILocationType | ILeaf): IPointData[];
|
|
1002
|
-
spreadStroke(): void;
|
|
1003
|
-
spreadRender(): void;
|
|
1004
|
-
spreadStrokeCancel(): void;
|
|
1005
|
-
spreadRenderCancel(): void;
|
|
1006
|
-
boxChange(): void;
|
|
1007
|
-
localBoxChange(): void;
|
|
1008
|
-
strokeChange(): void;
|
|
1009
|
-
renderChange(): void;
|
|
1010
|
-
scaleChange(): void;
|
|
1011
|
-
rotationChange(): void;
|
|
1012
|
-
matrixChange(): void;
|
|
1013
|
-
surfaceChange(): void;
|
|
1014
|
-
opacityChange(): void;
|
|
1015
|
-
childrenSortChange(): void;
|
|
1016
|
-
destroy(): void;
|
|
1017
|
-
}
|
|
1018
|
-
|
|
1019
1128
|
type ILeafHitModule = ILeafHit & ThisType<ILeaf>;
|
|
1020
1129
|
interface ILeafHit {
|
|
1021
1130
|
__hitWorld?(point: IRadiusPointData): boolean;
|
|
1022
|
-
__hit?(
|
|
1131
|
+
__hit?(inner: IRadiusPointData): boolean;
|
|
1132
|
+
__hitFill?(inner: IRadiusPointData): boolean;
|
|
1133
|
+
__hitStroke?(inner: IRadiusPointData, strokeWidth: number): boolean;
|
|
1134
|
+
__hitPixel(inner: IRadiusPointData): boolean;
|
|
1023
1135
|
__drawHitPath?(canvas: ILeaferCanvas): void;
|
|
1024
1136
|
__updateHitCanvas?(): void;
|
|
1025
1137
|
}
|
|
@@ -1029,31 +1141,22 @@ interface ILeafRender {
|
|
|
1029
1141
|
__render?(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
1030
1142
|
__draw?(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
1031
1143
|
__drawFast?(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
1032
|
-
|
|
1144
|
+
__clip?(_canvas: ILeaferCanvas, _options: IRenderOptions): void;
|
|
1145
|
+
__renderShape?(canvas: ILeaferCanvas, options: IRenderOptions, ignoreFill?: boolean, ignoreStroke?: boolean): void;
|
|
1033
1146
|
__updateWorldOpacity?(): void;
|
|
1034
1147
|
__updateChange?(): void;
|
|
1035
1148
|
}
|
|
1036
1149
|
|
|
1037
|
-
type ILeafMaskModule = ILeafMask & ThisType<ILeaf>;
|
|
1038
|
-
interface ILeafMask {
|
|
1039
|
-
__updateEraser?(value?: boolean): void;
|
|
1040
|
-
__updateMask?(value?: boolean): void;
|
|
1041
|
-
__renderMask?(canvas: ILeaferCanvas, content: ILeaferCanvas, mask: ILeaferCanvas, recycle?: boolean): void;
|
|
1042
|
-
__removeMask?(child?: ILeaf): void;
|
|
1043
|
-
}
|
|
1044
|
-
|
|
1045
1150
|
interface IDataProcessor {
|
|
1046
1151
|
__leaf: ILeaf;
|
|
1047
1152
|
__input: IObject;
|
|
1048
1153
|
__middle: IObject;
|
|
1049
|
-
__single: boolean;
|
|
1050
|
-
__checkSingle(): void;
|
|
1051
1154
|
__get(name: string): any;
|
|
1052
1155
|
__getData(): IObject;
|
|
1053
1156
|
__setInput(name: string, value: any): void;
|
|
1054
1157
|
__getInput(name: string): any;
|
|
1055
1158
|
__removeInput(name: string): void;
|
|
1056
|
-
__getInputData(): IObject;
|
|
1159
|
+
__getInputData(names?: string[] | IObject, options?: IJSONOptions): IObject;
|
|
1057
1160
|
__setMiddle(name: string, value: any): void;
|
|
1058
1161
|
__getMiddle(name: string): any;
|
|
1059
1162
|
destroy(): void;
|
|
@@ -1063,29 +1166,48 @@ interface ILeafDataOptions {
|
|
|
1063
1166
|
children?: boolean;
|
|
1064
1167
|
}
|
|
1065
1168
|
interface ILeafData extends IDataProcessor, ILeafComputedData {
|
|
1169
|
+
__single?: boolean;
|
|
1170
|
+
__checkSingle(): void;
|
|
1171
|
+
__removeNaturalSize(): void;
|
|
1066
1172
|
}
|
|
1067
1173
|
|
|
1068
|
-
interface
|
|
1069
|
-
|
|
1174
|
+
interface IBranch extends ILeaf {
|
|
1175
|
+
children: ILeaf[];
|
|
1176
|
+
__renderBranch?(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
1177
|
+
addMany(...children: ILeaf[]): void;
|
|
1178
|
+
removeAll(destroy?: boolean): void;
|
|
1179
|
+
clear(): void;
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
interface IPickResult {
|
|
1183
|
+
target: ILeaf;
|
|
1070
1184
|
path: ILeafList;
|
|
1071
1185
|
throughPath?: ILeafList;
|
|
1072
1186
|
}
|
|
1073
|
-
interface
|
|
1187
|
+
interface IPickOptions {
|
|
1074
1188
|
name?: string;
|
|
1189
|
+
hitRadius?: number;
|
|
1075
1190
|
through?: boolean;
|
|
1191
|
+
target?: IBranch;
|
|
1192
|
+
findList?: ILeaf[];
|
|
1193
|
+
bottomList?: IPickBottom[];
|
|
1076
1194
|
exclude?: ILeafList;
|
|
1077
1195
|
ignoreHittable?: boolean;
|
|
1078
1196
|
}
|
|
1197
|
+
interface IPickBottom {
|
|
1198
|
+
target: ILeaf;
|
|
1199
|
+
proxy?: ILeaf;
|
|
1200
|
+
}
|
|
1079
1201
|
interface ISelectorConfig {
|
|
1080
1202
|
}
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1203
|
+
type IAnswer = 0 | 1 | 2 | 3;
|
|
1204
|
+
interface IFindCondition {
|
|
1205
|
+
id?: number | string;
|
|
1206
|
+
className?: string;
|
|
1207
|
+
tag?: string | string[];
|
|
1086
1208
|
}
|
|
1087
1209
|
interface IFindMethod {
|
|
1088
|
-
(leaf: ILeaf, options?: any):
|
|
1210
|
+
(leaf: ILeaf, options?: any): IAnswer;
|
|
1089
1211
|
}
|
|
1090
1212
|
interface ISelectorProxy {
|
|
1091
1213
|
list: ILeaf[];
|
|
@@ -1094,7 +1216,7 @@ interface ISelector {
|
|
|
1094
1216
|
target: ILeaf;
|
|
1095
1217
|
proxy?: ISelectorProxy;
|
|
1096
1218
|
config: ISelectorConfig;
|
|
1097
|
-
getByPoint(hitPoint: IPointData, hitRadius: number, options?:
|
|
1219
|
+
getByPoint(hitPoint: IPointData, hitRadius: number, options?: IPickOptions): IPickResult;
|
|
1098
1220
|
getBy(condition: number | string | IFindMethod, branch?: ILeaf, one?: boolean, options?: any): ILeaf | ILeaf[];
|
|
1099
1221
|
getByInnerId(innerId: number, branch?: ILeaf): ILeaf;
|
|
1100
1222
|
getById(id: string, branch?: ILeaf): ILeaf;
|
|
@@ -1110,52 +1232,122 @@ interface ICachedLeaf {
|
|
|
1110
1232
|
bounds: IBoundsData;
|
|
1111
1233
|
}
|
|
1112
1234
|
interface ILeafAttrData {
|
|
1113
|
-
id
|
|
1114
|
-
name
|
|
1115
|
-
className
|
|
1116
|
-
blendMode
|
|
1117
|
-
opacity
|
|
1118
|
-
visible
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
locked
|
|
1122
|
-
zIndex
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1235
|
+
id?: IString;
|
|
1236
|
+
name?: IString;
|
|
1237
|
+
className?: IString;
|
|
1238
|
+
blendMode?: IBlendMode;
|
|
1239
|
+
opacity?: INumber;
|
|
1240
|
+
visible?: IBoolean | 0;
|
|
1241
|
+
selected?: IBoolean;
|
|
1242
|
+
disabled?: IBoolean;
|
|
1243
|
+
locked?: IBoolean;
|
|
1244
|
+
zIndex?: INumber;
|
|
1245
|
+
mask?: IBoolean | IMaskType;
|
|
1246
|
+
eraser?: IBoolean | IEraserType;
|
|
1247
|
+
x?: INumber;
|
|
1248
|
+
y?: INumber;
|
|
1249
|
+
width?: INumber;
|
|
1250
|
+
height?: INumber;
|
|
1251
|
+
scaleX?: INumber;
|
|
1252
|
+
scaleY?: INumber;
|
|
1253
|
+
rotation?: INumber;
|
|
1254
|
+
skewX?: INumber;
|
|
1255
|
+
skewY?: INumber;
|
|
1256
|
+
scale?: INumber | IPointData;
|
|
1257
|
+
offsetX?: INumber;
|
|
1258
|
+
offsetY?: INumber;
|
|
1259
|
+
scrollX?: INumber;
|
|
1260
|
+
scrollY?: INumber;
|
|
1261
|
+
origin?: IAlign | IUnitPointData;
|
|
1262
|
+
around?: IAlign | IUnitPointData;
|
|
1263
|
+
lazy?: IBoolean;
|
|
1264
|
+
pixelRatio?: INumber;
|
|
1265
|
+
path?: IPathCommandData | IPathString;
|
|
1266
|
+
windingRule?: IWindingRule;
|
|
1267
|
+
closed?: IBoolean;
|
|
1268
|
+
flow?: IFlowType;
|
|
1269
|
+
padding?: IFourNumber;
|
|
1270
|
+
gap?: IGap | IPointGap;
|
|
1271
|
+
flowAlign?: IFlowAlign | IFlowAxisAlign;
|
|
1272
|
+
flowWrap?: IFlowWrap;
|
|
1273
|
+
itemBox?: IFlowBoxType;
|
|
1274
|
+
inFlow?: IBoolean;
|
|
1275
|
+
autoWidth?: IAutoSize;
|
|
1276
|
+
autoHeight?: IAutoSize;
|
|
1277
|
+
lockRatio?: IBoolean;
|
|
1278
|
+
autoBox?: IAutoBoxData | IConstraint;
|
|
1279
|
+
widthRange?: IRangeSize;
|
|
1280
|
+
heightRange?: IRangeSize;
|
|
1281
|
+
draggable?: IBoolean | IAxis;
|
|
1282
|
+
dragBounds?: IBoundsData | 'parent';
|
|
1283
|
+
editable?: IBoolean;
|
|
1284
|
+
hittable?: IBoolean;
|
|
1285
|
+
hitFill?: IHitType;
|
|
1286
|
+
hitStroke?: IHitType;
|
|
1287
|
+
hitBox?: IBoolean;
|
|
1288
|
+
hitChildren?: IBoolean;
|
|
1289
|
+
hitSelf?: IBoolean;
|
|
1290
|
+
hitRadius?: INumber;
|
|
1291
|
+
cursor?: ICursorType | ICursorType[];
|
|
1292
|
+
normalStyle?: ILeafInputData;
|
|
1293
|
+
hoverStyle?: ILeafInputData;
|
|
1294
|
+
pressStyle?: ILeafInputData;
|
|
1295
|
+
focusStyle?: ILeafInputData;
|
|
1296
|
+
selectedStyle?: ILeafInputData;
|
|
1297
|
+
disabledStyle?: ILeafInputData;
|
|
1298
|
+
data: IObject;
|
|
1299
|
+
}
|
|
1300
|
+
type IAxis = 'x' | 'y';
|
|
1301
|
+
type IAxisReverse = 'x-reverse' | 'y-reverse';
|
|
1302
|
+
type IFlowType = boolean | IAxis | IAxisReverse;
|
|
1303
|
+
type IFlowBoxType = 'box' | 'stroke';
|
|
1304
|
+
type IGap = INumber | 'auto' | 'fit';
|
|
1305
|
+
interface IPointGap {
|
|
1306
|
+
x?: IGap;
|
|
1307
|
+
y?: IGap;
|
|
1308
|
+
}
|
|
1309
|
+
type IAxisAlign = 'from' | 'center' | 'to';
|
|
1310
|
+
interface IFlowAxisAlign {
|
|
1311
|
+
content?: IFlowAlign;
|
|
1312
|
+
x?: IAxisAlign;
|
|
1313
|
+
y?: IAxisAlign;
|
|
1314
|
+
}
|
|
1315
|
+
type IFlowWrap = boolean | 'reverse';
|
|
1316
|
+
type IAutoSize = IBoolean | INumber | IPercentData;
|
|
1317
|
+
interface IRangeSize {
|
|
1318
|
+
min?: number;
|
|
1319
|
+
max?: number;
|
|
1320
|
+
}
|
|
1321
|
+
interface IUnitData {
|
|
1322
|
+
type: 'percent' | 'px';
|
|
1323
|
+
value: number;
|
|
1324
|
+
}
|
|
1325
|
+
interface IPercentData extends IUnitData {
|
|
1326
|
+
type: 'percent';
|
|
1327
|
+
}
|
|
1328
|
+
interface IConstraint {
|
|
1329
|
+
x: IConstraintType;
|
|
1330
|
+
y: IConstraintType;
|
|
1145
1331
|
}
|
|
1332
|
+
type IConstraintType = 'from' | 'center' | 'to' | 'from-to' | 'scale';
|
|
1146
1333
|
type IHitType = 'path' | 'pixel' | 'all' | 'none';
|
|
1334
|
+
type IMaskType = 'path' | 'pixel' | 'clipping';
|
|
1335
|
+
type IEraserType = 'path' | 'pixel';
|
|
1147
1336
|
type IBlendMode = 'pass-through' | 'normal' | 'multiply' | 'screen' | 'overlay' | 'darken' | 'lighten' | 'color-dodge' | 'color-burn' | 'hard-light' | 'soft-light' | 'difference' | 'exclusion' | 'hue' | 'saturation' | 'color' | 'luminosity' | 'source-over' | 'source-in' | 'source-out' | 'source-atop' | 'destination-over' | 'destination-in' | 'destination-out' | 'destination-atop' | 'xor';
|
|
1148
|
-
type IEditSize = 'size' | 'scale';
|
|
1337
|
+
type IEditSize = 'size' | 'font-size' | 'scale';
|
|
1149
1338
|
interface IImageCursor {
|
|
1150
1339
|
url: string;
|
|
1151
1340
|
x?: number;
|
|
1152
1341
|
y?: number;
|
|
1342
|
+
rotation?: number;
|
|
1153
1343
|
}
|
|
1154
|
-
type
|
|
1155
|
-
type
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1344
|
+
type IDirection = 'top-left' | 'top' | 'top-right' | 'right' | 'bottom-right' | 'bottom' | 'bottom-left' | 'left' | 'center';
|
|
1345
|
+
type IAlign = IDirection;
|
|
1346
|
+
type IBaseLineAlign = 'baseline-left' | 'baseline-center' | 'baseline-right';
|
|
1347
|
+
type IFlowAlign = IAlign | IBaseLineAlign;
|
|
1348
|
+
type IAround = IAlign | IUnitPointData;
|
|
1349
|
+
type ICursorType = IImageCursor | '' | 'auto' | 'default' | 'none' | 'context-menu' | 'help' | 'pointer' | 'progress' | 'wait' | 'cell' | 'crosshair' | 'text' | 'vertical-text' | 'alias' | 'copy' | 'move' | 'no-drop' | 'not-allowed' | 'grab' | 'grabbing' | 'e-resize' | 'n-resize' | 'ne-resize' | 'nw-resize' | 's-resize' | 'se-resize' | 'sw-resize' | 'w-resize' | 'ew-resize' | 'ns-resize' | 'nesw-resize' | 'nwse-resize' | 'col-resize' | 'row-resize' | 'all-scroll' | 'zoom-in' | 'zoom-out';
|
|
1350
|
+
type IStateStyleType = 'hoverStyle' | 'pressStyle' | 'focusStyle' | 'selectedStyle' | 'disabledStyle';
|
|
1159
1351
|
interface ILeafInputData {
|
|
1160
1352
|
tag?: string;
|
|
1161
1353
|
id?: IString;
|
|
@@ -1163,11 +1355,13 @@ interface ILeafInputData {
|
|
|
1163
1355
|
className?: IString;
|
|
1164
1356
|
blendMode?: IBlendMode;
|
|
1165
1357
|
opacity?: INumber;
|
|
1166
|
-
visible?: IBoolean;
|
|
1167
|
-
|
|
1168
|
-
|
|
1358
|
+
visible?: IBoolean | 0;
|
|
1359
|
+
selected?: IBoolean;
|
|
1360
|
+
disabled?: IBoolean;
|
|
1169
1361
|
locked?: IBoolean;
|
|
1170
1362
|
zIndex?: INumber;
|
|
1363
|
+
mask?: IBoolean | IMaskType;
|
|
1364
|
+
eraser?: IBoolean | IEraserType;
|
|
1171
1365
|
x?: INumber;
|
|
1172
1366
|
y?: INumber;
|
|
1173
1367
|
width?: INumber;
|
|
@@ -1178,10 +1372,33 @@ interface ILeafInputData {
|
|
|
1178
1372
|
skewX?: INumber;
|
|
1179
1373
|
skewY?: INumber;
|
|
1180
1374
|
scale?: INumber | IPointData;
|
|
1181
|
-
|
|
1182
|
-
|
|
1375
|
+
offsetX?: INumber;
|
|
1376
|
+
offsetY?: INumber;
|
|
1377
|
+
scrollX?: INumber;
|
|
1378
|
+
scrollY?: INumber;
|
|
1379
|
+
origin?: IAlign | IUnitPointData;
|
|
1380
|
+
around?: IAlign | IUnitPointData;
|
|
1381
|
+
lazy?: IBoolean;
|
|
1382
|
+
pixelRatio?: INumber;
|
|
1383
|
+
path?: IPathCommandData | IPathString;
|
|
1384
|
+
windingRule?: IWindingRule;
|
|
1385
|
+
closed?: IBoolean;
|
|
1386
|
+
flow?: IFlowType;
|
|
1387
|
+
padding?: IFourNumber;
|
|
1388
|
+
gap?: IGap | IPointGap;
|
|
1389
|
+
flowAlign?: IFlowAlign | IFlowAxisAlign;
|
|
1390
|
+
flowWrap?: IFlowWrap;
|
|
1391
|
+
itemBox?: IFlowBoxType;
|
|
1392
|
+
inFlow?: IBoolean;
|
|
1393
|
+
autoWidth?: IAutoSize;
|
|
1394
|
+
autoHeight?: IAutoSize;
|
|
1395
|
+
lockRatio?: IBoolean;
|
|
1396
|
+
autoBox?: IAutoBoxData | IConstraint;
|
|
1397
|
+
widthRange?: IRangeSize;
|
|
1398
|
+
heightRange?: IRangeSize;
|
|
1399
|
+
draggable?: IBoolean | IAxis;
|
|
1400
|
+
dragBounds?: IBoundsData | 'parent';
|
|
1183
1401
|
editable?: IBoolean;
|
|
1184
|
-
editSize?: IEditSize;
|
|
1185
1402
|
hittable?: IBoolean;
|
|
1186
1403
|
hitFill?: IHitType;
|
|
1187
1404
|
hitStroke?: IHitType;
|
|
@@ -1190,6 +1407,13 @@ interface ILeafInputData {
|
|
|
1190
1407
|
hitSelf?: IBoolean;
|
|
1191
1408
|
hitRadius?: INumber;
|
|
1192
1409
|
cursor?: ICursorType | ICursorType[];
|
|
1410
|
+
normalStyle?: ILeafInputData;
|
|
1411
|
+
hoverStyle?: ILeafInputData;
|
|
1412
|
+
pressStyle?: ILeafInputData;
|
|
1413
|
+
focusStyle?: ILeafInputData;
|
|
1414
|
+
selectedStyle?: ILeafInputData;
|
|
1415
|
+
disabledStyle?: ILeafInputData;
|
|
1416
|
+
data?: IObject;
|
|
1193
1417
|
children?: ILeafInputData[];
|
|
1194
1418
|
noBounds?: boolean;
|
|
1195
1419
|
}
|
|
@@ -1199,11 +1423,13 @@ interface ILeafComputedData {
|
|
|
1199
1423
|
className?: string;
|
|
1200
1424
|
blendMode?: IBlendMode;
|
|
1201
1425
|
opacity?: number;
|
|
1202
|
-
visible?: boolean;
|
|
1203
|
-
|
|
1204
|
-
|
|
1426
|
+
visible?: boolean | 0;
|
|
1427
|
+
selected?: boolean;
|
|
1428
|
+
disabled?: boolean;
|
|
1205
1429
|
locked?: boolean;
|
|
1206
1430
|
zIndex?: number;
|
|
1431
|
+
mask?: boolean | IMaskType;
|
|
1432
|
+
eraser?: boolean | IEraserType;
|
|
1207
1433
|
x?: number;
|
|
1208
1434
|
y?: number;
|
|
1209
1435
|
width?: number;
|
|
@@ -1213,10 +1439,33 @@ interface ILeafComputedData {
|
|
|
1213
1439
|
rotation?: number;
|
|
1214
1440
|
skewX?: number;
|
|
1215
1441
|
skewY?: number;
|
|
1216
|
-
|
|
1217
|
-
|
|
1442
|
+
offsetX?: number;
|
|
1443
|
+
offsetY?: number;
|
|
1444
|
+
scrollX?: number;
|
|
1445
|
+
scrollY?: number;
|
|
1446
|
+
origin?: IAlign | IUnitPointData;
|
|
1447
|
+
around?: IAlign | IUnitPointData;
|
|
1448
|
+
lazy?: boolean;
|
|
1449
|
+
pixelRatio?: number;
|
|
1450
|
+
path?: IPathCommandData;
|
|
1451
|
+
windingRule?: IWindingRule;
|
|
1452
|
+
closed?: boolean;
|
|
1453
|
+
flow?: IFlowType;
|
|
1454
|
+
padding?: IFourNumber;
|
|
1455
|
+
gap?: IGap | IPointGap;
|
|
1456
|
+
flowAlign?: IFlowAlign | IFlowAxisAlign;
|
|
1457
|
+
flowWrap?: IFlowWrap;
|
|
1458
|
+
itemBox?: IFlowBoxType;
|
|
1459
|
+
inFlow?: boolean;
|
|
1460
|
+
autoWidth?: IAutoSize;
|
|
1461
|
+
autoHeight?: IAutoSize;
|
|
1462
|
+
lockRatio?: boolean;
|
|
1463
|
+
autoBox?: IAutoBoxData | IConstraint;
|
|
1464
|
+
widthRange?: IRangeSize;
|
|
1465
|
+
heightRange?: IRangeSize;
|
|
1466
|
+
draggable?: boolean | IAxis;
|
|
1467
|
+
dragBounds?: IBoundsData | 'parent';
|
|
1218
1468
|
editable?: boolean;
|
|
1219
|
-
editSize?: IEditSize;
|
|
1220
1469
|
hittable?: boolean;
|
|
1221
1470
|
hitFill?: IHitType;
|
|
1222
1471
|
hitStroke?: IHitType;
|
|
@@ -1225,12 +1474,31 @@ interface ILeafComputedData {
|
|
|
1225
1474
|
hitSelf?: boolean;
|
|
1226
1475
|
hitRadius?: number;
|
|
1227
1476
|
cursor?: ICursorType | ICursorType[];
|
|
1477
|
+
normalStyle?: ILeafInputData;
|
|
1478
|
+
hoverStyle?: ILeafInputData;
|
|
1479
|
+
pressStyle?: ILeafInputData;
|
|
1480
|
+
focusStyle?: ILeafInputData;
|
|
1481
|
+
selectedStyle?: ILeafInputData;
|
|
1482
|
+
disabledStyle?: ILeafInputData;
|
|
1483
|
+
data?: IObject;
|
|
1228
1484
|
__childBranchNumber?: number;
|
|
1229
1485
|
__complex?: boolean;
|
|
1230
1486
|
__naturalWidth?: number;
|
|
1231
1487
|
__naturalHeight?: number;
|
|
1232
|
-
|
|
1233
|
-
|
|
1488
|
+
readonly __autoWidth?: boolean;
|
|
1489
|
+
readonly __autoHeight?: boolean;
|
|
1490
|
+
readonly __autoSide?: boolean;
|
|
1491
|
+
readonly __autoSize?: boolean;
|
|
1492
|
+
readonly __useNaturalRatio: boolean;
|
|
1493
|
+
readonly __isLinePath: boolean;
|
|
1494
|
+
readonly __blendMode: string;
|
|
1495
|
+
__useArrow?: boolean;
|
|
1496
|
+
__useEffect?: boolean;
|
|
1497
|
+
__pathInputed?: number;
|
|
1498
|
+
__pathForRender?: IPathCommandData;
|
|
1499
|
+
__path2DForRender?: IPath2D;
|
|
1500
|
+
}
|
|
1501
|
+
interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDataProxy, ILeafInputData, IEventer {
|
|
1234
1502
|
tag: string;
|
|
1235
1503
|
readonly __tag: string;
|
|
1236
1504
|
readonly innerName: string;
|
|
@@ -1239,22 +1507,28 @@ interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, ILeafMatr
|
|
|
1239
1507
|
readonly app?: ILeaferBase;
|
|
1240
1508
|
leafer?: ILeaferBase;
|
|
1241
1509
|
parent?: ILeaf;
|
|
1510
|
+
zoomLayer?: ILeaf;
|
|
1242
1511
|
readonly isApp?: boolean;
|
|
1243
|
-
isLeafer?: boolean;
|
|
1244
|
-
isBranch?: boolean;
|
|
1245
|
-
isBranchLeaf?: boolean;
|
|
1512
|
+
readonly isLeafer?: boolean;
|
|
1513
|
+
readonly isBranch?: boolean;
|
|
1514
|
+
readonly isBranchLeaf?: boolean;
|
|
1515
|
+
readonly isOutside?: boolean;
|
|
1246
1516
|
__: ILeafData;
|
|
1247
1517
|
proxyData?: ILeafInputData;
|
|
1248
1518
|
__proxyData?: ILeafInputData;
|
|
1519
|
+
syncEventer?: ILeaf;
|
|
1249
1520
|
__layout: ILeafLayout;
|
|
1250
|
-
__world:
|
|
1521
|
+
__world: IMatrixWithBoundsScaleData;
|
|
1251
1522
|
__local?: IMatrixWithBoundsData;
|
|
1523
|
+
__nowWorld?: IMatrixWithBoundsScaleData;
|
|
1524
|
+
__cameraWorld?: IMatrixWithBoundsScaleData;
|
|
1252
1525
|
readonly __localMatrix: IMatrixData;
|
|
1253
|
-
readonly
|
|
1526
|
+
readonly __localBoxBounds: IBoundsData;
|
|
1254
1527
|
__worldOpacity: number;
|
|
1255
|
-
readonly worldTransform:
|
|
1256
|
-
readonly localTransform:
|
|
1528
|
+
readonly worldTransform: IMatrixWithScaleData;
|
|
1529
|
+
readonly localTransform: IMatrixData;
|
|
1257
1530
|
readonly boxBounds: IBoundsData;
|
|
1531
|
+
readonly renderBounds: IBoundsData;
|
|
1258
1532
|
readonly worldBoxBounds: IBoundsData;
|
|
1259
1533
|
readonly worldStrokeBounds: IBoundsData;
|
|
1260
1534
|
readonly worldRenderBounds: IBoundsData;
|
|
@@ -1266,29 +1540,46 @@ interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, ILeafMatr
|
|
|
1266
1540
|
__hasMask?: boolean;
|
|
1267
1541
|
__hasEraser?: boolean;
|
|
1268
1542
|
__hitCanvas?: IHitCanvas;
|
|
1543
|
+
__flowBounds?: IBoundsData;
|
|
1544
|
+
__widthGrow?: number;
|
|
1545
|
+
__heightGrow?: number;
|
|
1546
|
+
__hasGrow?: boolean;
|
|
1269
1547
|
readonly __onlyHitMask: boolean;
|
|
1270
1548
|
readonly __ignoreHitWorld: boolean;
|
|
1549
|
+
readonly __inLazyBounds: boolean;
|
|
1550
|
+
readonly pathInputed: boolean;
|
|
1271
1551
|
__parentWait?: IFunction[];
|
|
1272
1552
|
__leaferWait?: IFunction[];
|
|
1273
1553
|
destroyed: boolean;
|
|
1274
1554
|
reset(data?: ILeafInputData): void;
|
|
1275
1555
|
resetCustom(): void;
|
|
1276
|
-
waitParent(item: IFunction): void;
|
|
1277
|
-
waitLeafer(item: IFunction): void;
|
|
1278
|
-
nextRender(item: IFunction): void;
|
|
1556
|
+
waitParent(item: IFunction, bind?: IObject): void;
|
|
1557
|
+
waitLeafer(item: IFunction, bind?: IObject): void;
|
|
1558
|
+
nextRender(item: IFunction, bind?: IObject, off?: 'off'): void;
|
|
1559
|
+
removeNextRender(item: IFunction): void;
|
|
1279
1560
|
__bindLeafer(leafer: ILeaferBase | null): void;
|
|
1280
1561
|
set(data: IObject): void;
|
|
1281
|
-
get(): ILeafInputData;
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1562
|
+
get(name?: string | string[] | IObject): ILeafInputData | IValue;
|
|
1563
|
+
setAttr(name: string, value: any): void;
|
|
1564
|
+
getAttr(name: string): any;
|
|
1565
|
+
getComputedAttr(name: string): any;
|
|
1566
|
+
toJSON(options?: IJSONOptions): IObject;
|
|
1567
|
+
toString(options?: IJSONOptions): string;
|
|
1568
|
+
toSVG(): string;
|
|
1569
|
+
__SVG(data: IObject): void;
|
|
1570
|
+
toHTML(): string;
|
|
1571
|
+
__setAttr(attrName: string, newValue: IValue, checkFiniteNumber?: boolean): boolean;
|
|
1285
1572
|
__getAttr(attrName: string): IValue;
|
|
1286
1573
|
setProxyAttr(name: string, newValue: IValue): void;
|
|
1287
1574
|
getProxyAttr(name: string): IValue;
|
|
1288
1575
|
find(condition: number | string | IFindMethod, options?: any): ILeaf[];
|
|
1289
|
-
|
|
1290
|
-
|
|
1576
|
+
findTag(tag: string | string[]): ILeaf[];
|
|
1577
|
+
findOne(condition: number | string | IFindMethod, options?: any): ILeaf | undefined;
|
|
1578
|
+
findId(id: number | string): ILeaf | undefined;
|
|
1579
|
+
focus(value?: boolean): void;
|
|
1291
1580
|
updateLayout(): void;
|
|
1581
|
+
forceUpdate(attrName?: string): void;
|
|
1582
|
+
forceRender(_bounds?: IBoundsData): void;
|
|
1292
1583
|
__updateWorldMatrix(): void;
|
|
1293
1584
|
__updateLocalMatrix(): void;
|
|
1294
1585
|
__updateWorldBounds(): void;
|
|
@@ -1296,21 +1587,26 @@ interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, ILeafMatr
|
|
|
1296
1587
|
__updateLocalBoxBounds(): void;
|
|
1297
1588
|
__updateLocalStrokeBounds(): void;
|
|
1298
1589
|
__updateLocalRenderBounds(): void;
|
|
1590
|
+
__updateContentBounds(): void;
|
|
1299
1591
|
__updateBoxBounds(): void;
|
|
1300
1592
|
__updateStrokeBounds(): void;
|
|
1301
1593
|
__updateRenderBounds(): void;
|
|
1302
1594
|
__updateAutoLayout(): void;
|
|
1595
|
+
__updateFlowLayout(): void;
|
|
1303
1596
|
__updateNaturalSize(): void;
|
|
1304
1597
|
__updateStrokeSpread(): number;
|
|
1305
1598
|
__updateRenderSpread(): number;
|
|
1306
1599
|
__onUpdateSize(): void;
|
|
1307
1600
|
__updateEraser(value?: boolean): void;
|
|
1308
1601
|
__updateMask(value?: boolean): void;
|
|
1309
|
-
__renderMask(canvas: ILeaferCanvas,
|
|
1310
|
-
|
|
1311
|
-
|
|
1602
|
+
__renderMask(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
1603
|
+
__renderEraser(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
1604
|
+
__getNowWorld(options: IRenderOptions): IMatrixWithBoundsScaleData;
|
|
1605
|
+
getTransform(relative?: ILocationType | ILeaf): IMatrixData;
|
|
1312
1606
|
getBounds(type?: IBoundsType, relative?: ILocationType | ILeaf): IBoundsData;
|
|
1313
1607
|
getLayoutBounds(type?: IBoundsType, relative?: ILocationType | ILeaf, unscale?: boolean): ILayoutBoundsData;
|
|
1608
|
+
getLayoutPoints(type?: IBoundsType, relative?: ILocationType | ILeaf): IPointData[];
|
|
1609
|
+
getWorldBounds(inner: IBoundsData, relative?: ILeaf, change?: boolean): IBoundsData;
|
|
1314
1610
|
worldToLocal(world: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void;
|
|
1315
1611
|
localToWorld(local: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void;
|
|
1316
1612
|
worldToInner(world: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void;
|
|
@@ -1321,22 +1617,35 @@ interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, ILeafMatr
|
|
|
1321
1617
|
getLocalPointByInner(inner: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
|
|
1322
1618
|
getWorldPoint(inner: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
|
|
1323
1619
|
getWorldPointByLocal(local: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
|
|
1620
|
+
getPagePoint(world: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
|
|
1621
|
+
getWorldPointByPage(page: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
|
|
1324
1622
|
setTransform(transform?: IMatrixData, resize?: boolean): void;
|
|
1325
1623
|
transform(transform?: IMatrixData, resize?: boolean): void;
|
|
1326
|
-
move(x: number, y?: number): void;
|
|
1327
|
-
scaleOf(origin: IPointData, scaleX: number, scaleY?: number, resize?: boolean): void;
|
|
1328
|
-
rotateOf(origin: IPointData, rotation: number): void;
|
|
1329
|
-
skewOf(origin: IPointData, skewX: number, skewY?: number, resize?: boolean): void;
|
|
1624
|
+
move(x: number | IPointData, y?: number): void;
|
|
1625
|
+
scaleOf(origin: IPointData | IAlign, scaleX: number, scaleY?: number, resize?: boolean): void;
|
|
1626
|
+
rotateOf(origin: IPointData | IAlign, rotation: number): void;
|
|
1627
|
+
skewOf(origin: IPointData | IAlign, skewX: number, skewY?: number, resize?: boolean): void;
|
|
1628
|
+
transformWorld(worldTransform?: IMatrixData, resize?: boolean): void;
|
|
1629
|
+
moveWorld(x: number | IPointData, y?: number): void;
|
|
1630
|
+
scaleOfWorld(worldOrigin: IPointData, scaleX: number, scaleY?: number, resize?: boolean): void;
|
|
1631
|
+
rotateOfWorld(worldOrigin: IPointData, rotation: number): void;
|
|
1632
|
+
skewOfWorld(worldOrigin: IPointData, skewX: number, skewY?: number, resize?: boolean): void;
|
|
1330
1633
|
scaleResize(scaleX: number, scaleY: number, noResize?: boolean): void;
|
|
1331
1634
|
__scaleResize(scaleX: number, scaleY: number): void;
|
|
1635
|
+
resizeWidth(width: number): void;
|
|
1636
|
+
resizeHeight(height: number): void;
|
|
1332
1637
|
__hitWorld(point: IRadiusPointData): boolean;
|
|
1333
1638
|
__hit(local: IRadiusPointData): boolean;
|
|
1639
|
+
__hitFill(inner: IRadiusPointData): boolean;
|
|
1640
|
+
__hitStroke(inner: IRadiusPointData, strokeWidth: number): boolean;
|
|
1641
|
+
__hitPixel(inner: IRadiusPointData): boolean;
|
|
1334
1642
|
__drawHitPath(canvas: ILeaferCanvas): void;
|
|
1335
1643
|
__updateHitCanvas(): void;
|
|
1336
1644
|
__render(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
1337
1645
|
__drawFast(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
1338
1646
|
__draw(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
1339
|
-
|
|
1647
|
+
__clip(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
1648
|
+
__renderShape(canvas: ILeaferCanvas, options: IRenderOptions, ignoreFill?: boolean, ignoreStroke?: boolean): void;
|
|
1340
1649
|
__updateWorldOpacity(): void;
|
|
1341
1650
|
__updateChange(): void;
|
|
1342
1651
|
__drawPath(canvas: ILeaferCanvas): void;
|
|
@@ -1349,9 +1658,10 @@ interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, ILeafMatr
|
|
|
1349
1658
|
remove(child?: ILeaf, destroy?: boolean): void;
|
|
1350
1659
|
dropTo(parent: ILeaf, index?: number, resize?: boolean): void;
|
|
1351
1660
|
}
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1661
|
+
type ILeafAttrDescriptor = IObject & ThisType<ILeaf>;
|
|
1662
|
+
interface ILeafAttrDescriptorFn {
|
|
1663
|
+
(key: string): ILeafAttrDescriptor;
|
|
1664
|
+
}
|
|
1355
1665
|
|
|
1356
1666
|
interface ILeaferImageConfig {
|
|
1357
1667
|
url: string;
|
|
@@ -1364,6 +1674,13 @@ interface ILeaferImageOnLoaded {
|
|
|
1364
1674
|
interface ILeaferImageOnError {
|
|
1365
1675
|
(error?: string | IObject, image?: ILeaferImage): any;
|
|
1366
1676
|
}
|
|
1677
|
+
interface ILeaferImageCacheCanvas {
|
|
1678
|
+
data: IObject;
|
|
1679
|
+
params: IArguments;
|
|
1680
|
+
}
|
|
1681
|
+
interface ILeaferImagePatternPaint {
|
|
1682
|
+
transform: IMatrixData;
|
|
1683
|
+
}
|
|
1367
1684
|
interface ILeaferImage {
|
|
1368
1685
|
readonly innerId: InnerId;
|
|
1369
1686
|
readonly url: string;
|
|
@@ -1371,6 +1688,7 @@ interface ILeaferImage {
|
|
|
1371
1688
|
width: number;
|
|
1372
1689
|
height: number;
|
|
1373
1690
|
isSVG: boolean;
|
|
1691
|
+
hasOpacityPixel: boolean;
|
|
1374
1692
|
readonly completed: boolean;
|
|
1375
1693
|
ready: boolean;
|
|
1376
1694
|
error: IObject;
|
|
@@ -1380,6 +1698,7 @@ interface ILeaferImage {
|
|
|
1380
1698
|
load(onSuccess?: ILeaferImageOnLoaded, onError?: ILeaferImageOnError): number;
|
|
1381
1699
|
unload(index: number, stopEvent?: boolean): void;
|
|
1382
1700
|
getCanvas(width: number, height: number, opacity?: number, _filters?: IObject): unknown;
|
|
1701
|
+
getPattern(canvas: any, repeat: string | null, transform?: IMatrixData, paint?: IObject): ICanvasPattern;
|
|
1383
1702
|
destroy(): void;
|
|
1384
1703
|
}
|
|
1385
1704
|
|
|
@@ -1397,6 +1716,7 @@ interface IUIEvent extends IEvent {
|
|
|
1397
1716
|
buttons?: number;
|
|
1398
1717
|
path?: ILeafList;
|
|
1399
1718
|
throughPath?: ILeafList;
|
|
1719
|
+
getPage?(): IPointData;
|
|
1400
1720
|
getInner?(relative?: ILeaf): IPointData;
|
|
1401
1721
|
getLocal?(relative?: ILeaf): IPointData;
|
|
1402
1722
|
}
|
|
@@ -1409,6 +1729,7 @@ interface IPointerEvent extends IUIEvent {
|
|
|
1409
1729
|
tiltX?: number;
|
|
1410
1730
|
tiltY?: number;
|
|
1411
1731
|
twist?: number;
|
|
1732
|
+
isCancel?: boolean;
|
|
1412
1733
|
}
|
|
1413
1734
|
type PointerType = 'mouse' | 'pen' | 'touch';
|
|
1414
1735
|
interface IDragEvent extends IPointerEvent {
|
|
@@ -1416,10 +1737,13 @@ interface IDragEvent extends IPointerEvent {
|
|
|
1416
1737
|
moveY: number;
|
|
1417
1738
|
totalX?: number;
|
|
1418
1739
|
totalY?: number;
|
|
1740
|
+
getPageMove?(total?: boolean): IPointData;
|
|
1419
1741
|
getInnerMove?(relative?: ILeaf): IPointData;
|
|
1420
1742
|
getLocalMove?(relative?: ILeaf): IPointData;
|
|
1743
|
+
getPageTotal?(): IPointData;
|
|
1421
1744
|
getInnerTotal?(relative?: ILeaf): IPointData;
|
|
1422
1745
|
getLocalTotal?(relative?: ILeaf): IPointData;
|
|
1746
|
+
getPageBounds?(): IBoundsData;
|
|
1423
1747
|
}
|
|
1424
1748
|
interface IDropEvent extends IPointerEvent {
|
|
1425
1749
|
list: ILeafList;
|
|
@@ -1453,14 +1777,17 @@ interface IInteraction extends IControl {
|
|
|
1453
1777
|
running: boolean;
|
|
1454
1778
|
readonly dragging: boolean;
|
|
1455
1779
|
readonly isDragEmpty: boolean;
|
|
1780
|
+
readonly isHoldRightKey: boolean;
|
|
1456
1781
|
readonly moveMode: boolean;
|
|
1457
1782
|
config: IInteractionConfig;
|
|
1458
1783
|
cursor: ICursorType | ICursorType[];
|
|
1459
1784
|
readonly hitRadius: number;
|
|
1785
|
+
bottomList?: IPickBottom[];
|
|
1460
1786
|
shrinkCanvasBounds: IBounds;
|
|
1461
1787
|
downData: IPointerEvent;
|
|
1462
1788
|
hoverData: IPointerEvent;
|
|
1463
1789
|
downTime: number;
|
|
1790
|
+
focusData: ILeaf;
|
|
1464
1791
|
receive(event: any): void;
|
|
1465
1792
|
pointerDown(data?: IPointerEvent, defaultPath?: boolean): void;
|
|
1466
1793
|
pointerMove(data?: IPointerEvent): void;
|
|
@@ -1473,11 +1800,20 @@ interface IInteraction extends IControl {
|
|
|
1473
1800
|
rotate(data: IRotateEvent): void;
|
|
1474
1801
|
keyDown(data: IKeyEvent): void;
|
|
1475
1802
|
keyUp(data: IKeyEvent): void;
|
|
1476
|
-
findPath(data: IPointerEvent, options?:
|
|
1803
|
+
findPath(data: IPointerEvent, options?: IPickOptions): ILeafList;
|
|
1804
|
+
isRootPath(data: IPointerEvent): boolean;
|
|
1805
|
+
isTreePath(data: IPointerEvent): boolean;
|
|
1806
|
+
canMove(data: IPointerEvent): boolean;
|
|
1477
1807
|
isDrag(leaf: ILeaf): boolean;
|
|
1478
|
-
|
|
1808
|
+
isPress(leaf: ILeaf): boolean;
|
|
1809
|
+
isHover(leaf: ILeaf): boolean;
|
|
1810
|
+
isFocus(leaf: ILeaf): boolean;
|
|
1811
|
+
cancelHover(): void;
|
|
1812
|
+
updateDownData(data?: IPointerEvent, options?: IPickOptions, merge?: boolean): void;
|
|
1479
1813
|
updateHoverData(data: IPointerEvent): void;
|
|
1480
1814
|
updateCursor(hoverData?: IPointerEvent): void;
|
|
1815
|
+
setCursor(cursor: ICursorType | ICursorType[]): void;
|
|
1816
|
+
getLocal(clientPoint: IClientPointData, updateClient?: boolean): IPointData;
|
|
1481
1817
|
emit(type: string, data: IUIEvent, path?: ILeafList, excludePath?: ILeafList): void;
|
|
1482
1818
|
}
|
|
1483
1819
|
interface IInteractionCanvas extends ILeaferCanvas {
|
|
@@ -1485,23 +1821,31 @@ interface IInteractionCanvas extends ILeaferCanvas {
|
|
|
1485
1821
|
interface IInteractionConfig {
|
|
1486
1822
|
wheel?: IWheelConfig;
|
|
1487
1823
|
pointer?: IPointerConfig;
|
|
1488
|
-
cursor?: ICursorConfig;
|
|
1489
1824
|
zoom?: IZoomConfig;
|
|
1490
1825
|
move?: IMoveConfig;
|
|
1491
1826
|
eventer?: IObject;
|
|
1827
|
+
cursor?: boolean;
|
|
1828
|
+
keyEvent?: boolean;
|
|
1492
1829
|
}
|
|
1493
1830
|
interface IZoomConfig {
|
|
1831
|
+
disabled?: boolean;
|
|
1494
1832
|
min?: number;
|
|
1495
1833
|
max?: number;
|
|
1496
1834
|
}
|
|
1497
1835
|
interface IMoveConfig {
|
|
1836
|
+
disabled?: boolean;
|
|
1498
1837
|
holdSpaceKey?: boolean;
|
|
1838
|
+
holdMiddleKey?: boolean;
|
|
1839
|
+
holdRightKey?: boolean;
|
|
1840
|
+
scroll?: boolean | 'limit';
|
|
1499
1841
|
drag?: boolean;
|
|
1842
|
+
dragAnimate?: boolean;
|
|
1500
1843
|
dragEmpty?: boolean;
|
|
1501
1844
|
dragOut?: boolean;
|
|
1502
1845
|
autoDistance?: number;
|
|
1503
1846
|
}
|
|
1504
1847
|
interface IWheelConfig {
|
|
1848
|
+
disabled?: boolean;
|
|
1505
1849
|
zoomMode?: boolean | 'mouse';
|
|
1506
1850
|
zoomSpeed?: number;
|
|
1507
1851
|
moveSpeed?: number;
|
|
@@ -1518,38 +1862,30 @@ interface IPointerConfig {
|
|
|
1518
1862
|
tapTime?: number;
|
|
1519
1863
|
longPressTime?: number;
|
|
1520
1864
|
transformTime?: number;
|
|
1865
|
+
hover?: boolean;
|
|
1521
1866
|
dragHover?: boolean;
|
|
1522
1867
|
dragDistance?: number;
|
|
1523
1868
|
swipeDistance?: number;
|
|
1524
1869
|
ignoreMove?: boolean;
|
|
1525
1870
|
preventDefault?: boolean;
|
|
1526
|
-
|
|
1527
|
-
interface ICursorConfig {
|
|
1528
|
-
stop?: boolean;
|
|
1871
|
+
preventDefaultMenu?: boolean;
|
|
1529
1872
|
}
|
|
1530
1873
|
|
|
1531
1874
|
interface IHitCanvasManager extends ICanvasManager {
|
|
1875
|
+
maxTotal: number;
|
|
1532
1876
|
getPathType(leaf: ILeaf): IHitCanvas;
|
|
1533
|
-
|
|
1534
|
-
}
|
|
1535
|
-
|
|
1536
|
-
interface IBranch extends ILeaf {
|
|
1537
|
-
children: ILeaf[];
|
|
1538
|
-
__renderBranch?(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
1539
|
-
addMany(...children: ILeaf[]): void;
|
|
1540
|
-
removeAll(destroy?: boolean): void;
|
|
1877
|
+
getPixelType(leaf: ILeaf, config?: ILeaferCanvasConfig): IHitCanvas;
|
|
1541
1878
|
}
|
|
1542
1879
|
|
|
1543
1880
|
interface IZoomView extends IBranch {
|
|
1544
|
-
zoomLayer?: ILeaf;
|
|
1545
|
-
setZoomLayer(zoomLayer: ILeaf): void;
|
|
1546
1881
|
}
|
|
1547
1882
|
|
|
1548
|
-
type ILeaferType = 'draw' | 'design' | 'board' | 'document' | '
|
|
1883
|
+
type ILeaferType = 'draw' | 'editor' | 'design' | 'board' | 'document' | 'app' | 'website' | 'game' | 'player' | 'chart' | 'custom';
|
|
1549
1884
|
interface ILeaferConfig extends IRendererConfig, ILeaferCanvasConfig, IInteractionConfig, ILayouterConfig {
|
|
1550
1885
|
start?: boolean;
|
|
1551
1886
|
type?: ILeaferType;
|
|
1552
1887
|
realCanvas?: boolean;
|
|
1888
|
+
lazySpeard?: IFourNumber;
|
|
1553
1889
|
}
|
|
1554
1890
|
interface ILeaferAttrData {
|
|
1555
1891
|
running: boolean;
|
|
@@ -1559,7 +1895,7 @@ interface ILeaferAttrData {
|
|
|
1559
1895
|
imageReady: boolean;
|
|
1560
1896
|
viewCompleted: boolean;
|
|
1561
1897
|
layoutLocked: boolean;
|
|
1562
|
-
|
|
1898
|
+
transforming: boolean;
|
|
1563
1899
|
view: unknown;
|
|
1564
1900
|
canvas: ILeaferCanvas;
|
|
1565
1901
|
renderer: IRenderer;
|
|
@@ -1570,8 +1906,10 @@ interface ILeaferAttrData {
|
|
|
1570
1906
|
canvasManager: ICanvasManager;
|
|
1571
1907
|
hitCanvasManager?: IHitCanvasManager;
|
|
1572
1908
|
autoLayout?: IAutoBounds;
|
|
1909
|
+
lazyBounds: IBounds;
|
|
1573
1910
|
config: ILeaferConfig;
|
|
1574
1911
|
readonly cursorPoint: IPointData;
|
|
1912
|
+
readonly clientBounds: IBoundsData;
|
|
1575
1913
|
leafs: number;
|
|
1576
1914
|
__eventIds: IEventListenerId[];
|
|
1577
1915
|
__nextRenderWait: IFunction[];
|
|
@@ -1580,14 +1918,17 @@ interface ILeaferAttrData {
|
|
|
1580
1918
|
stop(): void;
|
|
1581
1919
|
unlockLayout(): void;
|
|
1582
1920
|
lockLayout(): void;
|
|
1583
|
-
|
|
1584
|
-
forceFullRender(): void;
|
|
1585
|
-
updateCursor(): void;
|
|
1921
|
+
updateCursor(cursor?: ICursorType): void;
|
|
1586
1922
|
resize(size: IScreenSizeData): void;
|
|
1587
|
-
waitReady(item: IFunction): void;
|
|
1588
|
-
waitViewReady(item: IFunction): void;
|
|
1589
|
-
waitViewCompleted(item: IFunction): void;
|
|
1590
|
-
|
|
1923
|
+
waitReady(item: IFunction, bind?: IObject): void;
|
|
1924
|
+
waitViewReady(item: IFunction, bind?: IObject): void;
|
|
1925
|
+
waitViewCompleted(item: IFunction, bind?: IObject): void;
|
|
1926
|
+
zoom(zoomType: IZoomType, padding?: IFourNumber, fixedScale?: boolean): IBoundsData;
|
|
1927
|
+
getValidMove(moveX: number, moveY: number): IPointData;
|
|
1928
|
+
getValidScale(changeScale: number): number;
|
|
1929
|
+
getWorldPointByClient(clientPoint: IClientPointData, updateClient?: boolean): IPointData;
|
|
1930
|
+
}
|
|
1931
|
+
type IZoomType = 'in' | 'out' | 'fit' | 'fit-width' | 'fit-height' | number | ILeaf | ILeaf[] | IBoundsData;
|
|
1591
1932
|
interface ILeaferBase extends IZoomView, IControl, ILeaferAttrData {
|
|
1592
1933
|
readonly isApp: boolean;
|
|
1593
1934
|
readonly app: ILeaferBase;
|
|
@@ -1608,6 +1949,7 @@ interface ICreator {
|
|
|
1608
1949
|
image?(options?: ILeaferImageConfig): ILeaferImage;
|
|
1609
1950
|
canvas?(options?: ILeaferCanvasConfig, manager?: ICanvasManager): ILeaferCanvas;
|
|
1610
1951
|
hitCanvas?(options?: IHitCanvasConfig, manager?: ICanvasManager): IHitCanvas;
|
|
1952
|
+
hitCanvasManager?(): IHitCanvasManager;
|
|
1611
1953
|
watcher?(target: ILeaf, options?: IWatcherConfig): IWatcher;
|
|
1612
1954
|
layouter?(target: ILeaf, options?: ILayouterConfig): ILayouter;
|
|
1613
1955
|
renderer?(target: ILeaf, canvas: ILeaferCanvas, options?: IRendererConfig): IRenderer;
|
|
@@ -1678,11 +2020,12 @@ interface IImageManager {
|
|
|
1678
2020
|
recycledList: ILeaferImage[];
|
|
1679
2021
|
tasker: ITaskProcessor;
|
|
1680
2022
|
patternTasker: ITaskProcessor;
|
|
2023
|
+
patternLocked?: boolean;
|
|
1681
2024
|
readonly isComplete: boolean;
|
|
1682
2025
|
get(config: ILeaferImageConfig): ILeaferImage;
|
|
1683
2026
|
recycle(image: ILeaferImage): void;
|
|
1684
2027
|
clearRecycled(): void;
|
|
1685
|
-
|
|
2028
|
+
hasOpacityPixel(config: ILeaferImageConfig): boolean;
|
|
1686
2029
|
isFormat(format: IExportFileType, config: ILeaferImageConfig): boolean;
|
|
1687
2030
|
destroy(): void;
|
|
1688
2031
|
}
|
|
@@ -1719,6 +2062,7 @@ interface ISkiaNAPICanvas {
|
|
|
1719
2062
|
interface IPlatform {
|
|
1720
2063
|
name?: 'web' | 'node' | 'miniapp';
|
|
1721
2064
|
os?: 'Mac' | 'Windows' | 'Linux';
|
|
2065
|
+
toURL(text: string, fileType?: 'text' | 'svg'): string;
|
|
1722
2066
|
requestRender?(render: IFunction): void;
|
|
1723
2067
|
canvas?: ILeaferCanvas;
|
|
1724
2068
|
canvasType?: ICanvasType;
|
|
@@ -1736,6 +2080,7 @@ interface IPlatform {
|
|
|
1736
2080
|
canvasToDataURL(canvas: any, type?: IExportImageType, quality?: number): string | Promise<string>;
|
|
1737
2081
|
canvasToBolb(canvas: any, type?: IExportFileType, quality?: number): Promise<any>;
|
|
1738
2082
|
canvasSaveAs(canvas: any, filename: string, quality?: number): Promise<void>;
|
|
2083
|
+
download(url: string, filename: string): Promise<void>;
|
|
1739
2084
|
loadImage(url: string): Promise<any>;
|
|
1740
2085
|
noRepeat?: string;
|
|
1741
2086
|
};
|
|
@@ -1748,9 +2093,13 @@ interface IPlatform {
|
|
|
1748
2093
|
};
|
|
1749
2094
|
miniapp?: IMiniapp;
|
|
1750
2095
|
image: {
|
|
2096
|
+
hitCanvasSize: number;
|
|
1751
2097
|
maxCacheSize: number;
|
|
1752
2098
|
maxPatternSize: number;
|
|
1753
|
-
|
|
2099
|
+
prefix?: string;
|
|
2100
|
+
suffix?: string;
|
|
2101
|
+
crossOrigin: string | false;
|
|
2102
|
+
getRealURL: IStringFunction;
|
|
1754
2103
|
};
|
|
1755
2104
|
}
|
|
1756
2105
|
interface IMiniappSelect extends IObject {
|
|
@@ -1775,4 +2124,15 @@ interface IPlugin extends IObject {
|
|
|
1775
2124
|
onLeafer?(leafer: ILeaferBase): void;
|
|
1776
2125
|
}
|
|
1777
2126
|
|
|
1778
|
-
|
|
2127
|
+
interface ICursorTypeMap {
|
|
2128
|
+
[name: string]: ICursorType | ICursorType[];
|
|
2129
|
+
}
|
|
2130
|
+
interface ICursorRotate {
|
|
2131
|
+
rotation?: number;
|
|
2132
|
+
data?: string;
|
|
2133
|
+
}
|
|
2134
|
+
interface ICursorRotateMap {
|
|
2135
|
+
[name: string]: ICursorRotate;
|
|
2136
|
+
}
|
|
2137
|
+
|
|
2138
|
+
export type { ACommandData, ArcCommandData, ArcToCommandData, CCommandData, CanvasPathCommand, EllipseCommandData, HCommandData, IAlign, IAnimateEvent, IAnswer, IAppBase, IAround, IAttrDecorator, IAutoBounds, IAutoBoundsData, IAutoBoxData, IAutoSize, IAxis, IAxisAlign, IAxisReverse, IBaseLineAlign, IBlendMode, IBlob, IBlobFunction, IBoolean, IBooleanMap, IBounds, IBoundsData, IBoundsDataFn, IBoundsType, IBranch, IBranchRender, IBranchRenderModule, ICachedLeaf, ICanvasAttr, ICanvasCacheOptions, ICanvasContext2D, ICanvasContext2DSettings, ICanvasManager, ICanvasPattern, ICanvasStrokeOptions, ICanvasType, IChildEvent, IClientPointData, IConstraint, IConstraintType, IControl, ICreator, ICursorRotate, ICursorRotateMap, ICursorType, ICursorTypeMap, IDataProcessor, IDataTypeHandle, IDirection, IDragEvent, IDropEvent, IEditSize, IEraserType, IEvent, IEventListener, IEventListenerId, IEventListenerItem, IEventListenerMap, IEventListenerOptions, IEventTarget, IEventer, IExportFileType, IExportImageType, IExportOnCanvasFunction, IExportOptions, IExportResult, IExportResultFunction, IFindCondition, IFindMethod, IFlowAlign, IFlowAxisAlign, IFlowBoxType, IFlowType, IFlowWrap, IFourNumber, IFromToData, IFunction, IGap, IHitCanvas, IHitCanvasConfig, IHitCanvasManager, IHitType, IImageCursor, IImageEvent, IImageManager, IInteraction, IInteractionCanvas, IInteractionConfig, IJSONOptions, IKeepTouchData, IKeyEvent, ILayoutAttr, ILayoutBlockData, ILayoutBoundsData, ILayoutChangedData, ILayoutData, ILayoutEvent, ILayouter, ILayouterConfig, ILeaf, ILeafArrayMap, ILeafAttrData, ILeafAttrDescriptor, ILeafAttrDescriptorFn, ILeafBounds, ILeafBoundsModule, ILeafComputedData, ILeafData, ILeafDataOptions, ILeafDataProxy, ILeafDataProxyModule, ILeafEventer, ILeafEventerModule, ILeafHit, ILeafHitModule, ILeafInputData, ILeafLayout, ILeafLevelList, ILeafList, ILeafListItemCallback, ILeafMap, ILeafMatrix, ILeafMatrixModule, ILeafRender, ILeafRenderModule, ILeaferAttrData, ILeaferBase, ILeaferCanvas, ILeaferCanvasConfig, ILeaferCanvasView, ILeaferConfig, ILeaferEvent, ILeaferImage, ILeaferImageCacheCanvas, ILeaferImageConfig, ILeaferImageOnError, ILeaferImageOnLoaded, ILeaferImagePatternPaint, ILeaferType, ILeaferTypeCreator, ILeaferTypeFunction, ILeaferTypeList, ILocationType, IMaskType, IMatrix, IMatrixData, IMatrixWithBoundsData, IMatrixWithBoundsScaleData, IMatrixWithLayoutData, IMatrixWithOptionScaleData, IMatrixWithScaleData, IMiniapp, IMiniappSelect, IMiniappSizeView, IMoveEvent, IMultiTouchData, INumber, INumberFunction, INumberMap, IObject, IObjectFunction, IOffsetBoundsData, IPartLayoutConfig, IPath2D, IPathCommandData, IPathCreator, IPathDrawer, IPathString, IPercentData, IPickBottom, IPickOptions, IPickResult, IPlatform, IPlugin, IPoint, IPointData, IPointDataFunction, IPointDataMap, IPointGap, IPointerConfig, IPointerEvent, IPropertyEvent, IRadiusPointData, IRangeSize, IRenderEvent, IRenderOptions, IRenderer, IRendererConfig, IResizeEvent, IResizeEventListener, IRotateEvent, IScaleData, IScaleRotationData, IScreenSizeData, IScrollPointData, ISelector, ISelectorConfig, ISelectorProxy, ISize, ISizeData, ISkewData, ISkiaCanvas, ISkiaCanvasExportConfig, ISkiaNAPICanvas, IStateStyleType, IString, IStringFunction, IStringMap, ISwipeEvent, ITaskItem, ITaskOptions, ITaskProcessor, ITaskProcessorConfig, ITextMetrics, ITimer, ITwoPointBoundsData, IUICreator, IUIEvent, IUnitData, IUnitPointData, IUpdateEvent, IValue, IWatchEvent, IWatchEventData, IWatcher, IWatcherConfig, IWheelConfig, IWindingRule, IZoomEvent, IZoomType, IZoomView, InnerId, LCommandData, MCommandData, PointerType, QCommandData, RectCommandData, RoundRectCommandData, SCommandData, TCommandData, VCommandData, ZCommandData };
|