@leafer/interface 1.0.0-rc.1 → 1.0.0-rc.10
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/IApp.ts +3 -3
- package/src/app/ILeafer.ts +34 -15
- package/src/canvas/ICanvas.ts +2 -0
- package/src/canvas/ILeaferCanvas.ts +8 -8
- package/src/canvas/ISkiaCanvas.ts +20 -1
- package/src/data/IData.ts +4 -5
- package/src/data/ILeafData.ts +7 -1
- package/src/data/IList.ts +9 -6
- package/src/display/IBranch.ts +2 -1
- package/src/display/ILeaf.ts +172 -86
- package/src/display/IView.ts +1 -4
- package/src/display/module/IBranchRender.ts +2 -2
- package/src/display/module/ILeafBounds.ts +2 -0
- package/src/display/module/ILeafDataProxy.ts +5 -3
- package/src/display/module/ILeafHit.ts +3 -1
- package/src/display/module/ILeafRender.ts +1 -0
- package/src/event/IEvent.ts +3 -23
- package/src/event/IEventer.ts +6 -1
- package/src/event/IUIEvent.ts +10 -8
- package/src/file/IExport.ts +24 -0
- package/src/file/IFileType.ts +1 -1
- package/src/function/IFunction.ts +9 -0
- package/src/image/IImageManager.ts +3 -0
- package/src/image/ILeaferImage.ts +13 -0
- package/src/index.ts +16 -15
- package/src/interaction/ICursor.ts +16 -0
- package/src/interaction/IInteraction.ts +18 -4
- package/src/layout/ILeafLayout.ts +29 -13
- package/src/layouter/ILayouter.ts +3 -0
- package/src/math/IMath.ts +64 -32
- package/src/platform/IPlatform.ts +15 -2
- package/src/plugin/IPlugin.ts +2 -2
- package/src/renderer/IRenderer.ts +3 -2
- package/src/selector/ISelector.ts +26 -9
- package/types/index.d.ts +447 -260
- package/src/display/module/ILeafMask.ts +0 -12
package/types/index.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ILeaferCanvas as ILeaferCanvas$1, IScreenSizeData as IScreenSizeData$1 } from '@leafer/interface';
|
|
2
2
|
|
|
3
|
-
type
|
|
4
|
-
type
|
|
5
|
-
type
|
|
6
|
-
type
|
|
7
|
-
type __Value = __Number | __Boolean | __String | __Object;
|
|
3
|
+
type INumber = number;
|
|
4
|
+
type IBoolean = boolean;
|
|
5
|
+
type IString = string;
|
|
6
|
+
type IValue = INumber | IBoolean | IString | IObject;
|
|
8
7
|
type ITimer = any;
|
|
9
8
|
type IPathString = string;
|
|
10
9
|
interface IObject {
|
|
@@ -37,13 +36,14 @@ interface ILeafList {
|
|
|
37
36
|
has(leaf: ILeaf): boolean;
|
|
38
37
|
indexAt(index: number): ILeaf;
|
|
39
38
|
indexOf(leaf: ILeaf): number;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
sort(reverse?: boolean): void;
|
|
39
|
+
add(leaf: ILeaf): void;
|
|
40
|
+
addAt(leaf: ILeaf, index: number): void;
|
|
41
|
+
addList(list: ILeaf[]): void;
|
|
44
42
|
remove(leaf: ILeaf): void;
|
|
45
43
|
forEach(itemCallback: ILeafListItemCallback): void;
|
|
44
|
+
sort(reverse?: boolean): void;
|
|
46
45
|
clone(): ILeafList;
|
|
46
|
+
update(): void;
|
|
47
47
|
reset(): void;
|
|
48
48
|
destroy(): void;
|
|
49
49
|
}
|
|
@@ -55,8 +55,8 @@ interface ILeafLevelList {
|
|
|
55
55
|
has(leaf: ILeaf): boolean;
|
|
56
56
|
without(leaf: ILeaf): boolean;
|
|
57
57
|
sort(reverse?: boolean): void;
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
addList(list: ILeaf[]): void;
|
|
59
|
+
add(leaf: ILeaf): void;
|
|
60
60
|
forEach(itemCallback: ILeafListItemCallback): void;
|
|
61
61
|
reset(): void;
|
|
62
62
|
destroy(): void;
|
|
@@ -94,17 +94,23 @@ interface IPointData {
|
|
|
94
94
|
y: number;
|
|
95
95
|
}
|
|
96
96
|
interface IPoint extends IPointData {
|
|
97
|
-
set(x?: number, y?: number):
|
|
98
|
-
|
|
97
|
+
set(x?: number | IPointData, y?: number): IPoint;
|
|
98
|
+
get(): IPointData;
|
|
99
99
|
clone(): IPoint;
|
|
100
|
-
|
|
100
|
+
move(x: number, y: number): IPoint;
|
|
101
|
+
scale(scaleX: number, scaleY?: number): IPoint;
|
|
102
|
+
scaleOf(origin: IPointData, scaleX: number, scaleY?: number): IPoint;
|
|
103
|
+
rotate(rotation: number, origin?: IPointData): IPoint;
|
|
104
|
+
rotateOf(origin: IPointData, rotation: number): IPoint;
|
|
105
|
+
getRotation(origin: IPointData, to: IPointData, toOrigin?: IPointData): number;
|
|
101
106
|
toInnerOf(matrix: IMatrixData, to?: IPointData): IPoint;
|
|
102
107
|
toOuterOf(matrix: IMatrixData, to?: IPointData): IPoint;
|
|
103
|
-
getCenter(to: IPointData):
|
|
108
|
+
getCenter(to: IPointData): IPoint;
|
|
104
109
|
getDistance(to: IPointData): number;
|
|
110
|
+
getDistancePoint(to: IPointData, distance: number): IPoint;
|
|
105
111
|
getAngle(to: IPointData): number;
|
|
106
112
|
getAtan2(to: IPointData): number;
|
|
107
|
-
reset():
|
|
113
|
+
reset(): IPoint;
|
|
108
114
|
}
|
|
109
115
|
interface IRadiusPointData extends IPointData {
|
|
110
116
|
radiusX: number;
|
|
@@ -125,25 +131,30 @@ interface IOffsetBoundsData extends IBoundsData {
|
|
|
125
131
|
offsetX: number;
|
|
126
132
|
offsetY: number;
|
|
127
133
|
}
|
|
128
|
-
interface
|
|
134
|
+
interface IBoundsDataFn {
|
|
129
135
|
(target: any): IBoundsData;
|
|
130
136
|
}
|
|
131
|
-
interface IBounds extends IBoundsData {
|
|
132
|
-
set(x?: number, y?: number, width?: number, height?: number):
|
|
133
|
-
|
|
137
|
+
interface IBounds extends IBoundsData, ITwoPointBoundsData {
|
|
138
|
+
set(x?: number | IBoundsData, y?: number, width?: number, height?: number): IBounds;
|
|
139
|
+
get(): IBoundsData;
|
|
134
140
|
clone(): IBounds;
|
|
141
|
+
move(x: number, y: number): IBounds;
|
|
135
142
|
scale(scaleX: number, scaleY?: number): IBounds;
|
|
143
|
+
scaleOf(origin: IPointData, scaleX: number, scaleY?: number): IBounds;
|
|
136
144
|
toOuterOf(matrix: IMatrixData, to?: IBoundsData): IBounds;
|
|
145
|
+
toInnerOf(matrix: IMatrixData, to?: IBoundsData): IBounds;
|
|
137
146
|
getFitMatrix(put: IBoundsData): IMatrix;
|
|
138
|
-
spread(
|
|
147
|
+
spread(spreadX: number, spreadY?: number): IBounds;
|
|
139
148
|
ceil(): IBounds;
|
|
140
149
|
unsign(): IBounds;
|
|
150
|
+
float(maxLength?: number): IBounds;
|
|
141
151
|
add(bounds: IBoundsData): IBounds;
|
|
142
|
-
addList(boundsList:
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
152
|
+
addList(boundsList: IBoundsData[]): IBounds;
|
|
153
|
+
setList(boundsList: IBoundsData[]): IBounds;
|
|
154
|
+
addListWithFn(list: IObject[], boundsDataHandle: IBoundsDataFn): IBounds;
|
|
155
|
+
setListWithFn(list: IObject[], boundsDataHandle: IBoundsDataFn): IBounds;
|
|
156
|
+
setPoints(points: IPointData[]): IBounds;
|
|
157
|
+
getPoints(): IPointData[];
|
|
147
158
|
hitPoint(point: IPointData, pointMatrix?: IMatrixData): boolean;
|
|
148
159
|
hitRadiusPoint(point: IRadiusPointData, pointMatrix?: IMatrixWithLayoutData): boolean;
|
|
149
160
|
hit(bounds: IBoundsData, boundsMatrix?: IMatrixData): boolean;
|
|
@@ -160,11 +171,6 @@ interface ITwoPointBoundsData {
|
|
|
160
171
|
maxX: number;
|
|
161
172
|
maxY: number;
|
|
162
173
|
}
|
|
163
|
-
interface ITwoPointBounds extends ITwoPointBoundsData {
|
|
164
|
-
addPoint(x: number, y: number): void;
|
|
165
|
-
addBounds(x: number, y: number, width: number, height: number): void;
|
|
166
|
-
add(pointBounds: ITwoPointBoundsData): void;
|
|
167
|
-
}
|
|
168
174
|
interface IAutoBoundsData {
|
|
169
175
|
top?: number;
|
|
170
176
|
right?: number;
|
|
@@ -186,19 +192,25 @@ interface IMatrixData {
|
|
|
186
192
|
e: number;
|
|
187
193
|
f: number;
|
|
188
194
|
}
|
|
189
|
-
interface
|
|
190
|
-
x: number;
|
|
191
|
-
y: number;
|
|
195
|
+
interface IScaleData {
|
|
192
196
|
scaleX: number;
|
|
193
197
|
scaleY: number;
|
|
198
|
+
}
|
|
199
|
+
interface IScaleRotationData extends IScaleData {
|
|
194
200
|
rotation: number;
|
|
201
|
+
}
|
|
202
|
+
interface ISkewData {
|
|
195
203
|
skewX: number;
|
|
196
204
|
skewY: number;
|
|
197
205
|
}
|
|
198
|
-
|
|
206
|
+
interface ILayoutData extends IScaleRotationData, ISkewData, IPointData {
|
|
207
|
+
}
|
|
208
|
+
type ILayoutAttr = 'x' | 'y' | 'scaleX' | 'scaleY' | 'rotation' | 'skewX' | 'skewY';
|
|
209
|
+
interface ILayoutBoundsData extends ILayoutData, IBoundsData {
|
|
210
|
+
}
|
|
199
211
|
interface IMatrix extends IMatrixData {
|
|
200
|
-
set(a: number, b: number, c: number, d: number, e: number, f: number):
|
|
201
|
-
|
|
212
|
+
set(a: number | IMatrixData, b: number, c: number, d: number, e: number, f: number): IMatrix;
|
|
213
|
+
get(): IMatrixData;
|
|
202
214
|
clone(): IMatrix;
|
|
203
215
|
translate(x: number, y: number): IMatrix;
|
|
204
216
|
translateInner(x: number, y: number): IMatrix;
|
|
@@ -211,18 +223,29 @@ interface IMatrix extends IMatrixData {
|
|
|
211
223
|
skew(x: number, y?: number): IMatrix;
|
|
212
224
|
skewOfOuter(origin: IPointData, x: number, y?: number): IMatrix;
|
|
213
225
|
skewOfInner(origin: IPointData, x: number, y?: number): IMatrix;
|
|
214
|
-
multiply(
|
|
215
|
-
|
|
216
|
-
|
|
226
|
+
multiply(child: IMatrixData): IMatrix;
|
|
227
|
+
multiplyParent(parent: IMatrixData): IMatrix;
|
|
228
|
+
divide(child: IMatrixData): IMatrix;
|
|
229
|
+
divideParent(parent: IMatrixData): IMatrix;
|
|
217
230
|
invert(): IMatrix;
|
|
218
231
|
toOuterPoint(inner: IPointData, to?: IPointData, distance?: boolean): void;
|
|
219
232
|
toInnerPoint(outer: IPointData, to?: IPointData, distance?: boolean): void;
|
|
220
|
-
|
|
233
|
+
setLayout(data: ILayoutData, origin?: IPointData): IMatrix;
|
|
234
|
+
getLayout(origin?: IPointData, firstSkewY?: boolean): ILayoutData;
|
|
235
|
+
withScale(scaleX?: number, scaleY?: number): IMatrixWithScaleData;
|
|
221
236
|
reset(): void;
|
|
222
237
|
}
|
|
223
238
|
interface IMatrixWithBoundsData extends IMatrixData, IBoundsData {
|
|
224
239
|
}
|
|
225
|
-
interface
|
|
240
|
+
interface IMatrixWithScaleData extends IMatrixData, IScaleData {
|
|
241
|
+
}
|
|
242
|
+
interface IMatrixWithOptionScaleData extends IMatrixData {
|
|
243
|
+
scaleX?: number;
|
|
244
|
+
scaleY?: number;
|
|
245
|
+
}
|
|
246
|
+
interface IMatrixWithBoundsScaleData extends IMatrixData, IBoundsData, IScaleData {
|
|
247
|
+
}
|
|
248
|
+
interface IMatrixWithLayoutData extends IMatrixData, ILayoutBoundsData {
|
|
226
249
|
}
|
|
227
250
|
|
|
228
251
|
interface ILayoutChangedData {
|
|
@@ -250,6 +273,7 @@ interface ILayouterConfig {
|
|
|
250
273
|
interface ILayouter extends IControl {
|
|
251
274
|
target: ILeaf;
|
|
252
275
|
layoutedBlocks: ILayoutBlockData[];
|
|
276
|
+
extraBlock: ILayoutBlockData;
|
|
253
277
|
totalTimes: number;
|
|
254
278
|
times: number;
|
|
255
279
|
disabled: boolean;
|
|
@@ -263,12 +287,14 @@ interface ILayouter extends IControl {
|
|
|
263
287
|
layoutOnce(): void;
|
|
264
288
|
partLayout(): void;
|
|
265
289
|
fullLayout(): void;
|
|
290
|
+
addExtra(leaf: ILeaf): void;
|
|
266
291
|
createBlock(data: ILeafList | ILeaf[]): ILayoutBlockData;
|
|
267
292
|
getBlocks(list: ILeafList): ILayoutBlockData[];
|
|
268
293
|
addBlocks(current: ILayoutBlockData[]): void;
|
|
269
294
|
}
|
|
270
295
|
|
|
271
296
|
interface IEvent {
|
|
297
|
+
origin?: IObject;
|
|
272
298
|
type?: string;
|
|
273
299
|
target?: IEventTarget;
|
|
274
300
|
current?: IEventTarget;
|
|
@@ -319,25 +345,6 @@ interface ILayoutEvent extends IEvent {
|
|
|
319
345
|
interface IWatchEvent extends IEvent {
|
|
320
346
|
readonly data: IWatchEventData;
|
|
321
347
|
}
|
|
322
|
-
interface ITransformEventData {
|
|
323
|
-
x: number;
|
|
324
|
-
y: number;
|
|
325
|
-
scaleX: number;
|
|
326
|
-
scaleY: number;
|
|
327
|
-
rotation: number;
|
|
328
|
-
readonly zooming: boolean;
|
|
329
|
-
readonly moving: boolean;
|
|
330
|
-
readonly rotating: boolean;
|
|
331
|
-
readonly changing: boolean;
|
|
332
|
-
}
|
|
333
|
-
interface ITransformEvent extends IEvent, ITransformEventData {
|
|
334
|
-
readonly x: number;
|
|
335
|
-
readonly y: number;
|
|
336
|
-
readonly scaleX: number;
|
|
337
|
-
readonly scaleY: number;
|
|
338
|
-
readonly rotation: number;
|
|
339
|
-
}
|
|
340
|
-
type TransformMode = 'move' | 'zoom' | 'rotate';
|
|
341
348
|
interface IMultiTouchData {
|
|
342
349
|
move: IPointData;
|
|
343
350
|
scale: number;
|
|
@@ -361,7 +368,23 @@ interface ILeafEventer {
|
|
|
361
368
|
hasEvent?(type: string, capture?: boolean): boolean;
|
|
362
369
|
}
|
|
363
370
|
|
|
364
|
-
|
|
371
|
+
interface IFunction {
|
|
372
|
+
(...arg: any): any;
|
|
373
|
+
}
|
|
374
|
+
interface INumberFunction {
|
|
375
|
+
(...arg: any): number;
|
|
376
|
+
}
|
|
377
|
+
interface IPointDataFunction {
|
|
378
|
+
(...arg: any): IPointData;
|
|
379
|
+
}
|
|
380
|
+
interface IAttrDecorator {
|
|
381
|
+
(...arg: any): IAttrDecoratorInner;
|
|
382
|
+
}
|
|
383
|
+
interface IAttrDecoratorInner {
|
|
384
|
+
(target: any, key: string): any;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
type IEventListener = IFunction;
|
|
365
388
|
interface IEventListenerOptions {
|
|
366
389
|
capture?: boolean;
|
|
367
390
|
once?: boolean;
|
|
@@ -374,6 +397,7 @@ interface IEventListenerMap {
|
|
|
374
397
|
}
|
|
375
398
|
interface IEventListenerId {
|
|
376
399
|
type: string | string[];
|
|
400
|
+
current: ILeaf;
|
|
377
401
|
listener: IEventListener;
|
|
378
402
|
options?: IEventListenerOptions | boolean;
|
|
379
403
|
}
|
|
@@ -384,11 +408,11 @@ interface IEventer extends ILeafEventer {
|
|
|
384
408
|
__bubbleMap?: IEventListenerMap;
|
|
385
409
|
on(type: string | string[], listener: IEventListener, options?: IEventListenerOptions | boolean): void;
|
|
386
410
|
off(type: string | string[], listener: IEventListener, options?: IEventListenerOptions | boolean): void;
|
|
387
|
-
on_(type: string | string[], listener: IEventListener, bind?: IObject
|
|
411
|
+
on_(type: string | string[], listener: IEventListener, bind?: IObject, options?: IEventListenerOptions | boolean): IEventListenerId;
|
|
388
412
|
off_(id: IEventListenerId | IEventListenerId[]): void;
|
|
389
413
|
once(type: string | string[], listener: IEventListener): void;
|
|
390
|
-
emit(type: string, event?: IEvent
|
|
391
|
-
emitEvent(event?: IEvent
|
|
414
|
+
emit(type: string, event?: IEvent | IObject, capture?: boolean): void;
|
|
415
|
+
emitEvent(event?: IEvent, capture?: boolean): void;
|
|
392
416
|
hasEvent(type: string, capture?: boolean): boolean;
|
|
393
417
|
destroy(): void;
|
|
394
418
|
}
|
|
@@ -478,6 +502,7 @@ interface CanvasPathDrawingStyles {
|
|
|
478
502
|
interface CanvasPattern {
|
|
479
503
|
setTransform(transform?: DOMMatrix2DInit): void;
|
|
480
504
|
}
|
|
505
|
+
type ICanvasPattern = CanvasPattern;
|
|
481
506
|
interface CanvasRect {
|
|
482
507
|
clearRect(x: number, y: number, w: number, h: number): void;
|
|
483
508
|
fillRect(x: number, y: number, w: number, h: number): void;
|
|
@@ -739,6 +764,28 @@ interface ICanvasManager {
|
|
|
739
764
|
destroy(): void;
|
|
740
765
|
}
|
|
741
766
|
|
|
767
|
+
type IExportImageType = 'jpg' | 'png' | 'webp';
|
|
768
|
+
type IExportFileType = IExportImageType | 'svg' | 'pdf' | 'json';
|
|
769
|
+
|
|
770
|
+
interface IExportOptions {
|
|
771
|
+
quality?: number;
|
|
772
|
+
blob?: boolean;
|
|
773
|
+
scale?: number;
|
|
774
|
+
pixelRatio?: number;
|
|
775
|
+
slice?: boolean;
|
|
776
|
+
trim?: boolean;
|
|
777
|
+
fill?: string;
|
|
778
|
+
screenshot?: IBoundsData | boolean;
|
|
779
|
+
}
|
|
780
|
+
interface IExportResult {
|
|
781
|
+
data: ILeaferCanvas | IBlob | string | boolean;
|
|
782
|
+
renderBounds?: IBoundsData;
|
|
783
|
+
trimBounds?: IBoundsData;
|
|
784
|
+
}
|
|
785
|
+
interface IExportResultFunction {
|
|
786
|
+
(data: IExportResult): void;
|
|
787
|
+
}
|
|
788
|
+
|
|
742
789
|
interface ILeaferCanvasConfig extends IAutoBoundsData {
|
|
743
790
|
view?: string | IObject;
|
|
744
791
|
fill?: string;
|
|
@@ -818,7 +865,7 @@ interface ICanvasMethod {
|
|
|
818
865
|
setWorldShadow(x: number, y: number, blur: number, color?: string): void;
|
|
819
866
|
setWorldBlur(blur: number): void;
|
|
820
867
|
copyWorld(canvas: ILeaferCanvas, fromBounds?: IBoundsData, toBounds?: IBoundsData, blendMode?: string): void;
|
|
821
|
-
copyWorldByReset(canvas: ILeaferCanvas, from?: IBoundsData, to?: IBoundsData, blendMode?: string): void;
|
|
868
|
+
copyWorldByReset(canvas: ILeaferCanvas, from?: IBoundsData, to?: IBoundsData, blendMode?: string, onlyResetTransform?: boolean): void;
|
|
822
869
|
copyWorldToInner(canvas: ILeaferCanvas, fromWorld: IMatrixWithBoundsData, toInnerBounds: IBoundsData, blendMode?: string): void;
|
|
823
870
|
useMask(maskCanvas: ILeaferCanvas, fromBounds?: IBoundsData, toBounds?: IBoundsData): void;
|
|
824
871
|
useEraser(eraserCanvas: ILeaferCanvas, fromBounds?: IBoundsData, toBounds?: IBoundsData): void;
|
|
@@ -828,6 +875,7 @@ interface ICanvasMethod {
|
|
|
828
875
|
clearWorld(bounds: IBoundsData, ceilPixel?: boolean): void;
|
|
829
876
|
clear(): void;
|
|
830
877
|
}
|
|
878
|
+
type ILeaferCanvasView = any;
|
|
831
879
|
interface ILeaferCanvas extends ICanvasAttr, ICanvasMethod, IPathDrawer {
|
|
832
880
|
readonly innerId: InnerId;
|
|
833
881
|
name: string;
|
|
@@ -844,13 +892,14 @@ interface ILeaferCanvas extends ICanvasAttr, ICanvasMethod, IPathDrawer {
|
|
|
844
892
|
clientBounds: IBoundsData;
|
|
845
893
|
config: ILeaferCanvasConfig;
|
|
846
894
|
autoLayout: boolean;
|
|
847
|
-
view:
|
|
895
|
+
view: ILeaferCanvasView;
|
|
848
896
|
parentView: any;
|
|
849
897
|
unreal?: boolean;
|
|
850
898
|
context: ICanvasContext2D;
|
|
851
899
|
recycled?: boolean;
|
|
852
900
|
worldTransform: IMatrixData;
|
|
853
901
|
init(): void;
|
|
902
|
+
export(filename: IExportFileType | string, options?: IExportOptions | number | boolean): string | Promise<any>;
|
|
854
903
|
toBlob(type?: string, quality?: number): Promise<IBlob>;
|
|
855
904
|
toDataURL(type?: string, quality?: number): string | Promise<string>;
|
|
856
905
|
saveAs(filename: string, quality?: number): Promise<boolean>;
|
|
@@ -859,11 +908,9 @@ interface ILeaferCanvas extends ICanvasAttr, ICanvasMethod, IPathDrawer {
|
|
|
859
908
|
resize(size: IScreenSizeData): void;
|
|
860
909
|
updateViewSize(): void;
|
|
861
910
|
updateClientBounds(): void;
|
|
862
|
-
setCursor(cursor: ICursorType | ICursorType[]): void;
|
|
863
911
|
isSameSize(options: ILeaferCanvasConfig): boolean;
|
|
864
|
-
getSameCanvas(useSameWorldTransform?: boolean): ILeaferCanvas;
|
|
865
|
-
|
|
866
|
-
recycle(): void;
|
|
912
|
+
getSameCanvas(useSameWorldTransform?: boolean, useSameSmooth?: boolean): ILeaferCanvas;
|
|
913
|
+
recycle(clearBounds?: IBoundsData): void;
|
|
867
914
|
updateRender(): void;
|
|
868
915
|
unrealCanvas(): void;
|
|
869
916
|
destroy(): void;
|
|
@@ -875,20 +922,11 @@ interface IBlobFunction {
|
|
|
875
922
|
}
|
|
876
923
|
type IBlob = any;
|
|
877
924
|
|
|
878
|
-
interface IFunction {
|
|
879
|
-
(...arg: any): any;
|
|
880
|
-
}
|
|
881
|
-
interface INumberFunction {
|
|
882
|
-
(...arg: any): number;
|
|
883
|
-
}
|
|
884
|
-
interface IPointDataFunction {
|
|
885
|
-
(...arg: any): IPointData;
|
|
886
|
-
}
|
|
887
|
-
|
|
888
925
|
interface IRenderOptions {
|
|
926
|
+
includes?: boolean;
|
|
889
927
|
bounds?: IBounds;
|
|
890
928
|
hideBounds?: IBounds;
|
|
891
|
-
matrix?:
|
|
929
|
+
matrix?: IMatrixWithScaleData;
|
|
892
930
|
inCamera?: boolean;
|
|
893
931
|
}
|
|
894
932
|
interface IRendererConfig {
|
|
@@ -924,8 +962,10 @@ interface IRenderer extends IControl {
|
|
|
924
962
|
|
|
925
963
|
type ILeafDataProxyModule = ILeafDataProxy & ThisType<ILeaf>;
|
|
926
964
|
interface ILeafDataProxy {
|
|
927
|
-
__setAttr?(name: string, newValue:
|
|
928
|
-
__getAttr?(name: string):
|
|
965
|
+
__setAttr?(name: string, newValue: IValue): void;
|
|
966
|
+
__getAttr?(name: string): IValue;
|
|
967
|
+
setProxyAttr?(name: string, newValue: IValue): void;
|
|
968
|
+
getProxyAttr?(name: string): IValue;
|
|
929
969
|
}
|
|
930
970
|
|
|
931
971
|
type ILeafMatrixModule = ILeafMatrix & ThisType<ILeaf>;
|
|
@@ -937,33 +977,35 @@ interface ILeafMatrix {
|
|
|
937
977
|
type ILeafBoundsModule = ILeafBounds & ThisType<ILeaf>;
|
|
938
978
|
interface ILeafBounds {
|
|
939
979
|
__updateWorldBounds?(): void;
|
|
980
|
+
__updateLocalBounds?(): void;
|
|
940
981
|
__updateLocalBoxBounds?(): void;
|
|
941
982
|
__updateLocalStrokeBounds?(): void;
|
|
942
983
|
__updateLocalRenderBounds?(): void;
|
|
943
984
|
__updateBoxBounds?(): void;
|
|
944
985
|
__updateStrokeBounds?(): void;
|
|
945
986
|
__updateRenderBounds?(): void;
|
|
987
|
+
__updateAutoLayout?(): void;
|
|
946
988
|
__updateNaturalSize?(): void;
|
|
947
989
|
__updateStrokeSpread?(): number;
|
|
948
990
|
__updateRenderSpread?(): number;
|
|
949
991
|
__onUpdateSize?(): void;
|
|
950
992
|
}
|
|
951
993
|
|
|
952
|
-
type
|
|
953
|
-
type
|
|
994
|
+
type ILocationType = 'world' | 'local' | 'inner';
|
|
995
|
+
type IBoundsType = 'content' | 'box' | 'stroke' | 'margin' | 'render';
|
|
954
996
|
interface ILeafLayout {
|
|
955
997
|
leaf: ILeaf;
|
|
956
|
-
|
|
998
|
+
proxyZoom: boolean;
|
|
957
999
|
boxBounds: IBoundsData;
|
|
958
1000
|
strokeBounds: IBoundsData;
|
|
959
1001
|
renderBounds: IBoundsData;
|
|
960
1002
|
marginBounds: IBoundsData;
|
|
961
1003
|
contentBounds: IBoundsData;
|
|
962
|
-
localStrokeBounds
|
|
963
|
-
localRenderBounds
|
|
1004
|
+
localStrokeBounds?: IBoundsData;
|
|
1005
|
+
localRenderBounds?: IBoundsData;
|
|
1006
|
+
resized: boolean;
|
|
1007
|
+
waitAutoLayout: boolean;
|
|
964
1008
|
matrixChanged: boolean;
|
|
965
|
-
positionChanged: boolean;
|
|
966
|
-
originChanged?: boolean;
|
|
967
1009
|
scaleChanged: boolean;
|
|
968
1010
|
rotationChanged: boolean;
|
|
969
1011
|
boundsChanged: boolean;
|
|
@@ -982,9 +1024,22 @@ interface ILeafLayout {
|
|
|
982
1024
|
renderSpread: number;
|
|
983
1025
|
strokeBoxSpread: number;
|
|
984
1026
|
renderShapeSpread: number;
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
1027
|
+
a: number;
|
|
1028
|
+
b: number;
|
|
1029
|
+
c: number;
|
|
1030
|
+
d: number;
|
|
1031
|
+
e: number;
|
|
1032
|
+
f: number;
|
|
1033
|
+
x: number;
|
|
1034
|
+
y: number;
|
|
1035
|
+
width: number;
|
|
1036
|
+
height: number;
|
|
1037
|
+
createLocal(): void;
|
|
1038
|
+
update(): void;
|
|
1039
|
+
getTransform(relative?: ILocationType | ILeaf): IMatrixData;
|
|
1040
|
+
getBounds(type?: IBoundsType, relative?: ILocationType | ILeaf): IBoundsData;
|
|
1041
|
+
getLayoutBounds(type?: IBoundsType, relative?: ILocationType | ILeaf, unscale?: boolean): ILayoutBoundsData;
|
|
1042
|
+
getLayoutPoints(type?: IBoundsType, relative?: ILocationType | ILeaf): IPointData[];
|
|
988
1043
|
spreadStroke(): void;
|
|
989
1044
|
spreadRender(): void;
|
|
990
1045
|
spreadStrokeCancel(): void;
|
|
@@ -993,9 +1048,9 @@ interface ILeafLayout {
|
|
|
993
1048
|
localBoxChange(): void;
|
|
994
1049
|
strokeChange(): void;
|
|
995
1050
|
renderChange(): void;
|
|
996
|
-
positionChange(): void;
|
|
997
1051
|
scaleChange(): void;
|
|
998
1052
|
rotationChange(): void;
|
|
1053
|
+
matrixChange(): void;
|
|
999
1054
|
surfaceChange(): void;
|
|
1000
1055
|
opacityChange(): void;
|
|
1001
1056
|
childrenSortChange(): void;
|
|
@@ -1005,7 +1060,9 @@ interface ILeafLayout {
|
|
|
1005
1060
|
type ILeafHitModule = ILeafHit & ThisType<ILeaf>;
|
|
1006
1061
|
interface ILeafHit {
|
|
1007
1062
|
__hitWorld?(point: IRadiusPointData): boolean;
|
|
1008
|
-
__hit?(
|
|
1063
|
+
__hit?(inner: IRadiusPointData): boolean;
|
|
1064
|
+
__hitFill?(inner: IRadiusPointData, windingRule?: string): boolean;
|
|
1065
|
+
__hitStroke?(inner: IRadiusPointData, strokeWidth: number): boolean;
|
|
1009
1066
|
__drawHitPath?(canvas: ILeaferCanvas): void;
|
|
1010
1067
|
__updateHitCanvas?(): void;
|
|
1011
1068
|
}
|
|
@@ -1015,26 +1072,20 @@ interface ILeafRender {
|
|
|
1015
1072
|
__render?(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
1016
1073
|
__draw?(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
1017
1074
|
__drawFast?(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
1075
|
+
__clip?(_canvas: ILeaferCanvas, _options: IRenderOptions): void;
|
|
1018
1076
|
__renderShape?(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
1019
1077
|
__updateWorldOpacity?(): void;
|
|
1020
1078
|
__updateChange?(): void;
|
|
1021
1079
|
}
|
|
1022
1080
|
|
|
1023
|
-
|
|
1024
|
-
interface ILeafMask {
|
|
1025
|
-
__updateEraser?(value?: boolean): void;
|
|
1026
|
-
__updateMask?(value?: boolean): void;
|
|
1027
|
-
__renderMask?(canvas: ILeaferCanvas, content: ILeaferCanvas, mask: ILeaferCanvas): void;
|
|
1028
|
-
__removeMask?(child?: ILeaf): void;
|
|
1029
|
-
}
|
|
1030
|
-
|
|
1031
|
-
interface IDataProcessor extends IObject {
|
|
1081
|
+
interface IDataProcessor {
|
|
1032
1082
|
__leaf: ILeaf;
|
|
1033
1083
|
__input: IObject;
|
|
1034
1084
|
__middle: IObject;
|
|
1035
1085
|
__single: boolean;
|
|
1036
1086
|
__checkSingle(): void;
|
|
1037
1087
|
__get(name: string): any;
|
|
1088
|
+
__getData(): IObject;
|
|
1038
1089
|
__setInput(name: string, value: any): void;
|
|
1039
1090
|
__getInput(name: string): any;
|
|
1040
1091
|
__removeInput(name: string): void;
|
|
@@ -1043,88 +1094,149 @@ interface IDataProcessor extends IObject {
|
|
|
1043
1094
|
__getMiddle(name: string): any;
|
|
1044
1095
|
destroy(): void;
|
|
1045
1096
|
}
|
|
1097
|
+
interface ILeafDataOptions {
|
|
1098
|
+
attrs?: 'all' | string[];
|
|
1099
|
+
children?: boolean;
|
|
1100
|
+
}
|
|
1046
1101
|
interface ILeafData extends IDataProcessor, ILeafComputedData {
|
|
1047
1102
|
}
|
|
1048
1103
|
|
|
1104
|
+
interface IBranch extends ILeaf {
|
|
1105
|
+
children: ILeaf[];
|
|
1106
|
+
__renderBranch?(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
1107
|
+
addMany(...children: ILeaf[]): void;
|
|
1108
|
+
removeAll(destroy?: boolean): void;
|
|
1109
|
+
clear(): void;
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
interface IPickResult {
|
|
1113
|
+
target: ILeaf;
|
|
1114
|
+
path: ILeafList;
|
|
1115
|
+
throughPath?: ILeafList;
|
|
1116
|
+
}
|
|
1117
|
+
interface IPickOptions {
|
|
1118
|
+
name?: string;
|
|
1119
|
+
hitRadius?: number;
|
|
1120
|
+
through?: boolean;
|
|
1121
|
+
target?: IBranch;
|
|
1122
|
+
findList?: ILeaf[];
|
|
1123
|
+
exclude?: ILeafList;
|
|
1124
|
+
ignoreHittable?: boolean;
|
|
1125
|
+
}
|
|
1126
|
+
interface ISelectorConfig {
|
|
1127
|
+
}
|
|
1128
|
+
type IAnswer = 0 | 1 | 2 | 3;
|
|
1129
|
+
interface IFindMethod {
|
|
1130
|
+
(leaf: ILeaf, options?: any): IAnswer;
|
|
1131
|
+
}
|
|
1132
|
+
interface ISelectorProxy {
|
|
1133
|
+
list: ILeaf[];
|
|
1134
|
+
}
|
|
1135
|
+
interface ISelector {
|
|
1136
|
+
target: ILeaf;
|
|
1137
|
+
proxy?: ISelectorProxy;
|
|
1138
|
+
config: ISelectorConfig;
|
|
1139
|
+
getByPoint(hitPoint: IPointData, hitRadius: number, options?: IPickOptions): IPickResult;
|
|
1140
|
+
getBy(condition: number | string | IFindMethod, branch?: ILeaf, one?: boolean, options?: any): ILeaf | ILeaf[];
|
|
1141
|
+
getByInnerId(innerId: number, branch?: ILeaf): ILeaf;
|
|
1142
|
+
getById(id: string, branch?: ILeaf): ILeaf;
|
|
1143
|
+
getByClassName(className: string, branch?: ILeaf): ILeaf[];
|
|
1144
|
+
getByTag(tag: string, branch?: ILeaf): ILeaf[];
|
|
1145
|
+
getByMethod(method: IFindMethod, branch?: ILeaf, one?: boolean, options?: any): ILeaf | ILeaf[];
|
|
1146
|
+
destroy(): void;
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1049
1149
|
interface ICachedLeaf {
|
|
1050
1150
|
canvas: ILeaferCanvas;
|
|
1051
1151
|
matrix?: IMatrix;
|
|
1052
1152
|
bounds: IBoundsData;
|
|
1053
1153
|
}
|
|
1054
1154
|
interface ILeafAttrData {
|
|
1055
|
-
id:
|
|
1056
|
-
name:
|
|
1057
|
-
className:
|
|
1155
|
+
id: IString;
|
|
1156
|
+
name: IString;
|
|
1157
|
+
className: IString;
|
|
1058
1158
|
blendMode: IBlendMode;
|
|
1059
|
-
opacity:
|
|
1060
|
-
visible:
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1159
|
+
opacity: INumber;
|
|
1160
|
+
visible: IBoolean;
|
|
1161
|
+
locked: IBoolean;
|
|
1162
|
+
zIndex: INumber;
|
|
1163
|
+
mask: IBoolean;
|
|
1164
|
+
maskType: IMaskType;
|
|
1165
|
+
eraser: IBoolean;
|
|
1166
|
+
x: INumber;
|
|
1167
|
+
y: INumber;
|
|
1168
|
+
width: INumber;
|
|
1169
|
+
height: INumber;
|
|
1170
|
+
scaleX: INumber;
|
|
1171
|
+
scaleY: INumber;
|
|
1172
|
+
rotation: INumber;
|
|
1173
|
+
skewX: INumber;
|
|
1174
|
+
skewY: INumber;
|
|
1175
|
+
scale: INumber | IPointData;
|
|
1176
|
+
around: IAround;
|
|
1177
|
+
lazy: IBoolean;
|
|
1178
|
+
draggable: IBoolean;
|
|
1179
|
+
editable: IBoolean;
|
|
1180
|
+
editSize?: IEditSize;
|
|
1181
|
+
hittable: IBoolean;
|
|
1077
1182
|
hitFill: IHitType;
|
|
1078
1183
|
hitStroke: IHitType;
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1184
|
+
hitBox: IBoolean;
|
|
1185
|
+
hitChildren: IBoolean;
|
|
1186
|
+
hitSelf: IBoolean;
|
|
1187
|
+
hitRadius: INumber;
|
|
1082
1188
|
cursor: ICursorType | ICursorType[];
|
|
1083
1189
|
}
|
|
1084
1190
|
type IHitType = 'path' | 'pixel' | 'all' | 'none';
|
|
1085
|
-
type
|
|
1086
|
-
type
|
|
1191
|
+
type IMaskType = 'path' | 'pixel' | 'clipping';
|
|
1192
|
+
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';
|
|
1193
|
+
type IEditSize = 'size' | 'scale';
|
|
1087
1194
|
interface IImageCursor {
|
|
1088
1195
|
url: string;
|
|
1089
1196
|
x?: number;
|
|
1090
1197
|
y?: number;
|
|
1198
|
+
rotation?: number;
|
|
1091
1199
|
}
|
|
1092
|
-
type IAround = 'center' | IPointData;
|
|
1093
|
-
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
|
|
1094
|
-
interface
|
|
1095
|
-
[name: string]: ICursorType | ICursorType[];
|
|
1096
|
-
}
|
|
1097
|
-
interface ILeafInputData extends IObject {
|
|
1200
|
+
type IAround = 'topLeft' | 'top' | 'topRight' | 'right' | 'bottomRight' | 'bottom' | 'bottomLeft' | 'left' | 'center' | IPointData;
|
|
1201
|
+
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';
|
|
1202
|
+
interface ILeafInputData {
|
|
1098
1203
|
tag?: string;
|
|
1099
|
-
id?:
|
|
1100
|
-
name?:
|
|
1101
|
-
className?:
|
|
1204
|
+
id?: IString;
|
|
1205
|
+
name?: IString;
|
|
1206
|
+
className?: IString;
|
|
1102
1207
|
blendMode?: IBlendMode;
|
|
1103
|
-
opacity?:
|
|
1104
|
-
visible?:
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1208
|
+
opacity?: INumber;
|
|
1209
|
+
visible?: IBoolean;
|
|
1210
|
+
locked?: IBoolean;
|
|
1211
|
+
zIndex?: INumber;
|
|
1212
|
+
mask?: IBoolean;
|
|
1213
|
+
maskType?: IMaskType;
|
|
1214
|
+
eraser?: IBoolean;
|
|
1215
|
+
x?: INumber;
|
|
1216
|
+
y?: INumber;
|
|
1217
|
+
width?: INumber;
|
|
1218
|
+
height?: INumber;
|
|
1219
|
+
scaleX?: INumber;
|
|
1220
|
+
scaleY?: INumber;
|
|
1221
|
+
rotation?: INumber;
|
|
1222
|
+
skewX?: INumber;
|
|
1223
|
+
skewY?: INumber;
|
|
1224
|
+
scale?: INumber | IPointData;
|
|
1118
1225
|
around?: IAround;
|
|
1119
|
-
|
|
1120
|
-
|
|
1226
|
+
lazy?: IBoolean;
|
|
1227
|
+
draggable?: IBoolean;
|
|
1228
|
+
editable?: IBoolean;
|
|
1229
|
+
editSize?: IEditSize;
|
|
1230
|
+
hittable?: IBoolean;
|
|
1121
1231
|
hitFill?: IHitType;
|
|
1122
1232
|
hitStroke?: IHitType;
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1233
|
+
hitBox?: IBoolean;
|
|
1234
|
+
hitChildren?: IBoolean;
|
|
1235
|
+
hitSelf?: IBoolean;
|
|
1236
|
+
hitRadius?: INumber;
|
|
1126
1237
|
cursor?: ICursorType | ICursorType[];
|
|
1127
1238
|
children?: ILeafInputData[];
|
|
1239
|
+
noBounds?: boolean;
|
|
1128
1240
|
}
|
|
1129
1241
|
interface ILeafComputedData {
|
|
1130
1242
|
id?: string;
|
|
@@ -1133,9 +1245,11 @@ interface ILeafComputedData {
|
|
|
1133
1245
|
blendMode?: IBlendMode;
|
|
1134
1246
|
opacity?: number;
|
|
1135
1247
|
visible?: boolean;
|
|
1136
|
-
|
|
1137
|
-
isEraser?: boolean;
|
|
1248
|
+
locked?: boolean;
|
|
1138
1249
|
zIndex?: number;
|
|
1250
|
+
mask?: boolean;
|
|
1251
|
+
maskType?: IMaskType;
|
|
1252
|
+
eraser?: boolean;
|
|
1139
1253
|
x?: number;
|
|
1140
1254
|
y?: number;
|
|
1141
1255
|
width?: number;
|
|
@@ -1146,10 +1260,15 @@ interface ILeafComputedData {
|
|
|
1146
1260
|
skewX?: number;
|
|
1147
1261
|
skewY?: number;
|
|
1148
1262
|
around?: IAround;
|
|
1263
|
+
lazy?: boolean;
|
|
1264
|
+
windingRule?: any;
|
|
1149
1265
|
draggable?: boolean;
|
|
1266
|
+
editable?: boolean;
|
|
1267
|
+
editSize?: IEditSize;
|
|
1150
1268
|
hittable?: boolean;
|
|
1151
1269
|
hitFill?: IHitType;
|
|
1152
1270
|
hitStroke?: IHitType;
|
|
1271
|
+
hitBox?: boolean;
|
|
1153
1272
|
hitChildren?: boolean;
|
|
1154
1273
|
hitSelf?: boolean;
|
|
1155
1274
|
hitRadius?: number;
|
|
@@ -1158,36 +1277,44 @@ interface ILeafComputedData {
|
|
|
1158
1277
|
__complex?: boolean;
|
|
1159
1278
|
__naturalWidth?: number;
|
|
1160
1279
|
__naturalHeight?: number;
|
|
1280
|
+
readonly __blendMode: string;
|
|
1161
1281
|
}
|
|
1162
|
-
interface ILeaf extends
|
|
1282
|
+
interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDataProxy, ILeafInputData, IEventer {
|
|
1163
1283
|
tag: string;
|
|
1164
1284
|
readonly __tag: string;
|
|
1165
1285
|
readonly innerName: string;
|
|
1166
1286
|
readonly __DataProcessor: IObject;
|
|
1167
1287
|
readonly __LayoutProcessor: IObject;
|
|
1168
|
-
|
|
1288
|
+
readonly app?: ILeaferBase;
|
|
1289
|
+
leafer?: ILeaferBase;
|
|
1169
1290
|
parent?: ILeaf;
|
|
1170
1291
|
readonly isApp?: boolean;
|
|
1171
1292
|
isLeafer?: boolean;
|
|
1172
1293
|
isBranch?: boolean;
|
|
1173
1294
|
isBranchLeaf?: boolean;
|
|
1174
1295
|
__: ILeafData;
|
|
1296
|
+
proxyData?: ILeafInputData;
|
|
1297
|
+
__proxyData?: ILeafInputData;
|
|
1175
1298
|
__layout: ILeafLayout;
|
|
1176
|
-
__world:
|
|
1177
|
-
__local
|
|
1299
|
+
__world: IMatrixWithBoundsScaleData;
|
|
1300
|
+
__local?: IMatrixWithBoundsData;
|
|
1301
|
+
__nowWorld?: IMatrixWithBoundsScaleData;
|
|
1302
|
+
__cameraWorld?: IMatrixWithBoundsScaleData;
|
|
1303
|
+
readonly __localMatrix: IMatrixData;
|
|
1304
|
+
readonly __localBoxBounds: IBoundsData;
|
|
1178
1305
|
__worldOpacity: number;
|
|
1179
|
-
readonly worldTransform:
|
|
1180
|
-
readonly localTransform:
|
|
1306
|
+
readonly worldTransform: IMatrixData;
|
|
1307
|
+
readonly localTransform: IMatrixData;
|
|
1181
1308
|
readonly boxBounds: IBoundsData;
|
|
1309
|
+
readonly renderBounds: IBoundsData;
|
|
1182
1310
|
readonly worldBoxBounds: IBoundsData;
|
|
1183
1311
|
readonly worldStrokeBounds: IBoundsData;
|
|
1184
1312
|
readonly worldRenderBounds: IBoundsData;
|
|
1185
1313
|
readonly worldOpacity: number;
|
|
1186
|
-
__renderTime?: number;
|
|
1187
1314
|
__level: number;
|
|
1188
1315
|
__tempNumber?: number;
|
|
1189
|
-
readonly
|
|
1190
|
-
|
|
1316
|
+
readonly __worldFlipped: boolean;
|
|
1317
|
+
__hasAutoLayout?: boolean;
|
|
1191
1318
|
__hasMask?: boolean;
|
|
1192
1319
|
__hasEraser?: boolean;
|
|
1193
1320
|
__hitCanvas?: IHitCanvas;
|
|
@@ -1196,35 +1323,48 @@ interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, ILeafMatr
|
|
|
1196
1323
|
__parentWait?: IFunction[];
|
|
1197
1324
|
__leaferWait?: IFunction[];
|
|
1198
1325
|
destroyed: boolean;
|
|
1326
|
+
reset(data?: ILeafInputData): void;
|
|
1327
|
+
resetCustom(): void;
|
|
1199
1328
|
waitParent(item: IFunction): void;
|
|
1200
1329
|
waitLeafer(item: IFunction): void;
|
|
1201
|
-
nextRender(item: IFunction): void;
|
|
1202
|
-
__bindLeafer(leafer:
|
|
1330
|
+
nextRender(item: IFunction, off?: 'off'): void;
|
|
1331
|
+
__bindLeafer(leafer: ILeaferBase | null): void;
|
|
1203
1332
|
set(data: IObject): void;
|
|
1333
|
+
get(): ILeafInputData;
|
|
1204
1334
|
toJSON(): IObject;
|
|
1205
1335
|
toString(): string;
|
|
1206
|
-
|
|
1207
|
-
|
|
1336
|
+
toSVG?(): string;
|
|
1337
|
+
toHTML?(): string;
|
|
1338
|
+
__setAttr(attrName: string, newValue: IValue): void;
|
|
1339
|
+
__getAttr(attrName: string): IValue;
|
|
1340
|
+
setProxyAttr(name: string, newValue: IValue): void;
|
|
1341
|
+
getProxyAttr(name: string): IValue;
|
|
1342
|
+
find(condition: number | string | IFindMethod, options?: any): ILeaf[];
|
|
1343
|
+
findOne(condition: number | string | IFindMethod, options?: any): ILeaf;
|
|
1208
1344
|
forceUpdate(attrName?: string): void;
|
|
1345
|
+
updateLayout(): void;
|
|
1209
1346
|
__updateWorldMatrix(): void;
|
|
1210
1347
|
__updateLocalMatrix(): void;
|
|
1211
1348
|
__updateWorldBounds(): void;
|
|
1349
|
+
__updateLocalBounds(): void;
|
|
1212
1350
|
__updateLocalBoxBounds(): void;
|
|
1213
1351
|
__updateLocalStrokeBounds(): void;
|
|
1214
1352
|
__updateLocalRenderBounds(): void;
|
|
1215
1353
|
__updateBoxBounds(): void;
|
|
1216
1354
|
__updateStrokeBounds(): void;
|
|
1217
1355
|
__updateRenderBounds(): void;
|
|
1356
|
+
__updateAutoLayout(): void;
|
|
1218
1357
|
__updateNaturalSize(): void;
|
|
1219
1358
|
__updateStrokeSpread(): number;
|
|
1220
1359
|
__updateRenderSpread(): number;
|
|
1221
1360
|
__onUpdateSize(): void;
|
|
1222
1361
|
__updateEraser(value?: boolean): void;
|
|
1223
1362
|
__updateMask(value?: boolean): void;
|
|
1224
|
-
__renderMask(canvas: ILeaferCanvas,
|
|
1225
|
-
|
|
1226
|
-
getWorld(attrName:
|
|
1227
|
-
getBounds(type
|
|
1363
|
+
__renderMask(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
1364
|
+
__getNowWorld(options: IRenderOptions): IMatrixWithBoundsScaleData;
|
|
1365
|
+
getWorld(attrName: ILayoutAttr): number;
|
|
1366
|
+
getBounds(type?: IBoundsType, relative?: ILocationType | ILeaf): IBoundsData;
|
|
1367
|
+
getLayoutBounds(type?: IBoundsType, relative?: ILocationType | ILeaf, unscale?: boolean): ILayoutBoundsData;
|
|
1228
1368
|
worldToLocal(world: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void;
|
|
1229
1369
|
localToWorld(local: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void;
|
|
1230
1370
|
worldToInner(world: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void;
|
|
@@ -1235,17 +1375,26 @@ interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, ILeafMatr
|
|
|
1235
1375
|
getLocalPointByInner(inner: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
|
|
1236
1376
|
getWorldPoint(inner: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
|
|
1237
1377
|
getWorldPointByLocal(local: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
|
|
1378
|
+
getPagePoint(world: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
|
|
1379
|
+
getWorldPointByPage(page: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
|
|
1380
|
+
setTransform(transform?: IMatrixData, resize?: boolean): void;
|
|
1381
|
+
transform(transform?: IMatrixData, resize?: boolean): void;
|
|
1238
1382
|
move(x: number, y?: number): void;
|
|
1239
|
-
scaleOf(origin: IPointData,
|
|
1383
|
+
scaleOf(origin: IPointData, scaleX: number, scaleY?: number, resize?: boolean): void;
|
|
1240
1384
|
rotateOf(origin: IPointData, rotation: number): void;
|
|
1241
|
-
skewOf(origin: IPointData,
|
|
1385
|
+
skewOf(origin: IPointData, skewX: number, skewY?: number, resize?: boolean): void;
|
|
1386
|
+
scaleResize(scaleX: number, scaleY: number, noResize?: boolean): void;
|
|
1387
|
+
__scaleResize(scaleX: number, scaleY: number): void;
|
|
1242
1388
|
__hitWorld(point: IRadiusPointData): boolean;
|
|
1243
1389
|
__hit(local: IRadiusPointData): boolean;
|
|
1390
|
+
__hitFill(inner: IRadiusPointData, windingRule?: string): boolean;
|
|
1391
|
+
__hitStroke(inner: IRadiusPointData, strokeWidth: number): boolean;
|
|
1244
1392
|
__drawHitPath(canvas: ILeaferCanvas): void;
|
|
1245
1393
|
__updateHitCanvas(): void;
|
|
1246
1394
|
__render(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
1247
1395
|
__drawFast(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
1248
1396
|
__draw(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
1397
|
+
__clip(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
1249
1398
|
__renderShape(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
1250
1399
|
__updateWorldOpacity(): void;
|
|
1251
1400
|
__updateChange(): void;
|
|
@@ -1257,36 +1406,9 @@ interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, ILeafMatr
|
|
|
1257
1406
|
__updateSortChildren(): void;
|
|
1258
1407
|
add(child: ILeaf, index?: number): void;
|
|
1259
1408
|
remove(child?: ILeaf, destroy?: boolean): void;
|
|
1409
|
+
dropTo(parent: ILeaf, index?: number, resize?: boolean): void;
|
|
1260
1410
|
}
|
|
1261
1411
|
|
|
1262
|
-
interface ISelectPathResult {
|
|
1263
|
-
leaf: ILeaf;
|
|
1264
|
-
path: ILeafList;
|
|
1265
|
-
throughPath?: ILeafList;
|
|
1266
|
-
}
|
|
1267
|
-
interface ISelectPathOptions {
|
|
1268
|
-
name?: string;
|
|
1269
|
-
through?: boolean;
|
|
1270
|
-
exclude?: ILeafList;
|
|
1271
|
-
ignoreHittable?: boolean;
|
|
1272
|
-
}
|
|
1273
|
-
interface ISelectorConfig {
|
|
1274
|
-
}
|
|
1275
|
-
interface ISelector {
|
|
1276
|
-
target: ILeaf;
|
|
1277
|
-
config: ISelectorConfig;
|
|
1278
|
-
getByPoint(hitPoint: IPointData, hitRadius: number, options?: ISelectPathOptions): ISelectPathResult;
|
|
1279
|
-
find(name: number | string, branch?: ILeaf): ILeaf | ILeaf[];
|
|
1280
|
-
getByInnerId(name: number, branch?: ILeaf): ILeaf;
|
|
1281
|
-
getById(name: string, branch?: ILeaf): ILeaf;
|
|
1282
|
-
getByClassName(name: string, branch?: ILeaf): ILeaf[];
|
|
1283
|
-
getByTagName(name: string, branch?: ILeaf): ILeaf[];
|
|
1284
|
-
destroy(): void;
|
|
1285
|
-
}
|
|
1286
|
-
|
|
1287
|
-
type IExportImageType = 'jpg' | 'png' | 'webp';
|
|
1288
|
-
type IExportFileType = IExportImageType | 'svg' | 'pdf' | 'json';
|
|
1289
|
-
|
|
1290
1412
|
interface ILeaferImageConfig {
|
|
1291
1413
|
url: string;
|
|
1292
1414
|
thumb?: string;
|
|
@@ -1298,6 +1420,13 @@ interface ILeaferImageOnLoaded {
|
|
|
1298
1420
|
interface ILeaferImageOnError {
|
|
1299
1421
|
(error?: string | IObject, image?: ILeaferImage): any;
|
|
1300
1422
|
}
|
|
1423
|
+
interface ILeaferImageCacheCanvas {
|
|
1424
|
+
data: IObject;
|
|
1425
|
+
params: IArguments;
|
|
1426
|
+
}
|
|
1427
|
+
interface ILeaferImagePatternPaint {
|
|
1428
|
+
transform: IMatrixData;
|
|
1429
|
+
}
|
|
1301
1430
|
interface ILeaferImage {
|
|
1302
1431
|
readonly innerId: InnerId;
|
|
1303
1432
|
readonly url: string;
|
|
@@ -1305,6 +1434,7 @@ interface ILeaferImage {
|
|
|
1305
1434
|
width: number;
|
|
1306
1435
|
height: number;
|
|
1307
1436
|
isSVG: boolean;
|
|
1437
|
+
hasOpacityPixel: boolean;
|
|
1308
1438
|
readonly completed: boolean;
|
|
1309
1439
|
ready: boolean;
|
|
1310
1440
|
error: IObject;
|
|
@@ -1314,6 +1444,7 @@ interface ILeaferImage {
|
|
|
1314
1444
|
load(onSuccess?: ILeaferImageOnLoaded, onError?: ILeaferImageOnError): number;
|
|
1315
1445
|
unload(index: number, stopEvent?: boolean): void;
|
|
1316
1446
|
getCanvas(width: number, height: number, opacity?: number, _filters?: IObject): unknown;
|
|
1447
|
+
getPattern(canvas: any, repeat: string | null, transform?: IMatrixData, paint?: IObject): ICanvasPattern;
|
|
1317
1448
|
destroy(): void;
|
|
1318
1449
|
}
|
|
1319
1450
|
|
|
@@ -1331,9 +1462,9 @@ interface IUIEvent extends IEvent {
|
|
|
1331
1462
|
buttons?: number;
|
|
1332
1463
|
path?: ILeafList;
|
|
1333
1464
|
throughPath?: ILeafList;
|
|
1334
|
-
|
|
1335
|
-
getInner?(
|
|
1336
|
-
getLocal?(
|
|
1465
|
+
getPage?(): IPointData;
|
|
1466
|
+
getInner?(relative?: ILeaf): IPointData;
|
|
1467
|
+
getLocal?(relative?: ILeaf): IPointData;
|
|
1337
1468
|
}
|
|
1338
1469
|
interface IPointerEvent extends IUIEvent {
|
|
1339
1470
|
width?: number;
|
|
@@ -1351,10 +1482,12 @@ interface IDragEvent extends IPointerEvent {
|
|
|
1351
1482
|
moveY: number;
|
|
1352
1483
|
totalX?: number;
|
|
1353
1484
|
totalY?: number;
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1485
|
+
getPageMove?(total?: boolean): IPointData;
|
|
1486
|
+
getInnerMove?(relative?: ILeaf): IPointData;
|
|
1487
|
+
getLocalMove?(relative?: ILeaf): IPointData;
|
|
1488
|
+
getPageTotal?(): IPointData;
|
|
1489
|
+
getInnerTotal?(relative?: ILeaf): IPointData;
|
|
1490
|
+
getLocalTotal?(relative?: ILeaf): IPointData;
|
|
1358
1491
|
}
|
|
1359
1492
|
interface IDropEvent extends IPointerEvent {
|
|
1360
1493
|
list: ILeafList;
|
|
@@ -1387,6 +1520,8 @@ interface IInteraction extends IControl {
|
|
|
1387
1520
|
selector: ISelector;
|
|
1388
1521
|
running: boolean;
|
|
1389
1522
|
readonly dragging: boolean;
|
|
1523
|
+
readonly isDragEmpty: boolean;
|
|
1524
|
+
readonly isHoldRightKey: boolean;
|
|
1390
1525
|
readonly moveMode: boolean;
|
|
1391
1526
|
config: IInteractionConfig;
|
|
1392
1527
|
cursor: ICursorType | ICursorType[];
|
|
@@ -1407,10 +1542,12 @@ interface IInteraction extends IControl {
|
|
|
1407
1542
|
rotate(data: IRotateEvent): void;
|
|
1408
1543
|
keyDown(data: IKeyEvent): void;
|
|
1409
1544
|
keyUp(data: IKeyEvent): void;
|
|
1410
|
-
findPath(data: IPointerEvent, options?:
|
|
1411
|
-
|
|
1545
|
+
findPath(data: IPointerEvent, options?: IPickOptions): ILeafList;
|
|
1546
|
+
isDrag(leaf: ILeaf): boolean;
|
|
1547
|
+
updateDownData(data?: IPointerEvent, options?: IPickOptions): void;
|
|
1412
1548
|
updateHoverData(data: IPointerEvent): void;
|
|
1413
1549
|
updateCursor(hoverData?: IPointerEvent): void;
|
|
1550
|
+
setCursor(cursor: ICursorType | ICursorType[]): void;
|
|
1414
1551
|
emit(type: string, data: IUIEvent, path?: ILeafList, excludePath?: ILeafList): void;
|
|
1415
1552
|
}
|
|
1416
1553
|
interface IInteractionCanvas extends ILeaferCanvas {
|
|
@@ -1418,6 +1555,7 @@ interface IInteractionCanvas extends ILeaferCanvas {
|
|
|
1418
1555
|
interface IInteractionConfig {
|
|
1419
1556
|
wheel?: IWheelConfig;
|
|
1420
1557
|
pointer?: IPointerConfig;
|
|
1558
|
+
cursor?: ICursorConfig;
|
|
1421
1559
|
zoom?: IZoomConfig;
|
|
1422
1560
|
move?: IMoveConfig;
|
|
1423
1561
|
eventer?: IObject;
|
|
@@ -1428,12 +1566,15 @@ interface IZoomConfig {
|
|
|
1428
1566
|
}
|
|
1429
1567
|
interface IMoveConfig {
|
|
1430
1568
|
holdSpaceKey?: boolean;
|
|
1569
|
+
holdMiddleKey?: boolean;
|
|
1570
|
+
holdRightKey?: boolean;
|
|
1571
|
+
drag?: boolean;
|
|
1431
1572
|
dragEmpty?: boolean;
|
|
1432
1573
|
dragOut?: boolean;
|
|
1433
1574
|
autoDistance?: number;
|
|
1434
1575
|
}
|
|
1435
1576
|
interface IWheelConfig {
|
|
1436
|
-
zoomMode?: boolean;
|
|
1577
|
+
zoomMode?: boolean | 'mouse';
|
|
1437
1578
|
zoomSpeed?: number;
|
|
1438
1579
|
moveSpeed?: number;
|
|
1439
1580
|
rotateSpeed?: number;
|
|
@@ -1454,6 +1595,10 @@ interface IPointerConfig {
|
|
|
1454
1595
|
swipeDistance?: number;
|
|
1455
1596
|
ignoreMove?: boolean;
|
|
1456
1597
|
preventDefault?: boolean;
|
|
1598
|
+
preventDefaultMenu?: boolean;
|
|
1599
|
+
}
|
|
1600
|
+
interface ICursorConfig {
|
|
1601
|
+
stop?: boolean;
|
|
1457
1602
|
}
|
|
1458
1603
|
|
|
1459
1604
|
interface IHitCanvasManager extends ICanvasManager {
|
|
@@ -1461,35 +1606,26 @@ interface IHitCanvasManager extends ICanvasManager {
|
|
|
1461
1606
|
getImageType(leaf: ILeaf, size: IScreenSizeData): IHitCanvas;
|
|
1462
1607
|
}
|
|
1463
1608
|
|
|
1464
|
-
interface IBranch extends ILeaf {
|
|
1465
|
-
children: ILeaf[];
|
|
1466
|
-
__renderBranch?(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
1467
|
-
addMany(...children: ILeaf[]): void;
|
|
1468
|
-
removeAll(destroy?: boolean): void;
|
|
1469
|
-
}
|
|
1470
|
-
|
|
1471
1609
|
interface IZoomView extends IBranch {
|
|
1472
1610
|
zoomLayer?: ILeaf;
|
|
1473
|
-
|
|
1474
|
-
transformData?: ITransformEventData;
|
|
1475
|
-
setZoomLayer(zoomLayer: ILeaf, moveLayer?: ILeaf): void;
|
|
1611
|
+
setZoomLayer(zoomLayer: ILeaf): void;
|
|
1476
1612
|
}
|
|
1477
1613
|
|
|
1478
|
-
type ILeaferType = 'draw' | 'design' | 'board' | 'document' | '
|
|
1614
|
+
type ILeaferType = 'draw' | 'design' | 'board' | 'document' | 'app' | 'game' | 'player' | 'chart';
|
|
1479
1615
|
interface ILeaferConfig extends IRendererConfig, ILeaferCanvasConfig, IInteractionConfig, ILayouterConfig {
|
|
1480
1616
|
start?: boolean;
|
|
1481
1617
|
type?: ILeaferType;
|
|
1482
1618
|
realCanvas?: boolean;
|
|
1483
1619
|
}
|
|
1484
|
-
interface
|
|
1485
|
-
readonly isApp: boolean;
|
|
1486
|
-
readonly app: ILeafer;
|
|
1487
|
-
parent?: IApp;
|
|
1620
|
+
interface ILeaferAttrData {
|
|
1488
1621
|
running: boolean;
|
|
1489
1622
|
created: boolean;
|
|
1490
1623
|
ready: boolean;
|
|
1491
1624
|
viewReady: boolean;
|
|
1625
|
+
imageReady: boolean;
|
|
1492
1626
|
viewCompleted: boolean;
|
|
1627
|
+
layoutLocked: boolean;
|
|
1628
|
+
transforming: boolean;
|
|
1493
1629
|
pixelRatio: number;
|
|
1494
1630
|
view: unknown;
|
|
1495
1631
|
canvas: ILeaferCanvas;
|
|
@@ -1502,24 +1638,36 @@ interface ILeafer extends IZoomView, IControl {
|
|
|
1502
1638
|
hitCanvasManager?: IHitCanvasManager;
|
|
1503
1639
|
autoLayout?: IAutoBounds;
|
|
1504
1640
|
config: ILeaferConfig;
|
|
1641
|
+
readonly cursorPoint: IPointData;
|
|
1642
|
+
leafs: number;
|
|
1505
1643
|
__eventIds: IEventListenerId[];
|
|
1506
1644
|
__nextRenderWait: IFunction[];
|
|
1507
|
-
init(userConfig?: ILeaferConfig, parentApp?:
|
|
1508
|
-
|
|
1645
|
+
init(userConfig?: ILeaferConfig, parentApp?: IAppBase): void;
|
|
1646
|
+
start(): void;
|
|
1647
|
+
stop(): void;
|
|
1648
|
+
unlockLayout(): void;
|
|
1649
|
+
lockLayout(): void;
|
|
1650
|
+
setZoomLayer(zoomLayer: ILeaf): void;
|
|
1509
1651
|
forceFullRender(): void;
|
|
1510
|
-
|
|
1652
|
+
forceRender(bounds?: IBoundsData): void;
|
|
1653
|
+
updateCursor(cursor?: ICursorType): void;
|
|
1511
1654
|
resize(size: IScreenSizeData): void;
|
|
1512
1655
|
waitReady(item: IFunction): void;
|
|
1513
1656
|
waitViewReady(item: IFunction): void;
|
|
1514
1657
|
waitViewCompleted(item: IFunction): void;
|
|
1515
1658
|
}
|
|
1659
|
+
interface ILeaferBase extends IZoomView, IControl, ILeaferAttrData {
|
|
1660
|
+
readonly isApp: boolean;
|
|
1661
|
+
readonly app: ILeaferBase;
|
|
1662
|
+
parent?: IAppBase;
|
|
1663
|
+
}
|
|
1516
1664
|
interface ILeaferTypeCreator {
|
|
1517
1665
|
list: ILeaferTypeList;
|
|
1518
1666
|
register(name: string, fn: ILeaferTypeFunction): void;
|
|
1519
|
-
run(name: string, leafer:
|
|
1667
|
+
run(name: string, leafer: ILeaferBase): void;
|
|
1520
1668
|
}
|
|
1521
1669
|
interface ILeaferTypeFunction {
|
|
1522
|
-
(leafer:
|
|
1670
|
+
(leafer: ILeaferBase): void;
|
|
1523
1671
|
}
|
|
1524
1672
|
interface ILeaferTypeList {
|
|
1525
1673
|
[key: string]: ILeaferTypeFunction;
|
|
@@ -1528,19 +1676,21 @@ interface ICreator {
|
|
|
1528
1676
|
image?(options?: ILeaferImageConfig): ILeaferImage;
|
|
1529
1677
|
canvas?(options?: ILeaferCanvasConfig, manager?: ICanvasManager): ILeaferCanvas;
|
|
1530
1678
|
hitCanvas?(options?: IHitCanvasConfig, manager?: ICanvasManager): IHitCanvas;
|
|
1679
|
+
hitCanvasManager?(): IHitCanvasManager;
|
|
1531
1680
|
watcher?(target: ILeaf, options?: IWatcherConfig): IWatcher;
|
|
1532
1681
|
layouter?(target: ILeaf, options?: ILayouterConfig): ILayouter;
|
|
1533
1682
|
renderer?(target: ILeaf, canvas: ILeaferCanvas, options?: IRendererConfig): IRenderer;
|
|
1534
1683
|
selector?(target: ILeaf, options?: ISelectorConfig): ISelector;
|
|
1535
1684
|
interaction?(target: ILeaf, canvas: IInteractionCanvas, selector: ISelector, options?: IInteractionConfig): IInteraction;
|
|
1685
|
+
editor?(options?: IObject): ILeaf;
|
|
1536
1686
|
}
|
|
1537
1687
|
interface IUICreator {
|
|
1538
1688
|
register(UI: IObject): void;
|
|
1539
1689
|
get(tag: string, data: IObject): IObject;
|
|
1540
1690
|
}
|
|
1541
1691
|
|
|
1542
|
-
interface
|
|
1543
|
-
children:
|
|
1692
|
+
interface IAppBase extends ILeaferBase {
|
|
1693
|
+
children: ILeaferBase[];
|
|
1544
1694
|
realCanvas: boolean;
|
|
1545
1695
|
}
|
|
1546
1696
|
|
|
@@ -1601,14 +1751,46 @@ interface IImageManager {
|
|
|
1601
1751
|
get(config: ILeaferImageConfig): ILeaferImage;
|
|
1602
1752
|
recycle(image: ILeaferImage): void;
|
|
1603
1753
|
clearRecycled(): void;
|
|
1754
|
+
hasOpacityPixel(config: ILeaferImageConfig): boolean;
|
|
1755
|
+
isFormat(format: IExportFileType, config: ILeaferImageConfig): boolean;
|
|
1604
1756
|
destroy(): void;
|
|
1605
1757
|
}
|
|
1606
1758
|
|
|
1759
|
+
type ICanvasType = 'skia' | 'napi' | 'canvas' | 'wx';
|
|
1760
|
+
interface ISkiaCanvas {
|
|
1761
|
+
toBuffer(format: IExportFileType, config: ISkiaCanvasExportConfig): Promise<any>;
|
|
1762
|
+
toBufferSync(format: IExportFileType, config: ISkiaCanvasExportConfig): any;
|
|
1763
|
+
toDataURL(format: IExportImageType, config: ISkiaCanvasExportConfig): Promise<string>;
|
|
1764
|
+
toDataURLSync(format: IExportImageType, config: ISkiaCanvasExportConfig): string;
|
|
1765
|
+
saveAs(filename: string, config: ISkiaCanvasExportConfig): Promise<void>;
|
|
1766
|
+
saveAsSync(filename: string, config: ISkiaCanvasExportConfig): void;
|
|
1767
|
+
}
|
|
1768
|
+
interface ISkiaCanvasExportConfig {
|
|
1769
|
+
page?: number;
|
|
1770
|
+
matte?: string;
|
|
1771
|
+
density?: number;
|
|
1772
|
+
quality?: number;
|
|
1773
|
+
outline?: boolean;
|
|
1774
|
+
}
|
|
1775
|
+
interface ISkiaNAPICanvas {
|
|
1776
|
+
encodeSync(format: 'webp' | 'jpeg', quality?: number): any;
|
|
1777
|
+
encodeSync(format: 'png'): any;
|
|
1778
|
+
encode(format: 'webp' | 'jpeg' | string, quality?: number): Promise<any>;
|
|
1779
|
+
encode(format: 'png'): Promise<any>;
|
|
1780
|
+
toBuffer(mime: 'image/png'): any;
|
|
1781
|
+
toBuffer(mime: 'image/jpeg' | 'image/webp' | string, quality?: number): any;
|
|
1782
|
+
toDataURL(mime?: 'image/png'): string;
|
|
1783
|
+
toDataURL(mime: 'image/jpeg' | 'image/webp' | string, quality?: number): string;
|
|
1784
|
+
toDataURLAsync(mime?: 'image/png'): Promise<string>;
|
|
1785
|
+
toDataURLAsync(mime: 'image/jpeg' | 'image/webp' | string, quality?: number): Promise<string>;
|
|
1786
|
+
}
|
|
1787
|
+
|
|
1607
1788
|
interface IPlatform {
|
|
1608
1789
|
name?: 'web' | 'node' | 'miniapp';
|
|
1609
1790
|
os?: 'Mac' | 'Windows' | 'Linux';
|
|
1610
1791
|
requestRender?(render: IFunction): void;
|
|
1611
1792
|
canvas?: ILeaferCanvas;
|
|
1793
|
+
canvasType?: ICanvasType;
|
|
1612
1794
|
isWorker?: boolean;
|
|
1613
1795
|
isMobile?: boolean;
|
|
1614
1796
|
devicePixelRatio?: number;
|
|
@@ -1618,7 +1800,6 @@ interface IPlatform {
|
|
|
1618
1800
|
fullImageShadow?: boolean;
|
|
1619
1801
|
syncDomFont?: boolean;
|
|
1620
1802
|
layout?(target: ILeaf): void;
|
|
1621
|
-
realtimeLayout?: boolean;
|
|
1622
1803
|
origin?: {
|
|
1623
1804
|
createCanvas(width: number, height: number, format?: 'svg' | 'pdf'): any;
|
|
1624
1805
|
canvasToDataURL(canvas: any, type?: IExportImageType, quality?: number): string | Promise<string>;
|
|
@@ -1627,8 +1808,20 @@ interface IPlatform {
|
|
|
1627
1808
|
loadImage(url: string): Promise<any>;
|
|
1628
1809
|
noRepeat?: string;
|
|
1629
1810
|
};
|
|
1811
|
+
roundRectPatch?: boolean;
|
|
1812
|
+
ellipseToCurve?: boolean;
|
|
1813
|
+
event?: {
|
|
1814
|
+
stopDefault(origin: IObject): void;
|
|
1815
|
+
stopNow(origin: IObject): void;
|
|
1816
|
+
stop(origin: IObject): void;
|
|
1817
|
+
};
|
|
1630
1818
|
miniapp?: IMiniapp;
|
|
1631
|
-
|
|
1819
|
+
image: {
|
|
1820
|
+
maxCacheSize: number;
|
|
1821
|
+
maxPatternSize: number;
|
|
1822
|
+
suffix: string;
|
|
1823
|
+
crossOrigin: string | false;
|
|
1824
|
+
};
|
|
1632
1825
|
}
|
|
1633
1826
|
interface IMiniappSelect extends IObject {
|
|
1634
1827
|
}
|
|
@@ -1649,24 +1842,18 @@ interface IPlugin extends IObject {
|
|
|
1649
1842
|
importVersion: string;
|
|
1650
1843
|
import: string[];
|
|
1651
1844
|
run(LeaferUI: IObject, config: IObject): void;
|
|
1652
|
-
onLeafer?(leafer:
|
|
1845
|
+
onLeafer?(leafer: ILeaferBase): void;
|
|
1653
1846
|
}
|
|
1654
1847
|
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
toBuffer(format: IExportFileType, config: ISkiaCanvasExportConfig): Promise<any>;
|
|
1658
|
-
toBufferSync(format: IExportFileType, config: ISkiaCanvasExportConfig): any;
|
|
1659
|
-
toDataURL(format: IExportImageType, config: ISkiaCanvasExportConfig): Promise<string>;
|
|
1660
|
-
toDataURLSync(format: IExportImageType, config: ISkiaCanvasExportConfig): string;
|
|
1661
|
-
saveAs(filename: string, config: ISkiaCanvasExportConfig): Promise<void>;
|
|
1662
|
-
saveAsSync(filename: string, config: ISkiaCanvasExportConfig): void;
|
|
1848
|
+
interface ICursorTypeMap {
|
|
1849
|
+
[name: string]: ICursorType | ICursorType[];
|
|
1663
1850
|
}
|
|
1664
|
-
interface
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1851
|
+
interface ICursorRotate {
|
|
1852
|
+
rotation?: number;
|
|
1853
|
+
data?: string;
|
|
1854
|
+
}
|
|
1855
|
+
interface ICursorRotateMap {
|
|
1856
|
+
[name: string]: ICursorRotate;
|
|
1670
1857
|
}
|
|
1671
1858
|
|
|
1672
|
-
export type { ACommandData, ArcCommandData, ArcToCommandData, CCommandData, CanvasPathCommand, EllipseCommandData, HCommandData, IAnimateEvent,
|
|
1859
|
+
export type { ACommandData, ArcCommandData, ArcToCommandData, CCommandData, CanvasPathCommand, EllipseCommandData, HCommandData, IAnimateEvent, IAnswer, IAppBase, IAround, IAttrDecorator, IAutoBounds, IAutoBoundsData, IBlendMode, IBlob, IBlobFunction, IBoolean, IBooleanMap, IBounds, IBoundsData, IBoundsDataFn, IBoundsType, IBranch, IBranchRender, IBranchRenderModule, ICachedLeaf, ICanvasAttr, ICanvasContext2D, ICanvasManager, ICanvasPattern, ICanvasStrokeOptions, ICanvasType, IChildEvent, IControl, ICreator, ICursorRotate, ICursorRotateMap, ICursorType, ICursorTypeMap, IDataProcessor, IDataTypeHandle, IDragEvent, IDropEvent, IEditSize, IEvent, IEventListener, IEventListenerId, IEventListenerItem, IEventListenerMap, IEventListenerOptions, IEventTarget, IEventer, IExportFileType, IExportImageType, IExportOptions, IExportResult, IExportResultFunction, IFindMethod, IFunction, IHitCanvas, IHitCanvasConfig, IHitCanvasManager, IHitType, IImageCursor, IImageEvent, IImageManager, IInteraction, IInteractionCanvas, IInteractionConfig, IKeepTouchData, IKeyEvent, ILayoutAttr, ILayoutBlockData, ILayoutBoundsData, ILayoutChangedData, ILayoutData, ILayoutEvent, ILayouter, ILayouterConfig, ILeaf, ILeafArrayMap, ILeafAttrData, 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, INumberMap, IObject, IOffsetBoundsData, IPartLayoutConfig, IPath2D, IPathCommandData, IPathCreator, IPathDrawer, IPathString, IPickOptions, IPickResult, IPlatform, IPlugin, IPoint, IPointData, IPointerConfig, IPointerEvent, IPropertyEvent, IRadiusPointData, IRenderEvent, IRenderOptions, IRenderer, IRendererConfig, IResizeEvent, IResizeEventListener, IRotateEvent, IScaleData, IScaleRotationData, IScreenSizeData, ISelector, ISelectorConfig, ISelectorProxy, ISize, ISizeData, ISkewData, ISkiaCanvas, ISkiaCanvasExportConfig, ISkiaNAPICanvas, IString, IStringMap, ISwipeEvent, ITaskItem, ITaskOptions, ITaskProcessor, ITaskProcessorConfig, ITextMetrics, ITimer, ITwoPointBoundsData, IUICreator, IUIEvent, IUpdateEvent, IValue, IWatchEvent, IWatchEventData, IWatcher, IWatcherConfig, IWheelConfig, IWindingRule, IZoomEvent, IZoomView, InnerId, LCommandData, MCommandData, PointerType, QCommandData, RectCommandData, RoundRectCommandData, SCommandData, TCommandData, VCommandData, ZCommandData };
|