@leafer/interface 1.0.0-rc.1 → 1.0.0-rc.11
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 +26 -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 +449 -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,30 @@ 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
|
+
width?: number;
|
|
783
|
+
height?: number;
|
|
784
|
+
renderBounds?: IBoundsData;
|
|
785
|
+
trimBounds?: IBoundsData;
|
|
786
|
+
}
|
|
787
|
+
interface IExportResultFunction {
|
|
788
|
+
(data: IExportResult): void;
|
|
789
|
+
}
|
|
790
|
+
|
|
742
791
|
interface ILeaferCanvasConfig extends IAutoBoundsData {
|
|
743
792
|
view?: string | IObject;
|
|
744
793
|
fill?: string;
|
|
@@ -818,7 +867,7 @@ interface ICanvasMethod {
|
|
|
818
867
|
setWorldShadow(x: number, y: number, blur: number, color?: string): void;
|
|
819
868
|
setWorldBlur(blur: number): void;
|
|
820
869
|
copyWorld(canvas: ILeaferCanvas, fromBounds?: IBoundsData, toBounds?: IBoundsData, blendMode?: string): void;
|
|
821
|
-
copyWorldByReset(canvas: ILeaferCanvas, from?: IBoundsData, to?: IBoundsData, blendMode?: string): void;
|
|
870
|
+
copyWorldByReset(canvas: ILeaferCanvas, from?: IBoundsData, to?: IBoundsData, blendMode?: string, onlyResetTransform?: boolean): void;
|
|
822
871
|
copyWorldToInner(canvas: ILeaferCanvas, fromWorld: IMatrixWithBoundsData, toInnerBounds: IBoundsData, blendMode?: string): void;
|
|
823
872
|
useMask(maskCanvas: ILeaferCanvas, fromBounds?: IBoundsData, toBounds?: IBoundsData): void;
|
|
824
873
|
useEraser(eraserCanvas: ILeaferCanvas, fromBounds?: IBoundsData, toBounds?: IBoundsData): void;
|
|
@@ -828,6 +877,7 @@ interface ICanvasMethod {
|
|
|
828
877
|
clearWorld(bounds: IBoundsData, ceilPixel?: boolean): void;
|
|
829
878
|
clear(): void;
|
|
830
879
|
}
|
|
880
|
+
type ILeaferCanvasView = any;
|
|
831
881
|
interface ILeaferCanvas extends ICanvasAttr, ICanvasMethod, IPathDrawer {
|
|
832
882
|
readonly innerId: InnerId;
|
|
833
883
|
name: string;
|
|
@@ -844,13 +894,14 @@ interface ILeaferCanvas extends ICanvasAttr, ICanvasMethod, IPathDrawer {
|
|
|
844
894
|
clientBounds: IBoundsData;
|
|
845
895
|
config: ILeaferCanvasConfig;
|
|
846
896
|
autoLayout: boolean;
|
|
847
|
-
view:
|
|
897
|
+
view: ILeaferCanvasView;
|
|
848
898
|
parentView: any;
|
|
849
899
|
unreal?: boolean;
|
|
850
900
|
context: ICanvasContext2D;
|
|
851
901
|
recycled?: boolean;
|
|
852
902
|
worldTransform: IMatrixData;
|
|
853
903
|
init(): void;
|
|
904
|
+
export(filename: IExportFileType | string, options?: IExportOptions | number | boolean): string | Promise<any>;
|
|
854
905
|
toBlob(type?: string, quality?: number): Promise<IBlob>;
|
|
855
906
|
toDataURL(type?: string, quality?: number): string | Promise<string>;
|
|
856
907
|
saveAs(filename: string, quality?: number): Promise<boolean>;
|
|
@@ -859,11 +910,9 @@ interface ILeaferCanvas extends ICanvasAttr, ICanvasMethod, IPathDrawer {
|
|
|
859
910
|
resize(size: IScreenSizeData): void;
|
|
860
911
|
updateViewSize(): void;
|
|
861
912
|
updateClientBounds(): void;
|
|
862
|
-
setCursor(cursor: ICursorType | ICursorType[]): void;
|
|
863
913
|
isSameSize(options: ILeaferCanvasConfig): boolean;
|
|
864
|
-
getSameCanvas(useSameWorldTransform?: boolean): ILeaferCanvas;
|
|
865
|
-
|
|
866
|
-
recycle(): void;
|
|
914
|
+
getSameCanvas(useSameWorldTransform?: boolean, useSameSmooth?: boolean): ILeaferCanvas;
|
|
915
|
+
recycle(clearBounds?: IBoundsData): void;
|
|
867
916
|
updateRender(): void;
|
|
868
917
|
unrealCanvas(): void;
|
|
869
918
|
destroy(): void;
|
|
@@ -875,20 +924,11 @@ interface IBlobFunction {
|
|
|
875
924
|
}
|
|
876
925
|
type IBlob = any;
|
|
877
926
|
|
|
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
927
|
interface IRenderOptions {
|
|
928
|
+
includes?: boolean;
|
|
889
929
|
bounds?: IBounds;
|
|
890
930
|
hideBounds?: IBounds;
|
|
891
|
-
matrix?:
|
|
931
|
+
matrix?: IMatrixWithScaleData;
|
|
892
932
|
inCamera?: boolean;
|
|
893
933
|
}
|
|
894
934
|
interface IRendererConfig {
|
|
@@ -924,8 +964,10 @@ interface IRenderer extends IControl {
|
|
|
924
964
|
|
|
925
965
|
type ILeafDataProxyModule = ILeafDataProxy & ThisType<ILeaf>;
|
|
926
966
|
interface ILeafDataProxy {
|
|
927
|
-
__setAttr?(name: string, newValue:
|
|
928
|
-
__getAttr?(name: string):
|
|
967
|
+
__setAttr?(name: string, newValue: IValue): void;
|
|
968
|
+
__getAttr?(name: string): IValue;
|
|
969
|
+
setProxyAttr?(name: string, newValue: IValue): void;
|
|
970
|
+
getProxyAttr?(name: string): IValue;
|
|
929
971
|
}
|
|
930
972
|
|
|
931
973
|
type ILeafMatrixModule = ILeafMatrix & ThisType<ILeaf>;
|
|
@@ -937,33 +979,35 @@ interface ILeafMatrix {
|
|
|
937
979
|
type ILeafBoundsModule = ILeafBounds & ThisType<ILeaf>;
|
|
938
980
|
interface ILeafBounds {
|
|
939
981
|
__updateWorldBounds?(): void;
|
|
982
|
+
__updateLocalBounds?(): void;
|
|
940
983
|
__updateLocalBoxBounds?(): void;
|
|
941
984
|
__updateLocalStrokeBounds?(): void;
|
|
942
985
|
__updateLocalRenderBounds?(): void;
|
|
943
986
|
__updateBoxBounds?(): void;
|
|
944
987
|
__updateStrokeBounds?(): void;
|
|
945
988
|
__updateRenderBounds?(): void;
|
|
989
|
+
__updateAutoLayout?(): void;
|
|
946
990
|
__updateNaturalSize?(): void;
|
|
947
991
|
__updateStrokeSpread?(): number;
|
|
948
992
|
__updateRenderSpread?(): number;
|
|
949
993
|
__onUpdateSize?(): void;
|
|
950
994
|
}
|
|
951
995
|
|
|
952
|
-
type
|
|
953
|
-
type
|
|
996
|
+
type ILocationType = 'world' | 'local' | 'inner';
|
|
997
|
+
type IBoundsType = 'content' | 'box' | 'stroke' | 'margin' | 'render';
|
|
954
998
|
interface ILeafLayout {
|
|
955
999
|
leaf: ILeaf;
|
|
956
|
-
|
|
1000
|
+
proxyZoom: boolean;
|
|
957
1001
|
boxBounds: IBoundsData;
|
|
958
1002
|
strokeBounds: IBoundsData;
|
|
959
1003
|
renderBounds: IBoundsData;
|
|
960
1004
|
marginBounds: IBoundsData;
|
|
961
1005
|
contentBounds: IBoundsData;
|
|
962
|
-
localStrokeBounds
|
|
963
|
-
localRenderBounds
|
|
1006
|
+
localStrokeBounds?: IBoundsData;
|
|
1007
|
+
localRenderBounds?: IBoundsData;
|
|
1008
|
+
resized: boolean;
|
|
1009
|
+
waitAutoLayout: boolean;
|
|
964
1010
|
matrixChanged: boolean;
|
|
965
|
-
positionChanged: boolean;
|
|
966
|
-
originChanged?: boolean;
|
|
967
1011
|
scaleChanged: boolean;
|
|
968
1012
|
rotationChanged: boolean;
|
|
969
1013
|
boundsChanged: boolean;
|
|
@@ -982,9 +1026,22 @@ interface ILeafLayout {
|
|
|
982
1026
|
renderSpread: number;
|
|
983
1027
|
strokeBoxSpread: number;
|
|
984
1028
|
renderShapeSpread: number;
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
1029
|
+
a: number;
|
|
1030
|
+
b: number;
|
|
1031
|
+
c: number;
|
|
1032
|
+
d: number;
|
|
1033
|
+
e: number;
|
|
1034
|
+
f: number;
|
|
1035
|
+
x: number;
|
|
1036
|
+
y: number;
|
|
1037
|
+
width: number;
|
|
1038
|
+
height: number;
|
|
1039
|
+
createLocal(): void;
|
|
1040
|
+
update(): void;
|
|
1041
|
+
getTransform(relative?: ILocationType | ILeaf): IMatrixData;
|
|
1042
|
+
getBounds(type?: IBoundsType, relative?: ILocationType | ILeaf): IBoundsData;
|
|
1043
|
+
getLayoutBounds(type?: IBoundsType, relative?: ILocationType | ILeaf, unscale?: boolean): ILayoutBoundsData;
|
|
1044
|
+
getLayoutPoints(type?: IBoundsType, relative?: ILocationType | ILeaf): IPointData[];
|
|
988
1045
|
spreadStroke(): void;
|
|
989
1046
|
spreadRender(): void;
|
|
990
1047
|
spreadStrokeCancel(): void;
|
|
@@ -993,9 +1050,9 @@ interface ILeafLayout {
|
|
|
993
1050
|
localBoxChange(): void;
|
|
994
1051
|
strokeChange(): void;
|
|
995
1052
|
renderChange(): void;
|
|
996
|
-
positionChange(): void;
|
|
997
1053
|
scaleChange(): void;
|
|
998
1054
|
rotationChange(): void;
|
|
1055
|
+
matrixChange(): void;
|
|
999
1056
|
surfaceChange(): void;
|
|
1000
1057
|
opacityChange(): void;
|
|
1001
1058
|
childrenSortChange(): void;
|
|
@@ -1005,7 +1062,9 @@ interface ILeafLayout {
|
|
|
1005
1062
|
type ILeafHitModule = ILeafHit & ThisType<ILeaf>;
|
|
1006
1063
|
interface ILeafHit {
|
|
1007
1064
|
__hitWorld?(point: IRadiusPointData): boolean;
|
|
1008
|
-
__hit?(
|
|
1065
|
+
__hit?(inner: IRadiusPointData): boolean;
|
|
1066
|
+
__hitFill?(inner: IRadiusPointData, windingRule?: string): boolean;
|
|
1067
|
+
__hitStroke?(inner: IRadiusPointData, strokeWidth: number): boolean;
|
|
1009
1068
|
__drawHitPath?(canvas: ILeaferCanvas): void;
|
|
1010
1069
|
__updateHitCanvas?(): void;
|
|
1011
1070
|
}
|
|
@@ -1015,26 +1074,20 @@ interface ILeafRender {
|
|
|
1015
1074
|
__render?(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
1016
1075
|
__draw?(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
1017
1076
|
__drawFast?(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
1077
|
+
__clip?(_canvas: ILeaferCanvas, _options: IRenderOptions): void;
|
|
1018
1078
|
__renderShape?(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
1019
1079
|
__updateWorldOpacity?(): void;
|
|
1020
1080
|
__updateChange?(): void;
|
|
1021
1081
|
}
|
|
1022
1082
|
|
|
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 {
|
|
1083
|
+
interface IDataProcessor {
|
|
1032
1084
|
__leaf: ILeaf;
|
|
1033
1085
|
__input: IObject;
|
|
1034
1086
|
__middle: IObject;
|
|
1035
1087
|
__single: boolean;
|
|
1036
1088
|
__checkSingle(): void;
|
|
1037
1089
|
__get(name: string): any;
|
|
1090
|
+
__getData(): IObject;
|
|
1038
1091
|
__setInput(name: string, value: any): void;
|
|
1039
1092
|
__getInput(name: string): any;
|
|
1040
1093
|
__removeInput(name: string): void;
|
|
@@ -1043,88 +1096,149 @@ interface IDataProcessor extends IObject {
|
|
|
1043
1096
|
__getMiddle(name: string): any;
|
|
1044
1097
|
destroy(): void;
|
|
1045
1098
|
}
|
|
1099
|
+
interface ILeafDataOptions {
|
|
1100
|
+
attrs?: 'all' | string[];
|
|
1101
|
+
children?: boolean;
|
|
1102
|
+
}
|
|
1046
1103
|
interface ILeafData extends IDataProcessor, ILeafComputedData {
|
|
1047
1104
|
}
|
|
1048
1105
|
|
|
1106
|
+
interface IBranch extends ILeaf {
|
|
1107
|
+
children: ILeaf[];
|
|
1108
|
+
__renderBranch?(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
1109
|
+
addMany(...children: ILeaf[]): void;
|
|
1110
|
+
removeAll(destroy?: boolean): void;
|
|
1111
|
+
clear(): void;
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1114
|
+
interface IPickResult {
|
|
1115
|
+
target: ILeaf;
|
|
1116
|
+
path: ILeafList;
|
|
1117
|
+
throughPath?: ILeafList;
|
|
1118
|
+
}
|
|
1119
|
+
interface IPickOptions {
|
|
1120
|
+
name?: string;
|
|
1121
|
+
hitRadius?: number;
|
|
1122
|
+
through?: boolean;
|
|
1123
|
+
target?: IBranch;
|
|
1124
|
+
findList?: ILeaf[];
|
|
1125
|
+
exclude?: ILeafList;
|
|
1126
|
+
ignoreHittable?: boolean;
|
|
1127
|
+
}
|
|
1128
|
+
interface ISelectorConfig {
|
|
1129
|
+
}
|
|
1130
|
+
type IAnswer = 0 | 1 | 2 | 3;
|
|
1131
|
+
interface IFindMethod {
|
|
1132
|
+
(leaf: ILeaf, options?: any): IAnswer;
|
|
1133
|
+
}
|
|
1134
|
+
interface ISelectorProxy {
|
|
1135
|
+
list: ILeaf[];
|
|
1136
|
+
}
|
|
1137
|
+
interface ISelector {
|
|
1138
|
+
target: ILeaf;
|
|
1139
|
+
proxy?: ISelectorProxy;
|
|
1140
|
+
config: ISelectorConfig;
|
|
1141
|
+
getByPoint(hitPoint: IPointData, hitRadius: number, options?: IPickOptions): IPickResult;
|
|
1142
|
+
getBy(condition: number | string | IFindMethod, branch?: ILeaf, one?: boolean, options?: any): ILeaf | ILeaf[];
|
|
1143
|
+
getByInnerId(innerId: number, branch?: ILeaf): ILeaf;
|
|
1144
|
+
getById(id: string, branch?: ILeaf): ILeaf;
|
|
1145
|
+
getByClassName(className: string, branch?: ILeaf): ILeaf[];
|
|
1146
|
+
getByTag(tag: string, branch?: ILeaf): ILeaf[];
|
|
1147
|
+
getByMethod(method: IFindMethod, branch?: ILeaf, one?: boolean, options?: any): ILeaf | ILeaf[];
|
|
1148
|
+
destroy(): void;
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1049
1151
|
interface ICachedLeaf {
|
|
1050
1152
|
canvas: ILeaferCanvas;
|
|
1051
1153
|
matrix?: IMatrix;
|
|
1052
1154
|
bounds: IBoundsData;
|
|
1053
1155
|
}
|
|
1054
1156
|
interface ILeafAttrData {
|
|
1055
|
-
id:
|
|
1056
|
-
name:
|
|
1057
|
-
className:
|
|
1157
|
+
id: IString;
|
|
1158
|
+
name: IString;
|
|
1159
|
+
className: IString;
|
|
1058
1160
|
blendMode: IBlendMode;
|
|
1059
|
-
opacity:
|
|
1060
|
-
visible:
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1161
|
+
opacity: INumber;
|
|
1162
|
+
visible: IBoolean;
|
|
1163
|
+
locked: IBoolean;
|
|
1164
|
+
zIndex: INumber;
|
|
1165
|
+
mask: IBoolean;
|
|
1166
|
+
maskType: IMaskType;
|
|
1167
|
+
eraser: IBoolean;
|
|
1168
|
+
x: INumber;
|
|
1169
|
+
y: INumber;
|
|
1170
|
+
width: INumber;
|
|
1171
|
+
height: INumber;
|
|
1172
|
+
scaleX: INumber;
|
|
1173
|
+
scaleY: INumber;
|
|
1174
|
+
rotation: INumber;
|
|
1175
|
+
skewX: INumber;
|
|
1176
|
+
skewY: INumber;
|
|
1177
|
+
scale: INumber | IPointData;
|
|
1178
|
+
around: IAround;
|
|
1179
|
+
lazy: IBoolean;
|
|
1180
|
+
draggable: IBoolean;
|
|
1181
|
+
editable: IBoolean;
|
|
1182
|
+
editSize?: IEditSize;
|
|
1183
|
+
hittable: IBoolean;
|
|
1077
1184
|
hitFill: IHitType;
|
|
1078
1185
|
hitStroke: IHitType;
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1186
|
+
hitBox: IBoolean;
|
|
1187
|
+
hitChildren: IBoolean;
|
|
1188
|
+
hitSelf: IBoolean;
|
|
1189
|
+
hitRadius: INumber;
|
|
1082
1190
|
cursor: ICursorType | ICursorType[];
|
|
1083
1191
|
}
|
|
1084
1192
|
type IHitType = 'path' | 'pixel' | 'all' | 'none';
|
|
1085
|
-
type
|
|
1086
|
-
type
|
|
1193
|
+
type IMaskType = 'path' | 'pixel' | 'clipping';
|
|
1194
|
+
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';
|
|
1195
|
+
type IEditSize = 'size' | 'scale';
|
|
1087
1196
|
interface IImageCursor {
|
|
1088
1197
|
url: string;
|
|
1089
1198
|
x?: number;
|
|
1090
1199
|
y?: number;
|
|
1200
|
+
rotation?: number;
|
|
1091
1201
|
}
|
|
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 {
|
|
1202
|
+
type IAround = 'topLeft' | 'top' | 'topRight' | 'right' | 'bottomRight' | 'bottom' | 'bottomLeft' | 'left' | 'center' | IPointData;
|
|
1203
|
+
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';
|
|
1204
|
+
interface ILeafInputData {
|
|
1098
1205
|
tag?: string;
|
|
1099
|
-
id?:
|
|
1100
|
-
name?:
|
|
1101
|
-
className?:
|
|
1206
|
+
id?: IString;
|
|
1207
|
+
name?: IString;
|
|
1208
|
+
className?: IString;
|
|
1102
1209
|
blendMode?: IBlendMode;
|
|
1103
|
-
opacity?:
|
|
1104
|
-
visible?:
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1210
|
+
opacity?: INumber;
|
|
1211
|
+
visible?: IBoolean;
|
|
1212
|
+
locked?: IBoolean;
|
|
1213
|
+
zIndex?: INumber;
|
|
1214
|
+
mask?: IBoolean;
|
|
1215
|
+
maskType?: IMaskType;
|
|
1216
|
+
eraser?: IBoolean;
|
|
1217
|
+
x?: INumber;
|
|
1218
|
+
y?: INumber;
|
|
1219
|
+
width?: INumber;
|
|
1220
|
+
height?: INumber;
|
|
1221
|
+
scaleX?: INumber;
|
|
1222
|
+
scaleY?: INumber;
|
|
1223
|
+
rotation?: INumber;
|
|
1224
|
+
skewX?: INumber;
|
|
1225
|
+
skewY?: INumber;
|
|
1226
|
+
scale?: INumber | IPointData;
|
|
1118
1227
|
around?: IAround;
|
|
1119
|
-
|
|
1120
|
-
|
|
1228
|
+
lazy?: IBoolean;
|
|
1229
|
+
draggable?: IBoolean;
|
|
1230
|
+
editable?: IBoolean;
|
|
1231
|
+
editSize?: IEditSize;
|
|
1232
|
+
hittable?: IBoolean;
|
|
1121
1233
|
hitFill?: IHitType;
|
|
1122
1234
|
hitStroke?: IHitType;
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1235
|
+
hitBox?: IBoolean;
|
|
1236
|
+
hitChildren?: IBoolean;
|
|
1237
|
+
hitSelf?: IBoolean;
|
|
1238
|
+
hitRadius?: INumber;
|
|
1126
1239
|
cursor?: ICursorType | ICursorType[];
|
|
1127
1240
|
children?: ILeafInputData[];
|
|
1241
|
+
noBounds?: boolean;
|
|
1128
1242
|
}
|
|
1129
1243
|
interface ILeafComputedData {
|
|
1130
1244
|
id?: string;
|
|
@@ -1133,9 +1247,11 @@ interface ILeafComputedData {
|
|
|
1133
1247
|
blendMode?: IBlendMode;
|
|
1134
1248
|
opacity?: number;
|
|
1135
1249
|
visible?: boolean;
|
|
1136
|
-
|
|
1137
|
-
isEraser?: boolean;
|
|
1250
|
+
locked?: boolean;
|
|
1138
1251
|
zIndex?: number;
|
|
1252
|
+
mask?: boolean;
|
|
1253
|
+
maskType?: IMaskType;
|
|
1254
|
+
eraser?: boolean;
|
|
1139
1255
|
x?: number;
|
|
1140
1256
|
y?: number;
|
|
1141
1257
|
width?: number;
|
|
@@ -1146,10 +1262,15 @@ interface ILeafComputedData {
|
|
|
1146
1262
|
skewX?: number;
|
|
1147
1263
|
skewY?: number;
|
|
1148
1264
|
around?: IAround;
|
|
1265
|
+
lazy?: boolean;
|
|
1266
|
+
windingRule?: any;
|
|
1149
1267
|
draggable?: boolean;
|
|
1268
|
+
editable?: boolean;
|
|
1269
|
+
editSize?: IEditSize;
|
|
1150
1270
|
hittable?: boolean;
|
|
1151
1271
|
hitFill?: IHitType;
|
|
1152
1272
|
hitStroke?: IHitType;
|
|
1273
|
+
hitBox?: boolean;
|
|
1153
1274
|
hitChildren?: boolean;
|
|
1154
1275
|
hitSelf?: boolean;
|
|
1155
1276
|
hitRadius?: number;
|
|
@@ -1158,36 +1279,44 @@ interface ILeafComputedData {
|
|
|
1158
1279
|
__complex?: boolean;
|
|
1159
1280
|
__naturalWidth?: number;
|
|
1160
1281
|
__naturalHeight?: number;
|
|
1282
|
+
readonly __blendMode: string;
|
|
1161
1283
|
}
|
|
1162
|
-
interface ILeaf extends
|
|
1284
|
+
interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDataProxy, ILeafInputData, IEventer {
|
|
1163
1285
|
tag: string;
|
|
1164
1286
|
readonly __tag: string;
|
|
1165
1287
|
readonly innerName: string;
|
|
1166
1288
|
readonly __DataProcessor: IObject;
|
|
1167
1289
|
readonly __LayoutProcessor: IObject;
|
|
1168
|
-
|
|
1290
|
+
readonly app?: ILeaferBase;
|
|
1291
|
+
leafer?: ILeaferBase;
|
|
1169
1292
|
parent?: ILeaf;
|
|
1170
1293
|
readonly isApp?: boolean;
|
|
1171
1294
|
isLeafer?: boolean;
|
|
1172
1295
|
isBranch?: boolean;
|
|
1173
1296
|
isBranchLeaf?: boolean;
|
|
1174
1297
|
__: ILeafData;
|
|
1298
|
+
proxyData?: ILeafInputData;
|
|
1299
|
+
__proxyData?: ILeafInputData;
|
|
1175
1300
|
__layout: ILeafLayout;
|
|
1176
|
-
__world:
|
|
1177
|
-
__local
|
|
1301
|
+
__world: IMatrixWithBoundsScaleData;
|
|
1302
|
+
__local?: IMatrixWithBoundsData;
|
|
1303
|
+
__nowWorld?: IMatrixWithBoundsScaleData;
|
|
1304
|
+
__cameraWorld?: IMatrixWithBoundsScaleData;
|
|
1305
|
+
readonly __localMatrix: IMatrixData;
|
|
1306
|
+
readonly __localBoxBounds: IBoundsData;
|
|
1178
1307
|
__worldOpacity: number;
|
|
1179
|
-
readonly worldTransform:
|
|
1180
|
-
readonly localTransform:
|
|
1308
|
+
readonly worldTransform: IMatrixData;
|
|
1309
|
+
readonly localTransform: IMatrixData;
|
|
1181
1310
|
readonly boxBounds: IBoundsData;
|
|
1311
|
+
readonly renderBounds: IBoundsData;
|
|
1182
1312
|
readonly worldBoxBounds: IBoundsData;
|
|
1183
1313
|
readonly worldStrokeBounds: IBoundsData;
|
|
1184
1314
|
readonly worldRenderBounds: IBoundsData;
|
|
1185
1315
|
readonly worldOpacity: number;
|
|
1186
|
-
__renderTime?: number;
|
|
1187
1316
|
__level: number;
|
|
1188
1317
|
__tempNumber?: number;
|
|
1189
|
-
readonly
|
|
1190
|
-
|
|
1318
|
+
readonly __worldFlipped: boolean;
|
|
1319
|
+
__hasAutoLayout?: boolean;
|
|
1191
1320
|
__hasMask?: boolean;
|
|
1192
1321
|
__hasEraser?: boolean;
|
|
1193
1322
|
__hitCanvas?: IHitCanvas;
|
|
@@ -1196,35 +1325,48 @@ interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, ILeafMatr
|
|
|
1196
1325
|
__parentWait?: IFunction[];
|
|
1197
1326
|
__leaferWait?: IFunction[];
|
|
1198
1327
|
destroyed: boolean;
|
|
1328
|
+
reset(data?: ILeafInputData): void;
|
|
1329
|
+
resetCustom(): void;
|
|
1199
1330
|
waitParent(item: IFunction): void;
|
|
1200
1331
|
waitLeafer(item: IFunction): void;
|
|
1201
|
-
nextRender(item: IFunction): void;
|
|
1202
|
-
__bindLeafer(leafer:
|
|
1332
|
+
nextRender(item: IFunction, off?: 'off'): void;
|
|
1333
|
+
__bindLeafer(leafer: ILeaferBase | null): void;
|
|
1203
1334
|
set(data: IObject): void;
|
|
1335
|
+
get(): ILeafInputData;
|
|
1204
1336
|
toJSON(): IObject;
|
|
1205
1337
|
toString(): string;
|
|
1206
|
-
|
|
1207
|
-
|
|
1338
|
+
toSVG?(): string;
|
|
1339
|
+
toHTML?(): string;
|
|
1340
|
+
__setAttr(attrName: string, newValue: IValue): void;
|
|
1341
|
+
__getAttr(attrName: string): IValue;
|
|
1342
|
+
setProxyAttr(name: string, newValue: IValue): void;
|
|
1343
|
+
getProxyAttr(name: string): IValue;
|
|
1344
|
+
find(condition: number | string | IFindMethod, options?: any): ILeaf[];
|
|
1345
|
+
findOne(condition: number | string | IFindMethod, options?: any): ILeaf;
|
|
1208
1346
|
forceUpdate(attrName?: string): void;
|
|
1347
|
+
updateLayout(): void;
|
|
1209
1348
|
__updateWorldMatrix(): void;
|
|
1210
1349
|
__updateLocalMatrix(): void;
|
|
1211
1350
|
__updateWorldBounds(): void;
|
|
1351
|
+
__updateLocalBounds(): void;
|
|
1212
1352
|
__updateLocalBoxBounds(): void;
|
|
1213
1353
|
__updateLocalStrokeBounds(): void;
|
|
1214
1354
|
__updateLocalRenderBounds(): void;
|
|
1215
1355
|
__updateBoxBounds(): void;
|
|
1216
1356
|
__updateStrokeBounds(): void;
|
|
1217
1357
|
__updateRenderBounds(): void;
|
|
1358
|
+
__updateAutoLayout(): void;
|
|
1218
1359
|
__updateNaturalSize(): void;
|
|
1219
1360
|
__updateStrokeSpread(): number;
|
|
1220
1361
|
__updateRenderSpread(): number;
|
|
1221
1362
|
__onUpdateSize(): void;
|
|
1222
1363
|
__updateEraser(value?: boolean): void;
|
|
1223
1364
|
__updateMask(value?: boolean): void;
|
|
1224
|
-
__renderMask(canvas: ILeaferCanvas,
|
|
1225
|
-
|
|
1226
|
-
getWorld(attrName:
|
|
1227
|
-
getBounds(type
|
|
1365
|
+
__renderMask(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
1366
|
+
__getNowWorld(options: IRenderOptions): IMatrixWithBoundsScaleData;
|
|
1367
|
+
getWorld(attrName: ILayoutAttr): number;
|
|
1368
|
+
getBounds(type?: IBoundsType, relative?: ILocationType | ILeaf): IBoundsData;
|
|
1369
|
+
getLayoutBounds(type?: IBoundsType, relative?: ILocationType | ILeaf, unscale?: boolean): ILayoutBoundsData;
|
|
1228
1370
|
worldToLocal(world: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void;
|
|
1229
1371
|
localToWorld(local: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void;
|
|
1230
1372
|
worldToInner(world: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void;
|
|
@@ -1235,17 +1377,26 @@ interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, ILeafMatr
|
|
|
1235
1377
|
getLocalPointByInner(inner: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
|
|
1236
1378
|
getWorldPoint(inner: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
|
|
1237
1379
|
getWorldPointByLocal(local: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
|
|
1380
|
+
getPagePoint(world: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
|
|
1381
|
+
getWorldPointByPage(page: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
|
|
1382
|
+
setTransform(transform?: IMatrixData, resize?: boolean): void;
|
|
1383
|
+
transform(transform?: IMatrixData, resize?: boolean): void;
|
|
1238
1384
|
move(x: number, y?: number): void;
|
|
1239
|
-
scaleOf(origin: IPointData,
|
|
1385
|
+
scaleOf(origin: IPointData, scaleX: number, scaleY?: number, resize?: boolean): void;
|
|
1240
1386
|
rotateOf(origin: IPointData, rotation: number): void;
|
|
1241
|
-
skewOf(origin: IPointData,
|
|
1387
|
+
skewOf(origin: IPointData, skewX: number, skewY?: number, resize?: boolean): void;
|
|
1388
|
+
scaleResize(scaleX: number, scaleY: number, noResize?: boolean): void;
|
|
1389
|
+
__scaleResize(scaleX: number, scaleY: number): void;
|
|
1242
1390
|
__hitWorld(point: IRadiusPointData): boolean;
|
|
1243
1391
|
__hit(local: IRadiusPointData): boolean;
|
|
1392
|
+
__hitFill(inner: IRadiusPointData, windingRule?: string): boolean;
|
|
1393
|
+
__hitStroke(inner: IRadiusPointData, strokeWidth: number): boolean;
|
|
1244
1394
|
__drawHitPath(canvas: ILeaferCanvas): void;
|
|
1245
1395
|
__updateHitCanvas(): void;
|
|
1246
1396
|
__render(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
1247
1397
|
__drawFast(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
1248
1398
|
__draw(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
1399
|
+
__clip(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
1249
1400
|
__renderShape(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
1250
1401
|
__updateWorldOpacity(): void;
|
|
1251
1402
|
__updateChange(): void;
|
|
@@ -1257,36 +1408,9 @@ interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, ILeafMatr
|
|
|
1257
1408
|
__updateSortChildren(): void;
|
|
1258
1409
|
add(child: ILeaf, index?: number): void;
|
|
1259
1410
|
remove(child?: ILeaf, destroy?: boolean): void;
|
|
1411
|
+
dropTo(parent: ILeaf, index?: number, resize?: boolean): void;
|
|
1260
1412
|
}
|
|
1261
1413
|
|
|
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
1414
|
interface ILeaferImageConfig {
|
|
1291
1415
|
url: string;
|
|
1292
1416
|
thumb?: string;
|
|
@@ -1298,6 +1422,13 @@ interface ILeaferImageOnLoaded {
|
|
|
1298
1422
|
interface ILeaferImageOnError {
|
|
1299
1423
|
(error?: string | IObject, image?: ILeaferImage): any;
|
|
1300
1424
|
}
|
|
1425
|
+
interface ILeaferImageCacheCanvas {
|
|
1426
|
+
data: IObject;
|
|
1427
|
+
params: IArguments;
|
|
1428
|
+
}
|
|
1429
|
+
interface ILeaferImagePatternPaint {
|
|
1430
|
+
transform: IMatrixData;
|
|
1431
|
+
}
|
|
1301
1432
|
interface ILeaferImage {
|
|
1302
1433
|
readonly innerId: InnerId;
|
|
1303
1434
|
readonly url: string;
|
|
@@ -1305,6 +1436,7 @@ interface ILeaferImage {
|
|
|
1305
1436
|
width: number;
|
|
1306
1437
|
height: number;
|
|
1307
1438
|
isSVG: boolean;
|
|
1439
|
+
hasOpacityPixel: boolean;
|
|
1308
1440
|
readonly completed: boolean;
|
|
1309
1441
|
ready: boolean;
|
|
1310
1442
|
error: IObject;
|
|
@@ -1314,6 +1446,7 @@ interface ILeaferImage {
|
|
|
1314
1446
|
load(onSuccess?: ILeaferImageOnLoaded, onError?: ILeaferImageOnError): number;
|
|
1315
1447
|
unload(index: number, stopEvent?: boolean): void;
|
|
1316
1448
|
getCanvas(width: number, height: number, opacity?: number, _filters?: IObject): unknown;
|
|
1449
|
+
getPattern(canvas: any, repeat: string | null, transform?: IMatrixData, paint?: IObject): ICanvasPattern;
|
|
1317
1450
|
destroy(): void;
|
|
1318
1451
|
}
|
|
1319
1452
|
|
|
@@ -1331,9 +1464,9 @@ interface IUIEvent extends IEvent {
|
|
|
1331
1464
|
buttons?: number;
|
|
1332
1465
|
path?: ILeafList;
|
|
1333
1466
|
throughPath?: ILeafList;
|
|
1334
|
-
|
|
1335
|
-
getInner?(
|
|
1336
|
-
getLocal?(
|
|
1467
|
+
getPage?(): IPointData;
|
|
1468
|
+
getInner?(relative?: ILeaf): IPointData;
|
|
1469
|
+
getLocal?(relative?: ILeaf): IPointData;
|
|
1337
1470
|
}
|
|
1338
1471
|
interface IPointerEvent extends IUIEvent {
|
|
1339
1472
|
width?: number;
|
|
@@ -1351,10 +1484,12 @@ interface IDragEvent extends IPointerEvent {
|
|
|
1351
1484
|
moveY: number;
|
|
1352
1485
|
totalX?: number;
|
|
1353
1486
|
totalY?: number;
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1487
|
+
getPageMove?(total?: boolean): IPointData;
|
|
1488
|
+
getInnerMove?(relative?: ILeaf): IPointData;
|
|
1489
|
+
getLocalMove?(relative?: ILeaf): IPointData;
|
|
1490
|
+
getPageTotal?(): IPointData;
|
|
1491
|
+
getInnerTotal?(relative?: ILeaf): IPointData;
|
|
1492
|
+
getLocalTotal?(relative?: ILeaf): IPointData;
|
|
1358
1493
|
}
|
|
1359
1494
|
interface IDropEvent extends IPointerEvent {
|
|
1360
1495
|
list: ILeafList;
|
|
@@ -1387,6 +1522,8 @@ interface IInteraction extends IControl {
|
|
|
1387
1522
|
selector: ISelector;
|
|
1388
1523
|
running: boolean;
|
|
1389
1524
|
readonly dragging: boolean;
|
|
1525
|
+
readonly isDragEmpty: boolean;
|
|
1526
|
+
readonly isHoldRightKey: boolean;
|
|
1390
1527
|
readonly moveMode: boolean;
|
|
1391
1528
|
config: IInteractionConfig;
|
|
1392
1529
|
cursor: ICursorType | ICursorType[];
|
|
@@ -1407,10 +1544,12 @@ interface IInteraction extends IControl {
|
|
|
1407
1544
|
rotate(data: IRotateEvent): void;
|
|
1408
1545
|
keyDown(data: IKeyEvent): void;
|
|
1409
1546
|
keyUp(data: IKeyEvent): void;
|
|
1410
|
-
findPath(data: IPointerEvent, options?:
|
|
1411
|
-
|
|
1547
|
+
findPath(data: IPointerEvent, options?: IPickOptions): ILeafList;
|
|
1548
|
+
isDrag(leaf: ILeaf): boolean;
|
|
1549
|
+
updateDownData(data?: IPointerEvent, options?: IPickOptions): void;
|
|
1412
1550
|
updateHoverData(data: IPointerEvent): void;
|
|
1413
1551
|
updateCursor(hoverData?: IPointerEvent): void;
|
|
1552
|
+
setCursor(cursor: ICursorType | ICursorType[]): void;
|
|
1414
1553
|
emit(type: string, data: IUIEvent, path?: ILeafList, excludePath?: ILeafList): void;
|
|
1415
1554
|
}
|
|
1416
1555
|
interface IInteractionCanvas extends ILeaferCanvas {
|
|
@@ -1418,6 +1557,7 @@ interface IInteractionCanvas extends ILeaferCanvas {
|
|
|
1418
1557
|
interface IInteractionConfig {
|
|
1419
1558
|
wheel?: IWheelConfig;
|
|
1420
1559
|
pointer?: IPointerConfig;
|
|
1560
|
+
cursor?: ICursorConfig;
|
|
1421
1561
|
zoom?: IZoomConfig;
|
|
1422
1562
|
move?: IMoveConfig;
|
|
1423
1563
|
eventer?: IObject;
|
|
@@ -1428,12 +1568,15 @@ interface IZoomConfig {
|
|
|
1428
1568
|
}
|
|
1429
1569
|
interface IMoveConfig {
|
|
1430
1570
|
holdSpaceKey?: boolean;
|
|
1571
|
+
holdMiddleKey?: boolean;
|
|
1572
|
+
holdRightKey?: boolean;
|
|
1573
|
+
drag?: boolean;
|
|
1431
1574
|
dragEmpty?: boolean;
|
|
1432
1575
|
dragOut?: boolean;
|
|
1433
1576
|
autoDistance?: number;
|
|
1434
1577
|
}
|
|
1435
1578
|
interface IWheelConfig {
|
|
1436
|
-
zoomMode?: boolean;
|
|
1579
|
+
zoomMode?: boolean | 'mouse';
|
|
1437
1580
|
zoomSpeed?: number;
|
|
1438
1581
|
moveSpeed?: number;
|
|
1439
1582
|
rotateSpeed?: number;
|
|
@@ -1454,6 +1597,10 @@ interface IPointerConfig {
|
|
|
1454
1597
|
swipeDistance?: number;
|
|
1455
1598
|
ignoreMove?: boolean;
|
|
1456
1599
|
preventDefault?: boolean;
|
|
1600
|
+
preventDefaultMenu?: boolean;
|
|
1601
|
+
}
|
|
1602
|
+
interface ICursorConfig {
|
|
1603
|
+
stop?: boolean;
|
|
1457
1604
|
}
|
|
1458
1605
|
|
|
1459
1606
|
interface IHitCanvasManager extends ICanvasManager {
|
|
@@ -1461,35 +1608,26 @@ interface IHitCanvasManager extends ICanvasManager {
|
|
|
1461
1608
|
getImageType(leaf: ILeaf, size: IScreenSizeData): IHitCanvas;
|
|
1462
1609
|
}
|
|
1463
1610
|
|
|
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
1611
|
interface IZoomView extends IBranch {
|
|
1472
1612
|
zoomLayer?: ILeaf;
|
|
1473
|
-
|
|
1474
|
-
transformData?: ITransformEventData;
|
|
1475
|
-
setZoomLayer(zoomLayer: ILeaf, moveLayer?: ILeaf): void;
|
|
1613
|
+
setZoomLayer(zoomLayer: ILeaf): void;
|
|
1476
1614
|
}
|
|
1477
1615
|
|
|
1478
|
-
type ILeaferType = 'draw' | 'design' | 'board' | 'document' | '
|
|
1616
|
+
type ILeaferType = 'draw' | 'design' | 'board' | 'document' | 'app' | 'game' | 'player' | 'chart';
|
|
1479
1617
|
interface ILeaferConfig extends IRendererConfig, ILeaferCanvasConfig, IInteractionConfig, ILayouterConfig {
|
|
1480
1618
|
start?: boolean;
|
|
1481
1619
|
type?: ILeaferType;
|
|
1482
1620
|
realCanvas?: boolean;
|
|
1483
1621
|
}
|
|
1484
|
-
interface
|
|
1485
|
-
readonly isApp: boolean;
|
|
1486
|
-
readonly app: ILeafer;
|
|
1487
|
-
parent?: IApp;
|
|
1622
|
+
interface ILeaferAttrData {
|
|
1488
1623
|
running: boolean;
|
|
1489
1624
|
created: boolean;
|
|
1490
1625
|
ready: boolean;
|
|
1491
1626
|
viewReady: boolean;
|
|
1627
|
+
imageReady: boolean;
|
|
1492
1628
|
viewCompleted: boolean;
|
|
1629
|
+
layoutLocked: boolean;
|
|
1630
|
+
transforming: boolean;
|
|
1493
1631
|
pixelRatio: number;
|
|
1494
1632
|
view: unknown;
|
|
1495
1633
|
canvas: ILeaferCanvas;
|
|
@@ -1502,24 +1640,36 @@ interface ILeafer extends IZoomView, IControl {
|
|
|
1502
1640
|
hitCanvasManager?: IHitCanvasManager;
|
|
1503
1641
|
autoLayout?: IAutoBounds;
|
|
1504
1642
|
config: ILeaferConfig;
|
|
1643
|
+
readonly cursorPoint: IPointData;
|
|
1644
|
+
leafs: number;
|
|
1505
1645
|
__eventIds: IEventListenerId[];
|
|
1506
1646
|
__nextRenderWait: IFunction[];
|
|
1507
|
-
init(userConfig?: ILeaferConfig, parentApp?:
|
|
1508
|
-
|
|
1647
|
+
init(userConfig?: ILeaferConfig, parentApp?: IAppBase): void;
|
|
1648
|
+
start(): void;
|
|
1649
|
+
stop(): void;
|
|
1650
|
+
unlockLayout(): void;
|
|
1651
|
+
lockLayout(): void;
|
|
1652
|
+
setZoomLayer(zoomLayer: ILeaf): void;
|
|
1509
1653
|
forceFullRender(): void;
|
|
1510
|
-
|
|
1654
|
+
forceRender(bounds?: IBoundsData): void;
|
|
1655
|
+
updateCursor(cursor?: ICursorType): void;
|
|
1511
1656
|
resize(size: IScreenSizeData): void;
|
|
1512
1657
|
waitReady(item: IFunction): void;
|
|
1513
1658
|
waitViewReady(item: IFunction): void;
|
|
1514
1659
|
waitViewCompleted(item: IFunction): void;
|
|
1515
1660
|
}
|
|
1661
|
+
interface ILeaferBase extends IZoomView, IControl, ILeaferAttrData {
|
|
1662
|
+
readonly isApp: boolean;
|
|
1663
|
+
readonly app: ILeaferBase;
|
|
1664
|
+
parent?: IAppBase;
|
|
1665
|
+
}
|
|
1516
1666
|
interface ILeaferTypeCreator {
|
|
1517
1667
|
list: ILeaferTypeList;
|
|
1518
1668
|
register(name: string, fn: ILeaferTypeFunction): void;
|
|
1519
|
-
run(name: string, leafer:
|
|
1669
|
+
run(name: string, leafer: ILeaferBase): void;
|
|
1520
1670
|
}
|
|
1521
1671
|
interface ILeaferTypeFunction {
|
|
1522
|
-
(leafer:
|
|
1672
|
+
(leafer: ILeaferBase): void;
|
|
1523
1673
|
}
|
|
1524
1674
|
interface ILeaferTypeList {
|
|
1525
1675
|
[key: string]: ILeaferTypeFunction;
|
|
@@ -1528,19 +1678,21 @@ interface ICreator {
|
|
|
1528
1678
|
image?(options?: ILeaferImageConfig): ILeaferImage;
|
|
1529
1679
|
canvas?(options?: ILeaferCanvasConfig, manager?: ICanvasManager): ILeaferCanvas;
|
|
1530
1680
|
hitCanvas?(options?: IHitCanvasConfig, manager?: ICanvasManager): IHitCanvas;
|
|
1681
|
+
hitCanvasManager?(): IHitCanvasManager;
|
|
1531
1682
|
watcher?(target: ILeaf, options?: IWatcherConfig): IWatcher;
|
|
1532
1683
|
layouter?(target: ILeaf, options?: ILayouterConfig): ILayouter;
|
|
1533
1684
|
renderer?(target: ILeaf, canvas: ILeaferCanvas, options?: IRendererConfig): IRenderer;
|
|
1534
1685
|
selector?(target: ILeaf, options?: ISelectorConfig): ISelector;
|
|
1535
1686
|
interaction?(target: ILeaf, canvas: IInteractionCanvas, selector: ISelector, options?: IInteractionConfig): IInteraction;
|
|
1687
|
+
editor?(options?: IObject): ILeaf;
|
|
1536
1688
|
}
|
|
1537
1689
|
interface IUICreator {
|
|
1538
1690
|
register(UI: IObject): void;
|
|
1539
1691
|
get(tag: string, data: IObject): IObject;
|
|
1540
1692
|
}
|
|
1541
1693
|
|
|
1542
|
-
interface
|
|
1543
|
-
children:
|
|
1694
|
+
interface IAppBase extends ILeaferBase {
|
|
1695
|
+
children: ILeaferBase[];
|
|
1544
1696
|
realCanvas: boolean;
|
|
1545
1697
|
}
|
|
1546
1698
|
|
|
@@ -1601,14 +1753,46 @@ interface IImageManager {
|
|
|
1601
1753
|
get(config: ILeaferImageConfig): ILeaferImage;
|
|
1602
1754
|
recycle(image: ILeaferImage): void;
|
|
1603
1755
|
clearRecycled(): void;
|
|
1756
|
+
hasOpacityPixel(config: ILeaferImageConfig): boolean;
|
|
1757
|
+
isFormat(format: IExportFileType, config: ILeaferImageConfig): boolean;
|
|
1604
1758
|
destroy(): void;
|
|
1605
1759
|
}
|
|
1606
1760
|
|
|
1761
|
+
type ICanvasType = 'skia' | 'napi' | 'canvas' | 'wx';
|
|
1762
|
+
interface ISkiaCanvas {
|
|
1763
|
+
toBuffer(format: IExportFileType, config: ISkiaCanvasExportConfig): Promise<any>;
|
|
1764
|
+
toBufferSync(format: IExportFileType, config: ISkiaCanvasExportConfig): any;
|
|
1765
|
+
toDataURL(format: IExportImageType, config: ISkiaCanvasExportConfig): Promise<string>;
|
|
1766
|
+
toDataURLSync(format: IExportImageType, config: ISkiaCanvasExportConfig): string;
|
|
1767
|
+
saveAs(filename: string, config: ISkiaCanvasExportConfig): Promise<void>;
|
|
1768
|
+
saveAsSync(filename: string, config: ISkiaCanvasExportConfig): void;
|
|
1769
|
+
}
|
|
1770
|
+
interface ISkiaCanvasExportConfig {
|
|
1771
|
+
page?: number;
|
|
1772
|
+
matte?: string;
|
|
1773
|
+
density?: number;
|
|
1774
|
+
quality?: number;
|
|
1775
|
+
outline?: boolean;
|
|
1776
|
+
}
|
|
1777
|
+
interface ISkiaNAPICanvas {
|
|
1778
|
+
encodeSync(format: 'webp' | 'jpeg', quality?: number): any;
|
|
1779
|
+
encodeSync(format: 'png'): any;
|
|
1780
|
+
encode(format: 'webp' | 'jpeg' | string, quality?: number): Promise<any>;
|
|
1781
|
+
encode(format: 'png'): Promise<any>;
|
|
1782
|
+
toBuffer(mime: 'image/png'): any;
|
|
1783
|
+
toBuffer(mime: 'image/jpeg' | 'image/webp' | string, quality?: number): any;
|
|
1784
|
+
toDataURL(mime?: 'image/png'): string;
|
|
1785
|
+
toDataURL(mime: 'image/jpeg' | 'image/webp' | string, quality?: number): string;
|
|
1786
|
+
toDataURLAsync(mime?: 'image/png'): Promise<string>;
|
|
1787
|
+
toDataURLAsync(mime: 'image/jpeg' | 'image/webp' | string, quality?: number): Promise<string>;
|
|
1788
|
+
}
|
|
1789
|
+
|
|
1607
1790
|
interface IPlatform {
|
|
1608
1791
|
name?: 'web' | 'node' | 'miniapp';
|
|
1609
1792
|
os?: 'Mac' | 'Windows' | 'Linux';
|
|
1610
1793
|
requestRender?(render: IFunction): void;
|
|
1611
1794
|
canvas?: ILeaferCanvas;
|
|
1795
|
+
canvasType?: ICanvasType;
|
|
1612
1796
|
isWorker?: boolean;
|
|
1613
1797
|
isMobile?: boolean;
|
|
1614
1798
|
devicePixelRatio?: number;
|
|
@@ -1618,7 +1802,6 @@ interface IPlatform {
|
|
|
1618
1802
|
fullImageShadow?: boolean;
|
|
1619
1803
|
syncDomFont?: boolean;
|
|
1620
1804
|
layout?(target: ILeaf): void;
|
|
1621
|
-
realtimeLayout?: boolean;
|
|
1622
1805
|
origin?: {
|
|
1623
1806
|
createCanvas(width: number, height: number, format?: 'svg' | 'pdf'): any;
|
|
1624
1807
|
canvasToDataURL(canvas: any, type?: IExportImageType, quality?: number): string | Promise<string>;
|
|
@@ -1627,8 +1810,20 @@ interface IPlatform {
|
|
|
1627
1810
|
loadImage(url: string): Promise<any>;
|
|
1628
1811
|
noRepeat?: string;
|
|
1629
1812
|
};
|
|
1813
|
+
roundRectPatch?: boolean;
|
|
1814
|
+
ellipseToCurve?: boolean;
|
|
1815
|
+
event?: {
|
|
1816
|
+
stopDefault(origin: IObject): void;
|
|
1817
|
+
stopNow(origin: IObject): void;
|
|
1818
|
+
stop(origin: IObject): void;
|
|
1819
|
+
};
|
|
1630
1820
|
miniapp?: IMiniapp;
|
|
1631
|
-
|
|
1821
|
+
image: {
|
|
1822
|
+
maxCacheSize: number;
|
|
1823
|
+
maxPatternSize: number;
|
|
1824
|
+
suffix: string;
|
|
1825
|
+
crossOrigin: string | false;
|
|
1826
|
+
};
|
|
1632
1827
|
}
|
|
1633
1828
|
interface IMiniappSelect extends IObject {
|
|
1634
1829
|
}
|
|
@@ -1649,24 +1844,18 @@ interface IPlugin extends IObject {
|
|
|
1649
1844
|
importVersion: string;
|
|
1650
1845
|
import: string[];
|
|
1651
1846
|
run(LeaferUI: IObject, config: IObject): void;
|
|
1652
|
-
onLeafer?(leafer:
|
|
1847
|
+
onLeafer?(leafer: ILeaferBase): void;
|
|
1653
1848
|
}
|
|
1654
1849
|
|
|
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;
|
|
1850
|
+
interface ICursorTypeMap {
|
|
1851
|
+
[name: string]: ICursorType | ICursorType[];
|
|
1663
1852
|
}
|
|
1664
|
-
interface
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1853
|
+
interface ICursorRotate {
|
|
1854
|
+
rotation?: number;
|
|
1855
|
+
data?: string;
|
|
1856
|
+
}
|
|
1857
|
+
interface ICursorRotateMap {
|
|
1858
|
+
[name: string]: ICursorRotate;
|
|
1670
1859
|
}
|
|
1671
1860
|
|
|
1672
|
-
export type { ACommandData, ArcCommandData, ArcToCommandData, CCommandData, CanvasPathCommand, EllipseCommandData, HCommandData, IAnimateEvent,
|
|
1861
|
+
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 };
|