@leafer/interface 1.0.0-rc.5 → 1.0.0-rc.7
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 +21 -10
- package/src/canvas/ILeaferCanvas.ts +1 -1
- 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/ILeaf.ts +119 -71
- package/src/display/module/ILeafBounds.ts +2 -0
- package/src/display/module/ILeafDataProxy.ts +5 -3
- package/src/display/module/ILeafMask.ts +1 -1
- package/src/event/IEventer.ts +6 -1
- package/src/function/IFunction.ts +9 -0
- package/src/index.ts +10 -10
- package/src/interaction/IInteraction.ts +3 -1
- package/src/layout/ILeafLayout.ts +20 -8
- package/src/layouter/ILayouter.ts +3 -0
- package/src/math/IMath.ts +47 -31
- package/src/platform/IPlatform.ts +9 -2
- package/src/plugin/IPlugin.ts +2 -2
- package/src/selector/ISelector.ts +22 -6
- package/types/index.d.ts +297 -186
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,20 @@ 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
|
-
rotate(
|
|
100
|
+
rotate(rotation: number, origin?: IPointData): IPoint;
|
|
101
|
+
rotateOf(origin: IPointData, rotation: number): IPoint;
|
|
102
|
+
getRotation(origin: IPointData, to: IPointData, toOrigin?: IPointData): number;
|
|
101
103
|
toInnerOf(matrix: IMatrixData, to?: IPointData): IPoint;
|
|
102
104
|
toOuterOf(matrix: IMatrixData, to?: IPointData): IPoint;
|
|
103
|
-
getCenter(to: IPointData):
|
|
105
|
+
getCenter(to: IPointData): IPoint;
|
|
104
106
|
getDistance(to: IPointData): number;
|
|
107
|
+
getDistancePoint(to: IPointData, distance: number): IPoint;
|
|
105
108
|
getAngle(to: IPointData): number;
|
|
106
109
|
getAtan2(to: IPointData): number;
|
|
107
|
-
reset():
|
|
110
|
+
reset(): IPoint;
|
|
108
111
|
}
|
|
109
112
|
interface IRadiusPointData extends IPointData {
|
|
110
113
|
radiusX: number;
|
|
@@ -125,25 +128,27 @@ interface IOffsetBoundsData extends IBoundsData {
|
|
|
125
128
|
offsetX: number;
|
|
126
129
|
offsetY: number;
|
|
127
130
|
}
|
|
128
|
-
interface
|
|
131
|
+
interface IBoundsDataFn {
|
|
129
132
|
(target: any): IBoundsData;
|
|
130
133
|
}
|
|
131
|
-
interface IBounds extends IBoundsData {
|
|
132
|
-
set(x?: number, y?: number, width?: number, height?: number):
|
|
133
|
-
|
|
134
|
+
interface IBounds extends IBoundsData, ITwoPointBoundsData {
|
|
135
|
+
set(x?: number | IBoundsData, y?: number, width?: number, height?: number): IBounds;
|
|
136
|
+
get(): IBoundsData;
|
|
134
137
|
clone(): IBounds;
|
|
135
138
|
scale(scaleX: number, scaleY?: number): IBounds;
|
|
139
|
+
scaleOf(origin: IPointData, scaleX: number, scaleY?: number): IBounds;
|
|
136
140
|
toOuterOf(matrix: IMatrixData, to?: IBoundsData): IBounds;
|
|
137
141
|
getFitMatrix(put: IBoundsData): IMatrix;
|
|
138
142
|
spread(spreadX: number, spreadY?: number): IBounds;
|
|
139
143
|
ceil(): IBounds;
|
|
140
144
|
unsign(): IBounds;
|
|
141
145
|
add(bounds: IBoundsData): IBounds;
|
|
142
|
-
addList(boundsList:
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
146
|
+
addList(boundsList: IBoundsData[]): IBounds;
|
|
147
|
+
setList(boundsList: IBoundsData[]): IBounds;
|
|
148
|
+
addListWithFn(list: IObject[], boundsDataHandle: IBoundsDataFn): IBounds;
|
|
149
|
+
setListWithFn(list: IObject[], boundsDataHandle: IBoundsDataFn): IBounds;
|
|
150
|
+
setPoints(points: IPointData[]): IBounds;
|
|
151
|
+
getPoints(): IPointData[];
|
|
147
152
|
hitPoint(point: IPointData, pointMatrix?: IMatrixData): boolean;
|
|
148
153
|
hitRadiusPoint(point: IRadiusPointData, pointMatrix?: IMatrixWithLayoutData): boolean;
|
|
149
154
|
hit(bounds: IBoundsData, boundsMatrix?: IMatrixData): boolean;
|
|
@@ -160,11 +165,6 @@ interface ITwoPointBoundsData {
|
|
|
160
165
|
maxX: number;
|
|
161
166
|
maxY: number;
|
|
162
167
|
}
|
|
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
168
|
interface IAutoBoundsData {
|
|
169
169
|
top?: number;
|
|
170
170
|
right?: number;
|
|
@@ -186,19 +186,25 @@ interface IMatrixData {
|
|
|
186
186
|
e: number;
|
|
187
187
|
f: number;
|
|
188
188
|
}
|
|
189
|
-
interface
|
|
190
|
-
x: number;
|
|
191
|
-
y: number;
|
|
189
|
+
interface IScaleData {
|
|
192
190
|
scaleX: number;
|
|
193
191
|
scaleY: number;
|
|
192
|
+
}
|
|
193
|
+
interface IScaleRotationData extends IScaleData {
|
|
194
194
|
rotation: number;
|
|
195
|
+
}
|
|
196
|
+
interface ISkewData {
|
|
195
197
|
skewX: number;
|
|
196
198
|
skewY: number;
|
|
197
199
|
}
|
|
198
|
-
|
|
200
|
+
interface ILayoutData extends IScaleRotationData, ISkewData, IPointData {
|
|
201
|
+
}
|
|
202
|
+
type ILayoutAttr = 'x' | 'y' | 'scaleX' | 'scaleY' | 'rotation' | 'skewX' | 'skewY';
|
|
203
|
+
interface ILayoutBoundsData extends ILayoutData, IBoundsData {
|
|
204
|
+
}
|
|
199
205
|
interface IMatrix extends IMatrixData {
|
|
200
|
-
set(a: number, b: number, c: number, d: number, e: number, f: number):
|
|
201
|
-
|
|
206
|
+
set(a: number | IMatrixData, b: number, c: number, d: number, e: number, f: number): IMatrix;
|
|
207
|
+
get(): IMatrixData;
|
|
202
208
|
clone(): IMatrix;
|
|
203
209
|
translate(x: number, y: number): IMatrix;
|
|
204
210
|
translateInner(x: number, y: number): IMatrix;
|
|
@@ -211,18 +217,22 @@ interface IMatrix extends IMatrixData {
|
|
|
211
217
|
skew(x: number, y?: number): IMatrix;
|
|
212
218
|
skewOfOuter(origin: IPointData, x: number, y?: number): IMatrix;
|
|
213
219
|
skewOfInner(origin: IPointData, x: number, y?: number): IMatrix;
|
|
214
|
-
multiply(
|
|
215
|
-
|
|
216
|
-
|
|
220
|
+
multiply(child: IMatrixData): IMatrix;
|
|
221
|
+
multiplyParent(parent: IMatrixData): IMatrix;
|
|
222
|
+
divide(child: IMatrixData): IMatrix;
|
|
223
|
+
divideParent(parent: IMatrixData): IMatrix;
|
|
217
224
|
invert(): IMatrix;
|
|
218
225
|
toOuterPoint(inner: IPointData, to?: IPointData, distance?: boolean): void;
|
|
219
226
|
toInnerPoint(outer: IPointData, to?: IPointData, distance?: boolean): void;
|
|
220
|
-
|
|
227
|
+
setLayout(data: ILayoutData, origin?: IPointData): IMatrix;
|
|
228
|
+
getLayout(origin?: IPointData, firstSkewY?: boolean): ILayoutData;
|
|
221
229
|
reset(): void;
|
|
222
230
|
}
|
|
223
231
|
interface IMatrixWithBoundsData extends IMatrixData, IBoundsData {
|
|
224
232
|
}
|
|
225
|
-
interface
|
|
233
|
+
interface IMatrixWithScaleData extends IMatrixData, IScaleData {
|
|
234
|
+
}
|
|
235
|
+
interface IMatrixWithLayoutData extends IMatrixData, ILayoutBoundsData {
|
|
226
236
|
}
|
|
227
237
|
|
|
228
238
|
interface ILayoutChangedData {
|
|
@@ -250,6 +260,7 @@ interface ILayouterConfig {
|
|
|
250
260
|
interface ILayouter extends IControl {
|
|
251
261
|
target: ILeaf;
|
|
252
262
|
layoutedBlocks: ILayoutBlockData[];
|
|
263
|
+
extraBlock: ILayoutBlockData;
|
|
253
264
|
totalTimes: number;
|
|
254
265
|
times: number;
|
|
255
266
|
disabled: boolean;
|
|
@@ -263,6 +274,7 @@ interface ILayouter extends IControl {
|
|
|
263
274
|
layoutOnce(): void;
|
|
264
275
|
partLayout(): void;
|
|
265
276
|
fullLayout(): void;
|
|
277
|
+
addExtra(leaf: ILeaf): void;
|
|
266
278
|
createBlock(data: ILeafList | ILeaf[]): ILayoutBlockData;
|
|
267
279
|
getBlocks(list: ILeafList): ILayoutBlockData[];
|
|
268
280
|
addBlocks(current: ILayoutBlockData[]): void;
|
|
@@ -343,7 +355,23 @@ interface ILeafEventer {
|
|
|
343
355
|
hasEvent?(type: string, capture?: boolean): boolean;
|
|
344
356
|
}
|
|
345
357
|
|
|
346
|
-
|
|
358
|
+
interface IFunction {
|
|
359
|
+
(...arg: any): any;
|
|
360
|
+
}
|
|
361
|
+
interface INumberFunction {
|
|
362
|
+
(...arg: any): number;
|
|
363
|
+
}
|
|
364
|
+
interface IPointDataFunction {
|
|
365
|
+
(...arg: any): IPointData;
|
|
366
|
+
}
|
|
367
|
+
interface IAttrDecorator {
|
|
368
|
+
(...arg: any): IAttrDecoratorInner;
|
|
369
|
+
}
|
|
370
|
+
interface IAttrDecoratorInner {
|
|
371
|
+
(target: any, key: string): any;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
type IEventListener = IFunction;
|
|
347
375
|
interface IEventListenerOptions {
|
|
348
376
|
capture?: boolean;
|
|
349
377
|
once?: boolean;
|
|
@@ -356,6 +384,7 @@ interface IEventListenerMap {
|
|
|
356
384
|
}
|
|
357
385
|
interface IEventListenerId {
|
|
358
386
|
type: string | string[];
|
|
387
|
+
current: ILeaf;
|
|
359
388
|
listener: IEventListener;
|
|
360
389
|
options?: IEventListenerOptions | boolean;
|
|
361
390
|
}
|
|
@@ -366,11 +395,11 @@ interface IEventer extends ILeafEventer {
|
|
|
366
395
|
__bubbleMap?: IEventListenerMap;
|
|
367
396
|
on(type: string | string[], listener: IEventListener, options?: IEventListenerOptions | boolean): void;
|
|
368
397
|
off(type: string | string[], listener: IEventListener, options?: IEventListenerOptions | boolean): void;
|
|
369
|
-
on_(type: string | string[], listener: IEventListener, bind?: IObject
|
|
398
|
+
on_(type: string | string[], listener: IEventListener, bind?: IObject, options?: IEventListenerOptions | boolean): IEventListenerId;
|
|
370
399
|
off_(id: IEventListenerId | IEventListenerId[]): void;
|
|
371
400
|
once(type: string | string[], listener: IEventListener): void;
|
|
372
|
-
emit(type: string, event?: IEvent
|
|
373
|
-
emitEvent(event?: IEvent
|
|
401
|
+
emit(type: string, event?: IEvent | IObject, capture?: boolean): void;
|
|
402
|
+
emitEvent(event?: IEvent, capture?: boolean): void;
|
|
374
403
|
hasEvent(type: string, capture?: boolean): boolean;
|
|
375
404
|
destroy(): void;
|
|
376
405
|
}
|
|
@@ -843,7 +872,7 @@ interface ILeaferCanvas extends ICanvasAttr, ICanvasMethod, IPathDrawer {
|
|
|
843
872
|
updateClientBounds(): void;
|
|
844
873
|
setCursor(cursor: ICursorType | ICursorType[]): void;
|
|
845
874
|
isSameSize(options: ILeaferCanvasConfig): boolean;
|
|
846
|
-
getSameCanvas(useSameWorldTransform?: boolean): ILeaferCanvas;
|
|
875
|
+
getSameCanvas(useSameWorldTransform?: boolean, useSameSmooth?: boolean): ILeaferCanvas;
|
|
847
876
|
getBiggerCanvas(addWidth: number, addHeight: number): ILeaferCanvas;
|
|
848
877
|
recycle(): void;
|
|
849
878
|
updateRender(): void;
|
|
@@ -857,16 +886,6 @@ interface IBlobFunction {
|
|
|
857
886
|
}
|
|
858
887
|
type IBlob = any;
|
|
859
888
|
|
|
860
|
-
interface IFunction {
|
|
861
|
-
(...arg: any): any;
|
|
862
|
-
}
|
|
863
|
-
interface INumberFunction {
|
|
864
|
-
(...arg: any): number;
|
|
865
|
-
}
|
|
866
|
-
interface IPointDataFunction {
|
|
867
|
-
(...arg: any): IPointData;
|
|
868
|
-
}
|
|
869
|
-
|
|
870
889
|
interface IRenderOptions {
|
|
871
890
|
includes?: boolean;
|
|
872
891
|
bounds?: IBounds;
|
|
@@ -907,8 +926,10 @@ interface IRenderer extends IControl {
|
|
|
907
926
|
|
|
908
927
|
type ILeafDataProxyModule = ILeafDataProxy & ThisType<ILeaf>;
|
|
909
928
|
interface ILeafDataProxy {
|
|
910
|
-
__setAttr?(name: string, newValue:
|
|
911
|
-
__getAttr?(name: string):
|
|
929
|
+
__setAttr?(name: string, newValue: IValue): void;
|
|
930
|
+
__getAttr?(name: string): IValue;
|
|
931
|
+
setProxyAttr?(name: string, newValue: IValue): void;
|
|
932
|
+
getProxyAttr?(name: string): IValue;
|
|
912
933
|
}
|
|
913
934
|
|
|
914
935
|
type ILeafMatrixModule = ILeafMatrix & ThisType<ILeaf>;
|
|
@@ -920,20 +941,22 @@ interface ILeafMatrix {
|
|
|
920
941
|
type ILeafBoundsModule = ILeafBounds & ThisType<ILeaf>;
|
|
921
942
|
interface ILeafBounds {
|
|
922
943
|
__updateWorldBounds?(): void;
|
|
944
|
+
__updateLocalBounds?(): void;
|
|
923
945
|
__updateLocalBoxBounds?(): void;
|
|
924
946
|
__updateLocalStrokeBounds?(): void;
|
|
925
947
|
__updateLocalRenderBounds?(): void;
|
|
926
948
|
__updateBoxBounds?(): void;
|
|
927
949
|
__updateStrokeBounds?(): void;
|
|
928
950
|
__updateRenderBounds?(): void;
|
|
951
|
+
__updateAutoLayout?(): void;
|
|
929
952
|
__updateNaturalSize?(): void;
|
|
930
953
|
__updateStrokeSpread?(): number;
|
|
931
954
|
__updateRenderSpread?(): number;
|
|
932
955
|
__onUpdateSize?(): void;
|
|
933
956
|
}
|
|
934
957
|
|
|
935
|
-
type
|
|
936
|
-
type
|
|
958
|
+
type ILocationType = 'world' | 'local' | 'inner';
|
|
959
|
+
type IBoundsType = 'content' | 'box' | 'stroke' | 'margin' | 'render';
|
|
937
960
|
interface ILeafLayout {
|
|
938
961
|
leaf: ILeaf;
|
|
939
962
|
proxyZoom: boolean;
|
|
@@ -942,8 +965,10 @@ interface ILeafLayout {
|
|
|
942
965
|
renderBounds: IBoundsData;
|
|
943
966
|
marginBounds: IBoundsData;
|
|
944
967
|
contentBounds: IBoundsData;
|
|
945
|
-
localStrokeBounds
|
|
946
|
-
localRenderBounds
|
|
968
|
+
localStrokeBounds?: IBoundsData;
|
|
969
|
+
localRenderBounds?: IBoundsData;
|
|
970
|
+
resized: boolean;
|
|
971
|
+
waitAutoLayout: boolean;
|
|
947
972
|
matrixChanged: boolean;
|
|
948
973
|
scaleChanged: boolean;
|
|
949
974
|
rotationChanged: boolean;
|
|
@@ -963,9 +988,17 @@ interface ILeafLayout {
|
|
|
963
988
|
renderSpread: number;
|
|
964
989
|
strokeBoxSpread: number;
|
|
965
990
|
renderShapeSpread: number;
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
991
|
+
a: number;
|
|
992
|
+
b: number;
|
|
993
|
+
c: number;
|
|
994
|
+
d: number;
|
|
995
|
+
e: number;
|
|
996
|
+
f: number;
|
|
997
|
+
update(): void;
|
|
998
|
+
getTransform(relative?: ILocationType | ILeaf): IMatrixData;
|
|
999
|
+
getBounds(type?: IBoundsType, relative?: ILocationType | ILeaf): IBoundsData;
|
|
1000
|
+
getLayoutBounds(type?: IBoundsType, relative?: ILocationType | ILeaf, unscale?: boolean): ILayoutBoundsData;
|
|
1001
|
+
getLayoutPoints(type?: IBoundsType, relative?: ILocationType | ILeaf): IPointData[];
|
|
969
1002
|
spreadStroke(): void;
|
|
970
1003
|
spreadRender(): void;
|
|
971
1004
|
spreadStrokeCancel(): void;
|
|
@@ -1005,17 +1038,18 @@ type ILeafMaskModule = ILeafMask & ThisType<ILeaf>;
|
|
|
1005
1038
|
interface ILeafMask {
|
|
1006
1039
|
__updateEraser?(value?: boolean): void;
|
|
1007
1040
|
__updateMask?(value?: boolean): void;
|
|
1008
|
-
__renderMask?(canvas: ILeaferCanvas, content: ILeaferCanvas, mask: ILeaferCanvas): void;
|
|
1041
|
+
__renderMask?(canvas: ILeaferCanvas, content: ILeaferCanvas, mask: ILeaferCanvas, recycle?: boolean): void;
|
|
1009
1042
|
__removeMask?(child?: ILeaf): void;
|
|
1010
1043
|
}
|
|
1011
1044
|
|
|
1012
|
-
interface IDataProcessor
|
|
1045
|
+
interface IDataProcessor {
|
|
1013
1046
|
__leaf: ILeaf;
|
|
1014
1047
|
__input: IObject;
|
|
1015
1048
|
__middle: IObject;
|
|
1016
1049
|
__single: boolean;
|
|
1017
1050
|
__checkSingle(): void;
|
|
1018
1051
|
__get(name: string): any;
|
|
1052
|
+
__getData(): IObject;
|
|
1019
1053
|
__setInput(name: string, value: any): void;
|
|
1020
1054
|
__getInput(name: string): any;
|
|
1021
1055
|
__removeInput(name: string): void;
|
|
@@ -1024,47 +1058,94 @@ interface IDataProcessor extends IObject {
|
|
|
1024
1058
|
__getMiddle(name: string): any;
|
|
1025
1059
|
destroy(): void;
|
|
1026
1060
|
}
|
|
1061
|
+
interface ILeafDataOptions {
|
|
1062
|
+
attrs?: 'all' | string[];
|
|
1063
|
+
children?: boolean;
|
|
1064
|
+
}
|
|
1027
1065
|
interface ILeafData extends IDataProcessor, ILeafComputedData {
|
|
1028
1066
|
}
|
|
1029
1067
|
|
|
1068
|
+
interface ISelectPathResult {
|
|
1069
|
+
leaf: ILeaf;
|
|
1070
|
+
path: ILeafList;
|
|
1071
|
+
throughPath?: ILeafList;
|
|
1072
|
+
}
|
|
1073
|
+
interface ISelectPathOptions {
|
|
1074
|
+
name?: string;
|
|
1075
|
+
through?: boolean;
|
|
1076
|
+
exclude?: ILeafList;
|
|
1077
|
+
ignoreHittable?: boolean;
|
|
1078
|
+
}
|
|
1079
|
+
interface ISelectorConfig {
|
|
1080
|
+
}
|
|
1081
|
+
declare enum AnswerType {
|
|
1082
|
+
No = 0,
|
|
1083
|
+
Yes = 1,
|
|
1084
|
+
NoAndSkip = 2,
|
|
1085
|
+
YesAndSkip = 3
|
|
1086
|
+
}
|
|
1087
|
+
interface IFindMethod {
|
|
1088
|
+
(leaf: ILeaf, options?: any): AnswerType;
|
|
1089
|
+
}
|
|
1090
|
+
interface ISelectorProxy {
|
|
1091
|
+
list: ILeaf[];
|
|
1092
|
+
}
|
|
1093
|
+
interface ISelector {
|
|
1094
|
+
target: ILeaf;
|
|
1095
|
+
proxy?: ISelectorProxy;
|
|
1096
|
+
config: ISelectorConfig;
|
|
1097
|
+
getByPoint(hitPoint: IPointData, hitRadius: number, options?: ISelectPathOptions): ISelectPathResult;
|
|
1098
|
+
getBy(condition: number | string | IFindMethod, branch?: ILeaf, one?: boolean, options?: any): ILeaf | ILeaf[];
|
|
1099
|
+
getByInnerId(innerId: number, branch?: ILeaf): ILeaf;
|
|
1100
|
+
getById(id: string, branch?: ILeaf): ILeaf;
|
|
1101
|
+
getByClassName(className: string, branch?: ILeaf): ILeaf[];
|
|
1102
|
+
getByTag(tag: string, branch?: ILeaf): ILeaf[];
|
|
1103
|
+
getByMethod(method: IFindMethod, branch?: ILeaf, one?: boolean, options?: any): ILeaf | ILeaf[];
|
|
1104
|
+
destroy(): void;
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1030
1107
|
interface ICachedLeaf {
|
|
1031
1108
|
canvas: ILeaferCanvas;
|
|
1032
1109
|
matrix?: IMatrix;
|
|
1033
1110
|
bounds: IBoundsData;
|
|
1034
1111
|
}
|
|
1035
1112
|
interface ILeafAttrData {
|
|
1036
|
-
id:
|
|
1037
|
-
name:
|
|
1038
|
-
className:
|
|
1113
|
+
id: IString;
|
|
1114
|
+
name: IString;
|
|
1115
|
+
className: IString;
|
|
1039
1116
|
blendMode: IBlendMode;
|
|
1040
|
-
opacity:
|
|
1041
|
-
visible:
|
|
1042
|
-
isMask:
|
|
1043
|
-
isEraser:
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1117
|
+
opacity: INumber;
|
|
1118
|
+
visible: IBoolean;
|
|
1119
|
+
isMask: IBoolean;
|
|
1120
|
+
isEraser: IBoolean;
|
|
1121
|
+
locked: IBoolean;
|
|
1122
|
+
zIndex: INumber;
|
|
1123
|
+
x: INumber;
|
|
1124
|
+
y: INumber;
|
|
1125
|
+
width: INumber;
|
|
1126
|
+
height: INumber;
|
|
1127
|
+
scaleX: INumber;
|
|
1128
|
+
scaleY: INumber;
|
|
1129
|
+
rotation: INumber;
|
|
1130
|
+
skewX: INumber;
|
|
1131
|
+
skewY: INumber;
|
|
1132
|
+
scale: INumber | IPointData;
|
|
1133
|
+
around: IAround;
|
|
1134
|
+
draggable: IBoolean;
|
|
1135
|
+
editable: IBoolean;
|
|
1136
|
+
editSize?: IEditSize;
|
|
1137
|
+
hittable: IBoolean;
|
|
1058
1138
|
hitFill: IHitType;
|
|
1059
1139
|
hitStroke: IHitType;
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1140
|
+
hitBox: IBoolean;
|
|
1141
|
+
hitChildren: IBoolean;
|
|
1142
|
+
hitSelf: IBoolean;
|
|
1143
|
+
hitRadius: INumber;
|
|
1063
1144
|
cursor: ICursorType | ICursorType[];
|
|
1064
1145
|
}
|
|
1065
1146
|
type IHitType = 'path' | 'pixel' | 'all' | 'none';
|
|
1066
1147
|
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';
|
|
1067
|
-
type
|
|
1148
|
+
type IEditSize = 'size' | 'scale';
|
|
1068
1149
|
interface IImageCursor {
|
|
1069
1150
|
url: string;
|
|
1070
1151
|
x?: number;
|
|
@@ -1075,37 +1156,42 @@ type ICursorType = IImageCursor | '' | 'auto' | 'default' | 'none' | 'context-me
|
|
|
1075
1156
|
interface ICursorTypeMap {
|
|
1076
1157
|
[name: string]: ICursorType | ICursorType[];
|
|
1077
1158
|
}
|
|
1078
|
-
interface ILeafInputData
|
|
1159
|
+
interface ILeafInputData {
|
|
1079
1160
|
tag?: string;
|
|
1080
|
-
id?:
|
|
1081
|
-
name?:
|
|
1082
|
-
className?:
|
|
1161
|
+
id?: IString;
|
|
1162
|
+
name?: IString;
|
|
1163
|
+
className?: IString;
|
|
1083
1164
|
blendMode?: IBlendMode;
|
|
1084
|
-
opacity?:
|
|
1085
|
-
visible?:
|
|
1086
|
-
isMask?:
|
|
1087
|
-
isEraser?:
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1165
|
+
opacity?: INumber;
|
|
1166
|
+
visible?: IBoolean;
|
|
1167
|
+
isMask?: IBoolean;
|
|
1168
|
+
isEraser?: IBoolean;
|
|
1169
|
+
locked?: IBoolean;
|
|
1170
|
+
zIndex?: INumber;
|
|
1171
|
+
x?: INumber;
|
|
1172
|
+
y?: INumber;
|
|
1173
|
+
width?: INumber;
|
|
1174
|
+
height?: INumber;
|
|
1175
|
+
scaleX?: INumber;
|
|
1176
|
+
scaleY?: INumber;
|
|
1177
|
+
rotation?: INumber;
|
|
1178
|
+
skewX?: INumber;
|
|
1179
|
+
skewY?: INumber;
|
|
1180
|
+
scale?: INumber | IPointData;
|
|
1099
1181
|
around?: IAround;
|
|
1100
|
-
draggable?:
|
|
1101
|
-
|
|
1182
|
+
draggable?: IBoolean;
|
|
1183
|
+
editable?: IBoolean;
|
|
1184
|
+
editSize?: IEditSize;
|
|
1185
|
+
hittable?: IBoolean;
|
|
1102
1186
|
hitFill?: IHitType;
|
|
1103
1187
|
hitStroke?: IHitType;
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1188
|
+
hitBox?: IBoolean;
|
|
1189
|
+
hitChildren?: IBoolean;
|
|
1190
|
+
hitSelf?: IBoolean;
|
|
1191
|
+
hitRadius?: INumber;
|
|
1107
1192
|
cursor?: ICursorType | ICursorType[];
|
|
1108
1193
|
children?: ILeafInputData[];
|
|
1194
|
+
noBounds?: boolean;
|
|
1109
1195
|
}
|
|
1110
1196
|
interface ILeafComputedData {
|
|
1111
1197
|
id?: string;
|
|
@@ -1116,6 +1202,7 @@ interface ILeafComputedData {
|
|
|
1116
1202
|
visible?: boolean;
|
|
1117
1203
|
isMask?: boolean;
|
|
1118
1204
|
isEraser?: boolean;
|
|
1205
|
+
locked?: boolean;
|
|
1119
1206
|
zIndex?: number;
|
|
1120
1207
|
x?: number;
|
|
1121
1208
|
y?: number;
|
|
@@ -1128,9 +1215,12 @@ interface ILeafComputedData {
|
|
|
1128
1215
|
skewY?: number;
|
|
1129
1216
|
around?: IAround;
|
|
1130
1217
|
draggable?: boolean;
|
|
1218
|
+
editable?: boolean;
|
|
1219
|
+
editSize?: IEditSize;
|
|
1131
1220
|
hittable?: boolean;
|
|
1132
1221
|
hitFill?: IHitType;
|
|
1133
1222
|
hitStroke?: IHitType;
|
|
1223
|
+
hitBox?: boolean;
|
|
1134
1224
|
hitChildren?: boolean;
|
|
1135
1225
|
hitSelf?: boolean;
|
|
1136
1226
|
hitRadius?: number;
|
|
@@ -1146,16 +1236,21 @@ interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, ILeafMatr
|
|
|
1146
1236
|
readonly innerName: string;
|
|
1147
1237
|
readonly __DataProcessor: IObject;
|
|
1148
1238
|
readonly __LayoutProcessor: IObject;
|
|
1149
|
-
|
|
1239
|
+
readonly app?: ILeaferBase;
|
|
1240
|
+
leafer?: ILeaferBase;
|
|
1150
1241
|
parent?: ILeaf;
|
|
1151
1242
|
readonly isApp?: boolean;
|
|
1152
1243
|
isLeafer?: boolean;
|
|
1153
1244
|
isBranch?: boolean;
|
|
1154
1245
|
isBranchLeaf?: boolean;
|
|
1155
1246
|
__: ILeafData;
|
|
1247
|
+
proxyData?: ILeafInputData;
|
|
1248
|
+
__proxyData?: ILeafInputData;
|
|
1156
1249
|
__layout: ILeafLayout;
|
|
1157
1250
|
__world: IMatrixWithLayoutData;
|
|
1158
|
-
__local
|
|
1251
|
+
__local?: IMatrixWithBoundsData;
|
|
1252
|
+
readonly __localMatrix: IMatrixData;
|
|
1253
|
+
readonly __localBounds: IBoundsData;
|
|
1159
1254
|
__worldOpacity: number;
|
|
1160
1255
|
readonly worldTransform: IMatrixWithLayoutData;
|
|
1161
1256
|
readonly localTransform: IMatrixWithBoundsData;
|
|
@@ -1166,8 +1261,8 @@ interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, ILeafMatr
|
|
|
1166
1261
|
readonly worldOpacity: number;
|
|
1167
1262
|
__level: number;
|
|
1168
1263
|
__tempNumber?: number;
|
|
1169
|
-
readonly
|
|
1170
|
-
|
|
1264
|
+
readonly __worldFlipped: boolean;
|
|
1265
|
+
__hasAutoLayout?: boolean;
|
|
1171
1266
|
__hasMask?: boolean;
|
|
1172
1267
|
__hasEraser?: boolean;
|
|
1173
1268
|
__hitCanvas?: IHitCanvas;
|
|
@@ -1181,32 +1276,41 @@ interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, ILeafMatr
|
|
|
1181
1276
|
waitParent(item: IFunction): void;
|
|
1182
1277
|
waitLeafer(item: IFunction): void;
|
|
1183
1278
|
nextRender(item: IFunction): void;
|
|
1184
|
-
__bindLeafer(leafer:
|
|
1279
|
+
__bindLeafer(leafer: ILeaferBase | null): void;
|
|
1185
1280
|
set(data: IObject): void;
|
|
1281
|
+
get(): ILeafInputData;
|
|
1186
1282
|
toJSON(): IObject;
|
|
1187
1283
|
toString(): string;
|
|
1188
|
-
__setAttr(attrName: string, newValue:
|
|
1189
|
-
__getAttr(attrName: string):
|
|
1284
|
+
__setAttr(attrName: string, newValue: IValue): void;
|
|
1285
|
+
__getAttr(attrName: string): IValue;
|
|
1286
|
+
setProxyAttr(name: string, newValue: IValue): void;
|
|
1287
|
+
getProxyAttr(name: string): IValue;
|
|
1288
|
+
find(condition: number | string | IFindMethod, options?: any): ILeaf[];
|
|
1289
|
+
findOne(condition: number | string | IFindMethod, options?: any): ILeaf;
|
|
1190
1290
|
forceUpdate(attrName?: string): void;
|
|
1291
|
+
updateLayout(): void;
|
|
1191
1292
|
__updateWorldMatrix(): void;
|
|
1192
1293
|
__updateLocalMatrix(): void;
|
|
1193
1294
|
__updateWorldBounds(): void;
|
|
1295
|
+
__updateLocalBounds(): void;
|
|
1194
1296
|
__updateLocalBoxBounds(): void;
|
|
1195
1297
|
__updateLocalStrokeBounds(): void;
|
|
1196
1298
|
__updateLocalRenderBounds(): void;
|
|
1197
1299
|
__updateBoxBounds(): void;
|
|
1198
1300
|
__updateStrokeBounds(): void;
|
|
1199
1301
|
__updateRenderBounds(): void;
|
|
1302
|
+
__updateAutoLayout(): void;
|
|
1200
1303
|
__updateNaturalSize(): void;
|
|
1201
1304
|
__updateStrokeSpread(): number;
|
|
1202
1305
|
__updateRenderSpread(): number;
|
|
1203
1306
|
__onUpdateSize(): void;
|
|
1204
1307
|
__updateEraser(value?: boolean): void;
|
|
1205
1308
|
__updateMask(value?: boolean): void;
|
|
1206
|
-
__renderMask(canvas: ILeaferCanvas, content: ILeaferCanvas, mask: ILeaferCanvas): void;
|
|
1309
|
+
__renderMask(canvas: ILeaferCanvas, content: ILeaferCanvas, mask: ILeaferCanvas, recycle?: boolean): void;
|
|
1207
1310
|
__removeMask(child?: ILeaf): void;
|
|
1208
|
-
getWorld(attrName:
|
|
1209
|
-
getBounds(type
|
|
1311
|
+
getWorld(attrName: ILayoutAttr): number;
|
|
1312
|
+
getBounds(type?: IBoundsType, relative?: ILocationType | ILeaf): IBoundsData;
|
|
1313
|
+
getLayoutBounds(type?: IBoundsType, relative?: ILocationType | ILeaf, unscale?: boolean): ILayoutBoundsData;
|
|
1210
1314
|
worldToLocal(world: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void;
|
|
1211
1315
|
localToWorld(local: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void;
|
|
1212
1316
|
worldToInner(world: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void;
|
|
@@ -1217,10 +1321,14 @@ interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, ILeafMatr
|
|
|
1217
1321
|
getLocalPointByInner(inner: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
|
|
1218
1322
|
getWorldPoint(inner: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
|
|
1219
1323
|
getWorldPointByLocal(local: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
|
|
1324
|
+
setTransform(transform?: IMatrixData, resize?: boolean): void;
|
|
1325
|
+
transform(transform?: IMatrixData, resize?: boolean): void;
|
|
1220
1326
|
move(x: number, y?: number): void;
|
|
1221
|
-
scaleOf(origin: IPointData,
|
|
1327
|
+
scaleOf(origin: IPointData, scaleX: number, scaleY?: number, resize?: boolean): void;
|
|
1222
1328
|
rotateOf(origin: IPointData, rotation: number): void;
|
|
1223
|
-
skewOf(origin: IPointData,
|
|
1329
|
+
skewOf(origin: IPointData, skewX: number, skewY?: number, resize?: boolean): void;
|
|
1330
|
+
scaleResize(scaleX: number, scaleY: number, noResize?: boolean): void;
|
|
1331
|
+
__scaleResize(scaleX: number, scaleY: number): void;
|
|
1224
1332
|
__hitWorld(point: IRadiusPointData): boolean;
|
|
1225
1333
|
__hit(local: IRadiusPointData): boolean;
|
|
1226
1334
|
__drawHitPath(canvas: ILeaferCanvas): void;
|
|
@@ -1239,32 +1347,7 @@ interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, ILeafMatr
|
|
|
1239
1347
|
__updateSortChildren(): void;
|
|
1240
1348
|
add(child: ILeaf, index?: number): void;
|
|
1241
1349
|
remove(child?: ILeaf, destroy?: boolean): void;
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
interface ISelectPathResult {
|
|
1245
|
-
leaf: ILeaf;
|
|
1246
|
-
path: ILeafList;
|
|
1247
|
-
throughPath?: ILeafList;
|
|
1248
|
-
}
|
|
1249
|
-
interface ISelectPathOptions {
|
|
1250
|
-
name?: string;
|
|
1251
|
-
through?: boolean;
|
|
1252
|
-
exclude?: ILeafList;
|
|
1253
|
-
ignoreHittable?: boolean;
|
|
1254
|
-
}
|
|
1255
|
-
interface ISelectorConfig {
|
|
1256
|
-
}
|
|
1257
|
-
interface ISelector {
|
|
1258
|
-
target: ILeaf;
|
|
1259
|
-
list: ILeafList;
|
|
1260
|
-
config: ISelectorConfig;
|
|
1261
|
-
getByPoint(hitPoint: IPointData, hitRadius: number, options?: ISelectPathOptions): ISelectPathResult;
|
|
1262
|
-
find(name: number | string, branch?: ILeaf): ILeaf | ILeaf[];
|
|
1263
|
-
getByInnerId(name: number, branch?: ILeaf): ILeaf;
|
|
1264
|
-
getById(name: string, branch?: ILeaf): ILeaf;
|
|
1265
|
-
getByClassName(name: string, branch?: ILeaf): ILeaf[];
|
|
1266
|
-
getByTagName(name: string, branch?: ILeaf): ILeaf[];
|
|
1267
|
-
destroy(): void;
|
|
1350
|
+
dropTo(parent: ILeaf, index?: number, resize?: boolean): void;
|
|
1268
1351
|
}
|
|
1269
1352
|
|
|
1270
1353
|
type IExportImageType = 'jpg' | 'png' | 'webp';
|
|
@@ -1369,6 +1452,7 @@ interface IInteraction extends IControl {
|
|
|
1369
1452
|
selector: ISelector;
|
|
1370
1453
|
running: boolean;
|
|
1371
1454
|
readonly dragging: boolean;
|
|
1455
|
+
readonly isDragEmpty: boolean;
|
|
1372
1456
|
readonly moveMode: boolean;
|
|
1373
1457
|
config: IInteractionConfig;
|
|
1374
1458
|
cursor: ICursorType | ICursorType[];
|
|
@@ -1412,12 +1496,13 @@ interface IZoomConfig {
|
|
|
1412
1496
|
}
|
|
1413
1497
|
interface IMoveConfig {
|
|
1414
1498
|
holdSpaceKey?: boolean;
|
|
1499
|
+
drag?: boolean;
|
|
1415
1500
|
dragEmpty?: boolean;
|
|
1416
1501
|
dragOut?: boolean;
|
|
1417
1502
|
autoDistance?: number;
|
|
1418
1503
|
}
|
|
1419
1504
|
interface IWheelConfig {
|
|
1420
|
-
zoomMode?: boolean;
|
|
1505
|
+
zoomMode?: boolean | 'mouse';
|
|
1421
1506
|
zoomSpeed?: number;
|
|
1422
1507
|
moveSpeed?: number;
|
|
1423
1508
|
rotateSpeed?: number;
|
|
@@ -1466,15 +1551,13 @@ interface ILeaferConfig extends IRendererConfig, ILeaferCanvasConfig, IInteracti
|
|
|
1466
1551
|
type?: ILeaferType;
|
|
1467
1552
|
realCanvas?: boolean;
|
|
1468
1553
|
}
|
|
1469
|
-
interface
|
|
1470
|
-
readonly isApp: boolean;
|
|
1471
|
-
readonly app: ILeafer;
|
|
1472
|
-
parent?: IApp;
|
|
1554
|
+
interface ILeaferAttrData {
|
|
1473
1555
|
running: boolean;
|
|
1474
1556
|
created: boolean;
|
|
1475
1557
|
ready: boolean;
|
|
1476
1558
|
viewReady: boolean;
|
|
1477
1559
|
viewCompleted: boolean;
|
|
1560
|
+
layoutLocked: boolean;
|
|
1478
1561
|
pixelRatio: number;
|
|
1479
1562
|
view: unknown;
|
|
1480
1563
|
canvas: ILeaferCanvas;
|
|
@@ -1491,7 +1574,11 @@ interface ILeafer extends IZoomView, IControl {
|
|
|
1491
1574
|
leafs: number;
|
|
1492
1575
|
__eventIds: IEventListenerId[];
|
|
1493
1576
|
__nextRenderWait: IFunction[];
|
|
1494
|
-
init(userConfig?: ILeaferConfig, parentApp?:
|
|
1577
|
+
init(userConfig?: ILeaferConfig, parentApp?: IAppBase): void;
|
|
1578
|
+
start(): void;
|
|
1579
|
+
stop(): void;
|
|
1580
|
+
unlockLayout(): void;
|
|
1581
|
+
lockLayout(): void;
|
|
1495
1582
|
setZoomLayer(zoomLayer: ILeaf): void;
|
|
1496
1583
|
forceFullRender(): void;
|
|
1497
1584
|
updateCursor(): void;
|
|
@@ -1500,13 +1587,18 @@ interface ILeafer extends IZoomView, IControl {
|
|
|
1500
1587
|
waitViewReady(item: IFunction): void;
|
|
1501
1588
|
waitViewCompleted(item: IFunction): void;
|
|
1502
1589
|
}
|
|
1590
|
+
interface ILeaferBase extends IZoomView, IControl, ILeaferAttrData {
|
|
1591
|
+
readonly isApp: boolean;
|
|
1592
|
+
readonly app: ILeaferBase;
|
|
1593
|
+
parent?: IAppBase;
|
|
1594
|
+
}
|
|
1503
1595
|
interface ILeaferTypeCreator {
|
|
1504
1596
|
list: ILeaferTypeList;
|
|
1505
1597
|
register(name: string, fn: ILeaferTypeFunction): void;
|
|
1506
|
-
run(name: string, leafer:
|
|
1598
|
+
run(name: string, leafer: ILeaferBase): void;
|
|
1507
1599
|
}
|
|
1508
1600
|
interface ILeaferTypeFunction {
|
|
1509
|
-
(leafer:
|
|
1601
|
+
(leafer: ILeaferBase): void;
|
|
1510
1602
|
}
|
|
1511
1603
|
interface ILeaferTypeList {
|
|
1512
1604
|
[key: string]: ILeaferTypeFunction;
|
|
@@ -1520,14 +1612,15 @@ interface ICreator {
|
|
|
1520
1612
|
renderer?(target: ILeaf, canvas: ILeaferCanvas, options?: IRendererConfig): IRenderer;
|
|
1521
1613
|
selector?(target: ILeaf, options?: ISelectorConfig): ISelector;
|
|
1522
1614
|
interaction?(target: ILeaf, canvas: IInteractionCanvas, selector: ISelector, options?: IInteractionConfig): IInteraction;
|
|
1615
|
+
editor?(options?: IObject): ILeaf;
|
|
1523
1616
|
}
|
|
1524
1617
|
interface IUICreator {
|
|
1525
1618
|
register(UI: IObject): void;
|
|
1526
1619
|
get(tag: string, data: IObject): IObject;
|
|
1527
1620
|
}
|
|
1528
1621
|
|
|
1529
|
-
interface
|
|
1530
|
-
children:
|
|
1622
|
+
interface IAppBase extends ILeaferBase {
|
|
1623
|
+
children: ILeaferBase[];
|
|
1531
1624
|
realCanvas: boolean;
|
|
1532
1625
|
}
|
|
1533
1626
|
|
|
@@ -1593,11 +1686,41 @@ interface IImageManager {
|
|
|
1593
1686
|
destroy(): void;
|
|
1594
1687
|
}
|
|
1595
1688
|
|
|
1689
|
+
type ICanvasType = 'skia' | 'napi' | 'canvas' | 'wx';
|
|
1690
|
+
interface ISkiaCanvas {
|
|
1691
|
+
toBuffer(format: IExportFileType, config: ISkiaCanvasExportConfig): Promise<any>;
|
|
1692
|
+
toBufferSync(format: IExportFileType, config: ISkiaCanvasExportConfig): any;
|
|
1693
|
+
toDataURL(format: IExportImageType, config: ISkiaCanvasExportConfig): Promise<string>;
|
|
1694
|
+
toDataURLSync(format: IExportImageType, config: ISkiaCanvasExportConfig): string;
|
|
1695
|
+
saveAs(filename: string, config: ISkiaCanvasExportConfig): Promise<void>;
|
|
1696
|
+
saveAsSync(filename: string, config: ISkiaCanvasExportConfig): void;
|
|
1697
|
+
}
|
|
1698
|
+
interface ISkiaCanvasExportConfig {
|
|
1699
|
+
page?: number;
|
|
1700
|
+
matte?: string;
|
|
1701
|
+
density?: number;
|
|
1702
|
+
quality?: number;
|
|
1703
|
+
outline?: boolean;
|
|
1704
|
+
}
|
|
1705
|
+
interface ISkiaNAPICanvas {
|
|
1706
|
+
encodeSync(format: 'webp' | 'jpeg', quality?: number): any;
|
|
1707
|
+
encodeSync(format: 'png'): any;
|
|
1708
|
+
encode(format: 'webp' | 'jpeg' | string, quality?: number): Promise<any>;
|
|
1709
|
+
encode(format: 'png'): Promise<any>;
|
|
1710
|
+
toBuffer(mime: 'image/png'): any;
|
|
1711
|
+
toBuffer(mime: 'image/jpeg' | 'image/webp' | string, quality?: number): any;
|
|
1712
|
+
toDataURL(mime?: 'image/png'): string;
|
|
1713
|
+
toDataURL(mime: 'image/jpeg' | 'image/webp' | string, quality?: number): string;
|
|
1714
|
+
toDataURLAsync(mime?: 'image/png'): Promise<string>;
|
|
1715
|
+
toDataURLAsync(mime: 'image/jpeg' | 'image/webp' | string, quality?: number): Promise<string>;
|
|
1716
|
+
}
|
|
1717
|
+
|
|
1596
1718
|
interface IPlatform {
|
|
1597
1719
|
name?: 'web' | 'node' | 'miniapp';
|
|
1598
1720
|
os?: 'Mac' | 'Windows' | 'Linux';
|
|
1599
1721
|
requestRender?(render: IFunction): void;
|
|
1600
1722
|
canvas?: ILeaferCanvas;
|
|
1723
|
+
canvasType?: ICanvasType;
|
|
1601
1724
|
isWorker?: boolean;
|
|
1602
1725
|
isMobile?: boolean;
|
|
1603
1726
|
devicePixelRatio?: number;
|
|
@@ -1607,7 +1730,6 @@ interface IPlatform {
|
|
|
1607
1730
|
fullImageShadow?: boolean;
|
|
1608
1731
|
syncDomFont?: boolean;
|
|
1609
1732
|
layout?(target: ILeaf): void;
|
|
1610
|
-
realtimeLayout?: boolean;
|
|
1611
1733
|
origin?: {
|
|
1612
1734
|
createCanvas(width: number, height: number, format?: 'svg' | 'pdf'): any;
|
|
1613
1735
|
canvasToDataURL(canvas: any, type?: IExportImageType, quality?: number): string | Promise<string>;
|
|
@@ -1616,13 +1738,19 @@ interface IPlatform {
|
|
|
1616
1738
|
loadImage(url: string): Promise<any>;
|
|
1617
1739
|
noRepeat?: string;
|
|
1618
1740
|
};
|
|
1741
|
+
roundRectPatch?: boolean;
|
|
1742
|
+
ellipseToCurve?: boolean;
|
|
1619
1743
|
event?: {
|
|
1620
1744
|
stopDefault(origin: IObject): void;
|
|
1621
1745
|
stopNow(origin: IObject): void;
|
|
1622
1746
|
stop(origin: IObject): void;
|
|
1623
1747
|
};
|
|
1624
1748
|
miniapp?: IMiniapp;
|
|
1625
|
-
|
|
1749
|
+
image: {
|
|
1750
|
+
maxCacheSize: number;
|
|
1751
|
+
maxPatternSize: number;
|
|
1752
|
+
suffix: string;
|
|
1753
|
+
};
|
|
1626
1754
|
}
|
|
1627
1755
|
interface IMiniappSelect extends IObject {
|
|
1628
1756
|
}
|
|
@@ -1643,24 +1771,7 @@ interface IPlugin extends IObject {
|
|
|
1643
1771
|
importVersion: string;
|
|
1644
1772
|
import: string[];
|
|
1645
1773
|
run(LeaferUI: IObject, config: IObject): void;
|
|
1646
|
-
onLeafer?(leafer:
|
|
1647
|
-
}
|
|
1648
|
-
|
|
1649
|
-
type ICanvasType = 'skia' | 'canvas' | 'wx';
|
|
1650
|
-
interface ISkiaCanvas {
|
|
1651
|
-
toBuffer(format: IExportFileType, config: ISkiaCanvasExportConfig): Promise<any>;
|
|
1652
|
-
toBufferSync(format: IExportFileType, config: ISkiaCanvasExportConfig): any;
|
|
1653
|
-
toDataURL(format: IExportImageType, config: ISkiaCanvasExportConfig): Promise<string>;
|
|
1654
|
-
toDataURLSync(format: IExportImageType, config: ISkiaCanvasExportConfig): string;
|
|
1655
|
-
saveAs(filename: string, config: ISkiaCanvasExportConfig): Promise<void>;
|
|
1656
|
-
saveAsSync(filename: string, config: ISkiaCanvasExportConfig): void;
|
|
1657
|
-
}
|
|
1658
|
-
interface ISkiaCanvasExportConfig {
|
|
1659
|
-
page?: number;
|
|
1660
|
-
matte?: string;
|
|
1661
|
-
density?: number;
|
|
1662
|
-
quality?: number;
|
|
1663
|
-
outline?: boolean;
|
|
1774
|
+
onLeafer?(leafer: ILeaferBase): void;
|
|
1664
1775
|
}
|
|
1665
1776
|
|
|
1666
|
-
export type
|
|
1777
|
+
export { type ACommandData, AnswerType, type ArcCommandData, type ArcToCommandData, type CCommandData, type CanvasPathCommand, type EllipseCommandData, type HCommandData, type IAnimateEvent, type IAppBase, type IAround, type IAttrDecorator, type IAutoBounds, type IAutoBoundsData, type IBlendMode, type IBlob, type IBlobFunction, type IBoolean, type IBooleanMap, type IBounds, type IBoundsData, type IBoundsDataFn, type IBoundsType, type IBranch, type IBranchRender, type IBranchRenderModule, type ICachedLeaf, type ICanvasAttr, type ICanvasContext2D, type ICanvasManager, type ICanvasStrokeOptions, type ICanvasType, type IChildEvent, type IControl, type ICreator, type ICursorType, type ICursorTypeMap, type IDataProcessor, type IDataTypeHandle, type IDragEvent, type IDropEvent, type IEditSize, type IEvent, type IEventListener, type IEventListenerId, type IEventListenerItem, type IEventListenerMap, type IEventListenerOptions, type IEventTarget, type IEventer, type IExportFileType, type IExportImageType, type IFindMethod, type IFunction, type IHitCanvas, type IHitCanvasConfig, type IHitCanvasManager, type IHitType, type IImageEvent, type IImageManager, type IInteraction, type IInteractionCanvas, type IInteractionConfig, type IKeepTouchData, type IKeyEvent, type ILayoutAttr, type ILayoutBlockData, type ILayoutBoundsData, type ILayoutChangedData, type ILayoutData, type ILayoutEvent, type ILayouter, type ILayouterConfig, type ILeaf, type ILeafArrayMap, type ILeafAttrData, type ILeafBounds, type ILeafBoundsModule, type ILeafComputedData, type ILeafData, type ILeafDataOptions, type ILeafDataProxy, type ILeafDataProxyModule, type ILeafEventer, type ILeafEventerModule, type ILeafHit, type ILeafHitModule, type ILeafInputData, type ILeafLayout, type ILeafLevelList, type ILeafList, type ILeafListItemCallback, type ILeafMap, type ILeafMask, type ILeafMaskModule, type ILeafMatrix, type ILeafMatrixModule, type ILeafRender, type ILeafRenderModule, type ILeaferAttrData, type ILeaferBase, type ILeaferCanvas, type ILeaferCanvasConfig, type ILeaferConfig, type ILeaferEvent, type ILeaferImage, type ILeaferImageConfig, type ILeaferImageOnError, type ILeaferImageOnLoaded, type ILeaferType, type ILeaferTypeCreator, type ILeaferTypeFunction, type ILeaferTypeList, type ILocationType, type IMatrix, type IMatrixData, type IMatrixWithBoundsData, type IMatrixWithLayoutData, type IMatrixWithScaleData, type IMiniapp, type IMiniappSelect, type IMiniappSizeView, type IMoveEvent, type IMultiTouchData, type INumber, type INumberMap, type IObject, type IOffsetBoundsData, type IPartLayoutConfig, type IPath2D, type IPathCommandData, type IPathCreator, type IPathDrawer, type IPathString, type IPlatform, type IPlugin, type IPoint, type IPointData, type IPointerConfig, type IPointerEvent, type IPropertyEvent, type IRadiusPointData, type IRenderEvent, type IRenderOptions, type IRenderer, type IRendererConfig, type IResizeEvent, type IResizeEventListener, type IRotateEvent, type IScaleData, type IScaleRotationData, type IScreenSizeData, type ISelectPathOptions, type ISelectPathResult, type ISelector, type ISelectorConfig, type ISelectorProxy, type ISize, type ISizeData, type ISkewData, type ISkiaCanvas, type ISkiaCanvasExportConfig, type ISkiaNAPICanvas, type IString, type IStringMap, type ISwipeEvent, type ITaskItem, type ITaskOptions, type ITaskProcessor, type ITaskProcessorConfig, type ITextMetrics, type ITimer, type ITwoPointBoundsData, type IUICreator, type IUIEvent, type IUpdateEvent, type IValue, type IWatchEvent, type IWatchEventData, type IWatcher, type IWatcherConfig, type IWheelConfig, type IWindingRule, type IZoomEvent, type IZoomView, type InnerId, type LCommandData, type MCommandData, type PointerType, type QCommandData, type RectCommandData, type RoundRectCommandData, type SCommandData, type TCommandData, type VCommandData, type ZCommandData };
|