@leafer/interface 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/app/ILeafer.ts +1 -0
- package/src/canvas/ILeaferCanvas.ts +2 -1
- package/src/data/IData.ts +6 -0
- package/src/display/ILeaf.ts +13 -1
- package/src/event/IEventer.ts +10 -4
- package/src/event/IUIEvent.ts +2 -1
- package/src/index.ts +3 -3
- package/src/interaction/IInteraction.ts +13 -1
- package/src/math/IMath.ts +2 -2
- package/src/platform/IPlatform.ts +1 -1
- package/types/index.d.ts +53 -32
package/package.json
CHANGED
package/src/app/ILeafer.ts
CHANGED
|
@@ -21,6 +21,7 @@ export type ILeaferType = 'draw' | 'editor' | 'design' | 'board' | 'document' |
|
|
|
21
21
|
export interface ILeaferConfig extends IRendererConfig, ILeaferCanvasConfig, IInteractionConfig, ILayouterConfig {
|
|
22
22
|
start?: boolean
|
|
23
23
|
type?: ILeaferType
|
|
24
|
+
mobile?: boolean
|
|
24
25
|
realCanvas?: boolean
|
|
25
26
|
lazySpeard?: IFourNumber
|
|
26
27
|
}
|
|
@@ -10,6 +10,7 @@ import { IExportOptions } from '../file/IExport'
|
|
|
10
10
|
|
|
11
11
|
export interface ILeaferCanvasConfig extends IAutoBoundsData {
|
|
12
12
|
view?: string | IObject
|
|
13
|
+
canvas?: string | IObject
|
|
13
14
|
fill?: string
|
|
14
15
|
pixelRatio?: number
|
|
15
16
|
smooth?: boolean
|
|
@@ -199,7 +200,7 @@ export interface ILeaferCanvas extends ICanvasAttr, ICanvasMethod, IPathDrawer {
|
|
|
199
200
|
getSameCanvas(useSameWorldTransform?: boolean, useSameSmooth?: boolean): ILeaferCanvas
|
|
200
201
|
recycle(clearBounds?: IBoundsData): void
|
|
201
202
|
|
|
202
|
-
updateRender(): void
|
|
203
|
+
updateRender(bounds: IBoundsData): void
|
|
203
204
|
unrealCanvas(): void
|
|
204
205
|
destroy(): void
|
|
205
206
|
}
|
package/src/data/IData.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IPointData } from '../math/IMath'
|
|
2
|
+
import { IFunction } from '../function/IFunction'
|
|
2
3
|
|
|
3
4
|
export type INumber = number // number | string will convert to number
|
|
4
5
|
export type IBoolean = boolean // boolean | string will convert to boolean
|
|
@@ -26,6 +27,11 @@ export interface IStringMap {
|
|
|
26
27
|
[name: string]: string
|
|
27
28
|
}
|
|
28
29
|
|
|
30
|
+
export interface IFunctionMap {
|
|
31
|
+
[name: string]: IFunction
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
|
|
29
35
|
export interface IPointDataMap {
|
|
30
36
|
[name: string]: IPointData
|
|
31
37
|
}
|
package/src/display/ILeaf.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ILeaferBase } from '../app/ILeafer'
|
|
2
|
-
import { IEventer } from '../event/IEventer'
|
|
2
|
+
import { IEventer, IEventMap } from '../event/IEventer'
|
|
3
3
|
|
|
4
4
|
import { ILeaferCanvas, IHitCanvas } from '../canvas/ILeaferCanvas'
|
|
5
5
|
import { IRenderOptions } from '../renderer/IRenderer'
|
|
@@ -106,6 +106,8 @@ export interface ILeafAttrData {
|
|
|
106
106
|
|
|
107
107
|
cursor?: ICursorType | ICursorType[]
|
|
108
108
|
|
|
109
|
+
event?: IEventMap
|
|
110
|
+
|
|
109
111
|
normalStyle?: ILeafInputData // restore hover / press / focus / selected / disabled style
|
|
110
112
|
hoverStyle?: ILeafInputData
|
|
111
113
|
pressStyle?: ILeafInputData
|
|
@@ -221,6 +223,12 @@ export type IDirection =
|
|
|
221
223
|
| 'left'
|
|
222
224
|
| 'center'
|
|
223
225
|
|
|
226
|
+
export type IDirection4 =
|
|
227
|
+
| 'top'
|
|
228
|
+
| 'right'
|
|
229
|
+
| 'bottom'
|
|
230
|
+
| 'left'
|
|
231
|
+
|
|
224
232
|
export type IAlign = IDirection
|
|
225
233
|
|
|
226
234
|
export type IBaseLineAlign =
|
|
@@ -364,6 +372,8 @@ export interface ILeafInputData {
|
|
|
364
372
|
|
|
365
373
|
cursor?: ICursorType | ICursorType[]
|
|
366
374
|
|
|
375
|
+
event?: IEventMap
|
|
376
|
+
|
|
367
377
|
normalStyle?: ILeafInputData
|
|
368
378
|
hoverStyle?: ILeafInputData
|
|
369
379
|
pressStyle?: ILeafInputData
|
|
@@ -679,6 +689,8 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
|
|
|
679
689
|
rotateOfWorld(worldOrigin: IPointData, rotation: number): void
|
|
680
690
|
skewOfWorld(worldOrigin: IPointData, skewX: number, skewY?: number, resize?: boolean): void
|
|
681
691
|
|
|
692
|
+
flip(axis: IAxis): void
|
|
693
|
+
|
|
682
694
|
scaleResize(scaleX: number, scaleY: number, noResize?: boolean): void
|
|
683
695
|
__scaleResize(scaleX: number, scaleY: number): void
|
|
684
696
|
|
package/src/event/IEventer.ts
CHANGED
|
@@ -12,6 +12,8 @@ export interface IEventListenerOptions {
|
|
|
12
12
|
once?: boolean
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
export type IEventOption = IEventListenerOptions | boolean | 'once'
|
|
16
|
+
|
|
15
17
|
export interface IEventListenerItem extends IEventListenerOptions {
|
|
16
18
|
listener: IEventListener
|
|
17
19
|
}
|
|
@@ -20,11 +22,15 @@ export interface IEventListenerMap {
|
|
|
20
22
|
[name: string]: IEventListenerItem[]
|
|
21
23
|
}
|
|
22
24
|
|
|
25
|
+
export interface IEventMap {
|
|
26
|
+
[name: string]: IEventListener | [IEventListener, IEventOption]
|
|
27
|
+
}
|
|
28
|
+
|
|
23
29
|
export interface IEventListenerId {
|
|
24
30
|
type: string | string[]
|
|
25
31
|
current: ILeaf
|
|
26
32
|
listener: IEventListener
|
|
27
|
-
options?:
|
|
33
|
+
options?: IEventOption
|
|
28
34
|
}
|
|
29
35
|
|
|
30
36
|
export type InnerId = number
|
|
@@ -35,9 +41,9 @@ export interface IEventer extends ILeafEventer {
|
|
|
35
41
|
__captureMap?: IEventListenerMap
|
|
36
42
|
__bubbleMap?: IEventListenerMap
|
|
37
43
|
|
|
38
|
-
on(type: string | string[], listener: IEventListener, options?:
|
|
39
|
-
off(type?: string | string[], listener?: IEventListener, options?:
|
|
40
|
-
on_(type: string | string[], listener: IEventListener, bind?: IObject, options?:
|
|
44
|
+
on(type: string | string[], listener: IEventListener, options?: IEventOption): void
|
|
45
|
+
off(type?: string | string[], listener?: IEventListener, options?: IEventOption): void
|
|
46
|
+
on_(type: string | string[], listener: IEventListener, bind?: IObject, options?: IEventOption): IEventListenerId
|
|
41
47
|
off_(id: IEventListenerId | IEventListenerId[]): void
|
|
42
48
|
once(type: string | string[], listener: IEventListener): void
|
|
43
49
|
emit(type: string, event?: IEvent | IObject, capture?: boolean): void
|
package/src/event/IUIEvent.ts
CHANGED
|
@@ -33,6 +33,7 @@ export interface IPointerEvent extends IUIEvent {
|
|
|
33
33
|
width?: number
|
|
34
34
|
height?: number
|
|
35
35
|
pointerType?: PointerType
|
|
36
|
+
multiTouch?: boolean
|
|
36
37
|
pressure?: number
|
|
37
38
|
tangentialPressure?: number
|
|
38
39
|
tiltX?: number
|
|
@@ -73,7 +74,7 @@ export interface IZoomEvent extends IUIEvent {
|
|
|
73
74
|
}
|
|
74
75
|
|
|
75
76
|
export interface IMoveEvent extends IDragEvent {
|
|
76
|
-
|
|
77
|
+
moveType?: 'drag' | 'move'
|
|
77
78
|
}
|
|
78
79
|
|
|
79
80
|
export interface ISwipeEvent extends IDragEvent {
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { IAppBase } from './app/IApp'
|
|
2
2
|
export { ILeaferBase, ILeaferAttrData, ILeaferType, ILeaferTypeCreator, ILeaferTypeFunction, ILeaferTypeList, ILeaferConfig, ICreator, IUICreator, IZoomType } from './app/ILeafer'
|
|
3
|
-
export { ILeaf, ILeafAttrData, ILeafComputedData, ILeafInputData, ICachedLeaf, IFlowType, IFlowBoxType, IAlign, IAxisAlign, IFlowAlign, IFlowAxisAlign, IAxis, IGap, IPointGap, IAxisReverse, IBaseLineAlign, IFlowWrap, IAutoSize, IRangeSize, IPercentData, IUnitData, IConstraint, IConstraintType, IHitType, IMaskType, IEraserType, IBlendMode, IEditSize, IImageCursor, ICursorType, IStateStyleType, IDirection, IAround, ILeafAttrDescriptor, ILeafAttrDescriptorFn } from './display/ILeaf'
|
|
3
|
+
export { ILeaf, ILeafAttrData, ILeafComputedData, ILeafInputData, ICachedLeaf, IFlowType, IFlowBoxType, IAlign, IAxisAlign, IFlowAlign, IFlowAxisAlign, IAxis, IGap, IPointGap, IAxisReverse, IBaseLineAlign, IFlowWrap, IAutoSize, IRangeSize, IPercentData, IUnitData, IConstraint, IConstraintType, IHitType, IMaskType, IEraserType, IBlendMode, IEditSize, IImageCursor, ICursorType, IStateStyleType, IDirection, IDirection4, IAround, ILeafAttrDescriptor, ILeafAttrDescriptorFn } from './display/ILeaf'
|
|
4
4
|
export { IBranch } from './display/IBranch'
|
|
5
5
|
export { IZoomView } from './display/IView'
|
|
6
6
|
|
|
@@ -43,14 +43,14 @@ export { ILeaferImage, ILeaferImageConfig, ILeaferImageOnLoaded, ILeaferImageOnE
|
|
|
43
43
|
export { IExportFileType, IExportImageType } from './file/IFileType'
|
|
44
44
|
export { IExportOptions, IJSONOptions, IExportResult, IExportResultFunction, IExportOnCanvasFunction } from './file/IExport'
|
|
45
45
|
|
|
46
|
-
export { InnerId, IEventer, IEventListener, IEventListenerOptions, IEventListenerMap, IEventListenerItem, IEventListenerId } from './event/IEventer'
|
|
46
|
+
export { InnerId, IEventer, IEventMap, IEventListener, IEventOption, IEventListenerOptions, IEventListenerMap, IEventListenerItem, IEventListenerId } from './event/IEventer'
|
|
47
47
|
export { IEventTarget, IEvent, ILeaferEvent, IPropertyEvent, ILayoutEvent, IRenderEvent, IAnimateEvent, IChildEvent, IResizeEvent, IResizeEventListener, IUpdateEvent, IWatchEvent, IMultiTouchData, IKeepTouchData } from './event/IEvent'
|
|
48
48
|
export { IUIEvent, IPointerEvent, PointerType, IDragEvent, IDropEvent, ISwipeEvent, IMoveEvent, IZoomEvent, IRotateEvent, IKeyEvent, IImageEvent } from './event/IUIEvent'
|
|
49
49
|
export { ICursorTypeMap, ICursorRotate, ICursorRotateMap } from './interaction/ICursor'
|
|
50
50
|
export { IInteraction, IInteractionCanvas, IInteractionConfig, IWheelConfig, IPointerConfig } from './interaction/IInteraction'
|
|
51
51
|
|
|
52
52
|
|
|
53
|
-
export { INumber, IBoolean, IString, IValue, IFourNumber, IPathString, ITimer, IObject, INumberMap, IStringMap, IBooleanMap, IPointDataMap, IDataTypeHandle } from './data/IData'
|
|
53
|
+
export { INumber, IBoolean, IString, IValue, IFourNumber, IPathString, ITimer, IObject, INumberMap, IStringMap, IBooleanMap, IFunctionMap, IPointDataMap, IDataTypeHandle } from './data/IData'
|
|
54
54
|
export { ILeafList, ILeafArrayMap, ILeafMap, ILeafLevelList, ILeafListItemCallback } from './data/IList'
|
|
55
55
|
export { IPoint, IPointData, IFromToData, IUnitPointData, IScrollPointData, IClientPointData, IRadiusPointData, ISize, ISizeData, IScreenSizeData, IBounds, IBoundsData, IBoundsDataFn, IOffsetBoundsData, ITwoPointBoundsData, IAutoBounds, IAutoBoxData, IAutoBoundsData, IMatrix, IMatrixData, IMatrixWithBoundsData, IMatrixWithScaleData, IMatrixWithOptionScaleData, IMatrixWithBoundsScaleData, IMatrixWithLayoutData, IScaleRotationData, IScaleData, ISkewData, ILayoutBoundsData, ILayoutData, ILayoutAttr } from './math/IMath'
|
|
56
56
|
export { IFunction, IStringFunction, INumberFunction, IObjectFunction, IPointDataFunction, IAttrDecorator } from './function/IFunction'
|
|
@@ -16,10 +16,18 @@ export interface IInteraction extends IControl {
|
|
|
16
16
|
selector: ISelector
|
|
17
17
|
|
|
18
18
|
running: boolean
|
|
19
|
+
|
|
19
20
|
readonly dragging: boolean
|
|
21
|
+
readonly transforming: boolean
|
|
22
|
+
|
|
23
|
+
readonly moveMode: boolean
|
|
24
|
+
readonly canHover: boolean
|
|
25
|
+
|
|
20
26
|
readonly isDragEmpty: boolean
|
|
27
|
+
readonly isMobileDragEmpty: boolean
|
|
28
|
+
readonly isHoldMiddleKey: boolean
|
|
21
29
|
readonly isHoldRightKey: boolean
|
|
22
|
-
readonly
|
|
30
|
+
readonly isHoldSpaceKey: boolean
|
|
23
31
|
|
|
24
32
|
config: IInteractionConfig
|
|
25
33
|
|
|
@@ -127,7 +135,11 @@ export interface IPointerConfig {
|
|
|
127
135
|
tapTime?: number
|
|
128
136
|
longPressTime?: number
|
|
129
137
|
transformTime?: number
|
|
138
|
+
|
|
139
|
+
// mobile
|
|
130
140
|
hover?: boolean
|
|
141
|
+
touch?: boolean // 使用touch事件代替pointer事件
|
|
142
|
+
|
|
131
143
|
dragHover?: boolean
|
|
132
144
|
dragDistance?: number
|
|
133
145
|
swipeDistance?: number
|
package/src/math/IMath.ts
CHANGED
|
@@ -221,8 +221,8 @@ export interface IMatrix extends IMatrixWithScaleData {
|
|
|
221
221
|
toOuterPoint(inner: IPointData, to?: IPointData, distance?: boolean): void
|
|
222
222
|
toInnerPoint(outer: IPointData, to?: IPointData, distance?: boolean): void
|
|
223
223
|
|
|
224
|
-
setLayout(data: ILayoutData, origin?: IPointData): IMatrix
|
|
225
|
-
getLayout(origin?: IPointData, firstSkewY?: boolean): ILayoutData
|
|
224
|
+
setLayout(data: ILayoutData, origin?: IPointData, around?: IPointData,): IMatrix
|
|
225
|
+
getLayout(origin?: IPointData, around?: IPointData, firstSkewY?: boolean): ILayoutData
|
|
226
226
|
|
|
227
227
|
withScale(scaleX?: number, scaleY?: number): IMatrixWithScaleData
|
|
228
228
|
|
|
@@ -15,7 +15,7 @@ export interface IPlatform {
|
|
|
15
15
|
canvasType?: ICanvasType
|
|
16
16
|
isWorker?: boolean
|
|
17
17
|
isMobile?: boolean
|
|
18
|
-
devicePixelRatio?: number
|
|
18
|
+
readonly devicePixelRatio?: number
|
|
19
19
|
intWheelDeltaY?: boolean // firefox / Windows need
|
|
20
20
|
conicGradientSupport?: boolean
|
|
21
21
|
conicGradientRotate90?: boolean // firefox need rotate
|
package/types/index.d.ts
CHANGED
|
@@ -166,8 +166,8 @@ interface IMatrix extends IMatrixWithScaleData {
|
|
|
166
166
|
invertWith(): IMatrix;
|
|
167
167
|
toOuterPoint(inner: IPointData, to?: IPointData, distance?: boolean): void;
|
|
168
168
|
toInnerPoint(outer: IPointData, to?: IPointData, distance?: boolean): void;
|
|
169
|
-
setLayout(data: ILayoutData, origin?: IPointData): IMatrix;
|
|
170
|
-
getLayout(origin?: IPointData, firstSkewY?: boolean): ILayoutData;
|
|
169
|
+
setLayout(data: ILayoutData, origin?: IPointData, around?: IPointData): IMatrix;
|
|
170
|
+
getLayout(origin?: IPointData, around?: IPointData, firstSkewY?: boolean): ILayoutData;
|
|
171
171
|
withScale(scaleX?: number, scaleY?: number): IMatrixWithScaleData;
|
|
172
172
|
reset(): void;
|
|
173
173
|
}
|
|
@@ -184,6 +184,28 @@ interface IMatrixWithBoundsScaleData extends IMatrixData, IBoundsData, IScaleDat
|
|
|
184
184
|
interface IMatrixWithLayoutData extends IMatrixData, ILayoutBoundsData {
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
+
interface IFunction {
|
|
188
|
+
(...arg: any): any;
|
|
189
|
+
}
|
|
190
|
+
interface INumberFunction {
|
|
191
|
+
(...arg: any): number;
|
|
192
|
+
}
|
|
193
|
+
interface IStringFunction {
|
|
194
|
+
(...arg: any): string;
|
|
195
|
+
}
|
|
196
|
+
interface IObjectFunction {
|
|
197
|
+
(...arg: any): IObject;
|
|
198
|
+
}
|
|
199
|
+
interface IPointDataFunction {
|
|
200
|
+
(...arg: any): IPointData;
|
|
201
|
+
}
|
|
202
|
+
interface IAttrDecorator {
|
|
203
|
+
(...arg: any): IAttrDecoratorInner;
|
|
204
|
+
}
|
|
205
|
+
interface IAttrDecoratorInner {
|
|
206
|
+
(target: any, key: string): any;
|
|
207
|
+
}
|
|
208
|
+
|
|
187
209
|
type INumber = number;
|
|
188
210
|
type IBoolean = boolean;
|
|
189
211
|
type IString = string;
|
|
@@ -203,6 +225,9 @@ interface INumberMap {
|
|
|
203
225
|
interface IStringMap {
|
|
204
226
|
[name: string]: string;
|
|
205
227
|
}
|
|
228
|
+
interface IFunctionMap {
|
|
229
|
+
[name: string]: IFunction;
|
|
230
|
+
}
|
|
206
231
|
interface IPointDataMap {
|
|
207
232
|
[name: string]: IPointData;
|
|
208
233
|
}
|
|
@@ -397,53 +422,35 @@ interface ILeafEventer {
|
|
|
397
422
|
hasEvent?(type: string, capture?: boolean): boolean;
|
|
398
423
|
}
|
|
399
424
|
|
|
400
|
-
interface IFunction {
|
|
401
|
-
(...arg: any): any;
|
|
402
|
-
}
|
|
403
|
-
interface INumberFunction {
|
|
404
|
-
(...arg: any): number;
|
|
405
|
-
}
|
|
406
|
-
interface IStringFunction {
|
|
407
|
-
(...arg: any): string;
|
|
408
|
-
}
|
|
409
|
-
interface IObjectFunction {
|
|
410
|
-
(...arg: any): IObject;
|
|
411
|
-
}
|
|
412
|
-
interface IPointDataFunction {
|
|
413
|
-
(...arg: any): IPointData;
|
|
414
|
-
}
|
|
415
|
-
interface IAttrDecorator {
|
|
416
|
-
(...arg: any): IAttrDecoratorInner;
|
|
417
|
-
}
|
|
418
|
-
interface IAttrDecoratorInner {
|
|
419
|
-
(target: any, key: string): any;
|
|
420
|
-
}
|
|
421
|
-
|
|
422
425
|
type IEventListener = IFunction;
|
|
423
426
|
interface IEventListenerOptions {
|
|
424
427
|
capture?: boolean;
|
|
425
428
|
once?: boolean;
|
|
426
429
|
}
|
|
430
|
+
type IEventOption = IEventListenerOptions | boolean | 'once';
|
|
427
431
|
interface IEventListenerItem extends IEventListenerOptions {
|
|
428
432
|
listener: IEventListener;
|
|
429
433
|
}
|
|
430
434
|
interface IEventListenerMap {
|
|
431
435
|
[name: string]: IEventListenerItem[];
|
|
432
436
|
}
|
|
437
|
+
interface IEventMap {
|
|
438
|
+
[name: string]: IEventListener | [IEventListener, IEventOption];
|
|
439
|
+
}
|
|
433
440
|
interface IEventListenerId {
|
|
434
441
|
type: string | string[];
|
|
435
442
|
current: ILeaf;
|
|
436
443
|
listener: IEventListener;
|
|
437
|
-
options?:
|
|
444
|
+
options?: IEventOption;
|
|
438
445
|
}
|
|
439
446
|
type InnerId = number;
|
|
440
447
|
interface IEventer extends ILeafEventer {
|
|
441
448
|
readonly innerId: InnerId;
|
|
442
449
|
__captureMap?: IEventListenerMap;
|
|
443
450
|
__bubbleMap?: IEventListenerMap;
|
|
444
|
-
on(type: string | string[], listener: IEventListener, options?:
|
|
445
|
-
off(type?: string | string[], listener?: IEventListener, options?:
|
|
446
|
-
on_(type: string | string[], listener: IEventListener, bind?: IObject, options?:
|
|
451
|
+
on(type: string | string[], listener: IEventListener, options?: IEventOption): void;
|
|
452
|
+
off(type?: string | string[], listener?: IEventListener, options?: IEventOption): void;
|
|
453
|
+
on_(type: string | string[], listener: IEventListener, bind?: IObject, options?: IEventOption): IEventListenerId;
|
|
447
454
|
off_(id: IEventListenerId | IEventListenerId[]): void;
|
|
448
455
|
once(type: string | string[], listener: IEventListener): void;
|
|
449
456
|
emit(type: string, event?: IEvent | IObject, capture?: boolean): void;
|
|
@@ -910,6 +917,7 @@ interface IExportOnCanvasFunction {
|
|
|
910
917
|
|
|
911
918
|
interface ILeaferCanvasConfig extends IAutoBoundsData {
|
|
912
919
|
view?: string | IObject;
|
|
920
|
+
canvas?: string | IObject;
|
|
913
921
|
fill?: string;
|
|
914
922
|
pixelRatio?: number;
|
|
915
923
|
smooth?: boolean;
|
|
@@ -1042,7 +1050,7 @@ interface ILeaferCanvas extends ICanvasAttr, ICanvasMethod, IPathDrawer {
|
|
|
1042
1050
|
isSameSize(options: ILeaferCanvasConfig): boolean;
|
|
1043
1051
|
getSameCanvas(useSameWorldTransform?: boolean, useSameSmooth?: boolean): ILeaferCanvas;
|
|
1044
1052
|
recycle(clearBounds?: IBoundsData): void;
|
|
1045
|
-
updateRender(): void;
|
|
1053
|
+
updateRender(bounds: IBoundsData): void;
|
|
1046
1054
|
unrealCanvas(): void;
|
|
1047
1055
|
destroy(): void;
|
|
1048
1056
|
}
|
|
@@ -1289,6 +1297,7 @@ interface ILeafAttrData {
|
|
|
1289
1297
|
hitSelf?: IBoolean;
|
|
1290
1298
|
hitRadius?: INumber;
|
|
1291
1299
|
cursor?: ICursorType | ICursorType[];
|
|
1300
|
+
event?: IEventMap;
|
|
1292
1301
|
normalStyle?: ILeafInputData;
|
|
1293
1302
|
hoverStyle?: ILeafInputData;
|
|
1294
1303
|
pressStyle?: ILeafInputData;
|
|
@@ -1342,6 +1351,7 @@ interface IImageCursor {
|
|
|
1342
1351
|
rotation?: number;
|
|
1343
1352
|
}
|
|
1344
1353
|
type IDirection = 'top-left' | 'top' | 'top-right' | 'right' | 'bottom-right' | 'bottom' | 'bottom-left' | 'left' | 'center';
|
|
1354
|
+
type IDirection4 = 'top' | 'right' | 'bottom' | 'left';
|
|
1345
1355
|
type IAlign = IDirection;
|
|
1346
1356
|
type IBaseLineAlign = 'baseline-left' | 'baseline-center' | 'baseline-right';
|
|
1347
1357
|
type IFlowAlign = IAlign | IBaseLineAlign;
|
|
@@ -1407,6 +1417,7 @@ interface ILeafInputData {
|
|
|
1407
1417
|
hitSelf?: IBoolean;
|
|
1408
1418
|
hitRadius?: INumber;
|
|
1409
1419
|
cursor?: ICursorType | ICursorType[];
|
|
1420
|
+
event?: IEventMap;
|
|
1410
1421
|
normalStyle?: ILeafInputData;
|
|
1411
1422
|
hoverStyle?: ILeafInputData;
|
|
1412
1423
|
pressStyle?: ILeafInputData;
|
|
@@ -1630,6 +1641,7 @@ interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDa
|
|
|
1630
1641
|
scaleOfWorld(worldOrigin: IPointData, scaleX: number, scaleY?: number, resize?: boolean): void;
|
|
1631
1642
|
rotateOfWorld(worldOrigin: IPointData, rotation: number): void;
|
|
1632
1643
|
skewOfWorld(worldOrigin: IPointData, skewX: number, skewY?: number, resize?: boolean): void;
|
|
1644
|
+
flip(axis: IAxis): void;
|
|
1633
1645
|
scaleResize(scaleX: number, scaleY: number, noResize?: boolean): void;
|
|
1634
1646
|
__scaleResize(scaleX: number, scaleY: number): void;
|
|
1635
1647
|
resizeWidth(width: number): void;
|
|
@@ -1724,6 +1736,7 @@ interface IPointerEvent extends IUIEvent {
|
|
|
1724
1736
|
width?: number;
|
|
1725
1737
|
height?: number;
|
|
1726
1738
|
pointerType?: PointerType;
|
|
1739
|
+
multiTouch?: boolean;
|
|
1727
1740
|
pressure?: number;
|
|
1728
1741
|
tangentialPressure?: number;
|
|
1729
1742
|
tiltX?: number;
|
|
@@ -1756,6 +1769,7 @@ interface IZoomEvent extends IUIEvent {
|
|
|
1756
1769
|
scale: number;
|
|
1757
1770
|
}
|
|
1758
1771
|
interface IMoveEvent extends IDragEvent {
|
|
1772
|
+
moveType?: 'drag' | 'move';
|
|
1759
1773
|
}
|
|
1760
1774
|
interface ISwipeEvent extends IDragEvent {
|
|
1761
1775
|
}
|
|
@@ -1776,9 +1790,14 @@ interface IInteraction extends IControl {
|
|
|
1776
1790
|
selector: ISelector;
|
|
1777
1791
|
running: boolean;
|
|
1778
1792
|
readonly dragging: boolean;
|
|
1793
|
+
readonly transforming: boolean;
|
|
1794
|
+
readonly moveMode: boolean;
|
|
1795
|
+
readonly canHover: boolean;
|
|
1779
1796
|
readonly isDragEmpty: boolean;
|
|
1797
|
+
readonly isMobileDragEmpty: boolean;
|
|
1798
|
+
readonly isHoldMiddleKey: boolean;
|
|
1780
1799
|
readonly isHoldRightKey: boolean;
|
|
1781
|
-
readonly
|
|
1800
|
+
readonly isHoldSpaceKey: boolean;
|
|
1782
1801
|
config: IInteractionConfig;
|
|
1783
1802
|
cursor: ICursorType | ICursorType[];
|
|
1784
1803
|
readonly hitRadius: number;
|
|
@@ -1863,6 +1882,7 @@ interface IPointerConfig {
|
|
|
1863
1882
|
longPressTime?: number;
|
|
1864
1883
|
transformTime?: number;
|
|
1865
1884
|
hover?: boolean;
|
|
1885
|
+
touch?: boolean;
|
|
1866
1886
|
dragHover?: boolean;
|
|
1867
1887
|
dragDistance?: number;
|
|
1868
1888
|
swipeDistance?: number;
|
|
@@ -1884,6 +1904,7 @@ type ILeaferType = 'draw' | 'editor' | 'design' | 'board' | 'document' | 'app' |
|
|
|
1884
1904
|
interface ILeaferConfig extends IRendererConfig, ILeaferCanvasConfig, IInteractionConfig, ILayouterConfig {
|
|
1885
1905
|
start?: boolean;
|
|
1886
1906
|
type?: ILeaferType;
|
|
1907
|
+
mobile?: boolean;
|
|
1887
1908
|
realCanvas?: boolean;
|
|
1888
1909
|
lazySpeard?: IFourNumber;
|
|
1889
1910
|
}
|
|
@@ -2068,7 +2089,7 @@ interface IPlatform {
|
|
|
2068
2089
|
canvasType?: ICanvasType;
|
|
2069
2090
|
isWorker?: boolean;
|
|
2070
2091
|
isMobile?: boolean;
|
|
2071
|
-
devicePixelRatio?: number;
|
|
2092
|
+
readonly devicePixelRatio?: number;
|
|
2072
2093
|
intWheelDeltaY?: boolean;
|
|
2073
2094
|
conicGradientSupport?: boolean;
|
|
2074
2095
|
conicGradientRotate90?: boolean;
|
|
@@ -2135,4 +2156,4 @@ interface ICursorRotateMap {
|
|
|
2135
2156
|
[name: string]: ICursorRotate;
|
|
2136
2157
|
}
|
|
2137
2158
|
|
|
2138
|
-
export type { ACommandData, ArcCommandData, ArcToCommandData, CCommandData, CanvasPathCommand, EllipseCommandData, HCommandData, IAlign, IAnimateEvent, IAnswer, IAppBase, IAround, IAttrDecorator, IAutoBounds, IAutoBoundsData, IAutoBoxData, IAutoSize, IAxis, IAxisAlign, IAxisReverse, IBaseLineAlign, IBlendMode, IBlob, IBlobFunction, IBoolean, IBooleanMap, IBounds, IBoundsData, IBoundsDataFn, IBoundsType, IBranch, IBranchRender, IBranchRenderModule, ICachedLeaf, ICanvasAttr, ICanvasCacheOptions, ICanvasContext2D, ICanvasContext2DSettings, ICanvasManager, ICanvasPattern, ICanvasStrokeOptions, ICanvasType, IChildEvent, IClientPointData, IConstraint, IConstraintType, IControl, ICreator, ICursorRotate, ICursorRotateMap, ICursorType, ICursorTypeMap, IDataProcessor, IDataTypeHandle, IDirection, IDragEvent, IDropEvent, IEditSize, IEraserType, IEvent, IEventListener, IEventListenerId, IEventListenerItem, IEventListenerMap, IEventListenerOptions, IEventTarget, IEventer, IExportFileType, IExportImageType, IExportOnCanvasFunction, IExportOptions, IExportResult, IExportResultFunction, IFindCondition, IFindMethod, IFlowAlign, IFlowAxisAlign, IFlowBoxType, IFlowType, IFlowWrap, IFourNumber, IFromToData, IFunction, IGap, IHitCanvas, IHitCanvasConfig, IHitCanvasManager, IHitType, IImageCursor, IImageEvent, IImageManager, IInteraction, IInteractionCanvas, IInteractionConfig, IJSONOptions, IKeepTouchData, IKeyEvent, ILayoutAttr, ILayoutBlockData, ILayoutBoundsData, ILayoutChangedData, ILayoutData, ILayoutEvent, ILayouter, ILayouterConfig, ILeaf, ILeafArrayMap, ILeafAttrData, ILeafAttrDescriptor, ILeafAttrDescriptorFn, ILeafBounds, ILeafBoundsModule, ILeafComputedData, ILeafData, ILeafDataOptions, ILeafDataProxy, ILeafDataProxyModule, ILeafEventer, ILeafEventerModule, ILeafHit, ILeafHitModule, ILeafInputData, ILeafLayout, ILeafLevelList, ILeafList, ILeafListItemCallback, ILeafMap, ILeafMatrix, ILeafMatrixModule, ILeafRender, ILeafRenderModule, ILeaferAttrData, ILeaferBase, ILeaferCanvas, ILeaferCanvasConfig, ILeaferCanvasView, ILeaferConfig, ILeaferEvent, ILeaferImage, ILeaferImageCacheCanvas, ILeaferImageConfig, ILeaferImageOnError, ILeaferImageOnLoaded, ILeaferImagePatternPaint, ILeaferType, ILeaferTypeCreator, ILeaferTypeFunction, ILeaferTypeList, ILocationType, IMaskType, IMatrix, IMatrixData, IMatrixWithBoundsData, IMatrixWithBoundsScaleData, IMatrixWithLayoutData, IMatrixWithOptionScaleData, IMatrixWithScaleData, IMiniapp, IMiniappSelect, IMiniappSizeView, IMoveEvent, IMultiTouchData, INumber, INumberFunction, INumberMap, IObject, IObjectFunction, IOffsetBoundsData, IPartLayoutConfig, IPath2D, IPathCommandData, IPathCreator, IPathDrawer, IPathString, IPercentData, IPickBottom, IPickOptions, IPickResult, IPlatform, IPlugin, IPoint, IPointData, IPointDataFunction, IPointDataMap, IPointGap, IPointerConfig, IPointerEvent, IPropertyEvent, IRadiusPointData, IRangeSize, IRenderEvent, IRenderOptions, IRenderer, IRendererConfig, IResizeEvent, IResizeEventListener, IRotateEvent, IScaleData, IScaleRotationData, IScreenSizeData, IScrollPointData, ISelector, ISelectorConfig, ISelectorProxy, ISize, ISizeData, ISkewData, ISkiaCanvas, ISkiaCanvasExportConfig, ISkiaNAPICanvas, IStateStyleType, IString, IStringFunction, IStringMap, ISwipeEvent, ITaskItem, ITaskOptions, ITaskProcessor, ITaskProcessorConfig, ITextMetrics, ITimer, ITwoPointBoundsData, IUICreator, IUIEvent, IUnitData, IUnitPointData, IUpdateEvent, IValue, IWatchEvent, IWatchEventData, IWatcher, IWatcherConfig, IWheelConfig, IWindingRule, IZoomEvent, IZoomType, IZoomView, InnerId, LCommandData, MCommandData, PointerType, QCommandData, RectCommandData, RoundRectCommandData, SCommandData, TCommandData, VCommandData, ZCommandData };
|
|
2159
|
+
export type { ACommandData, ArcCommandData, ArcToCommandData, CCommandData, CanvasPathCommand, EllipseCommandData, HCommandData, IAlign, IAnimateEvent, IAnswer, IAppBase, IAround, IAttrDecorator, IAutoBounds, IAutoBoundsData, IAutoBoxData, IAutoSize, IAxis, IAxisAlign, IAxisReverse, IBaseLineAlign, IBlendMode, IBlob, IBlobFunction, IBoolean, IBooleanMap, IBounds, IBoundsData, IBoundsDataFn, IBoundsType, IBranch, IBranchRender, IBranchRenderModule, ICachedLeaf, ICanvasAttr, ICanvasCacheOptions, ICanvasContext2D, ICanvasContext2DSettings, ICanvasManager, ICanvasPattern, ICanvasStrokeOptions, ICanvasType, IChildEvent, IClientPointData, IConstraint, IConstraintType, IControl, ICreator, ICursorRotate, ICursorRotateMap, ICursorType, ICursorTypeMap, IDataProcessor, IDataTypeHandle, IDirection, IDirection4, IDragEvent, IDropEvent, IEditSize, IEraserType, IEvent, IEventListener, IEventListenerId, IEventListenerItem, IEventListenerMap, IEventListenerOptions, IEventMap, IEventOption, IEventTarget, IEventer, IExportFileType, IExportImageType, IExportOnCanvasFunction, IExportOptions, IExportResult, IExportResultFunction, IFindCondition, IFindMethod, IFlowAlign, IFlowAxisAlign, IFlowBoxType, IFlowType, IFlowWrap, IFourNumber, IFromToData, IFunction, IFunctionMap, IGap, IHitCanvas, IHitCanvasConfig, IHitCanvasManager, IHitType, IImageCursor, IImageEvent, IImageManager, IInteraction, IInteractionCanvas, IInteractionConfig, IJSONOptions, IKeepTouchData, IKeyEvent, ILayoutAttr, ILayoutBlockData, ILayoutBoundsData, ILayoutChangedData, ILayoutData, ILayoutEvent, ILayouter, ILayouterConfig, ILeaf, ILeafArrayMap, ILeafAttrData, ILeafAttrDescriptor, ILeafAttrDescriptorFn, ILeafBounds, ILeafBoundsModule, ILeafComputedData, ILeafData, ILeafDataOptions, ILeafDataProxy, ILeafDataProxyModule, ILeafEventer, ILeafEventerModule, ILeafHit, ILeafHitModule, ILeafInputData, ILeafLayout, ILeafLevelList, ILeafList, ILeafListItemCallback, ILeafMap, ILeafMatrix, ILeafMatrixModule, ILeafRender, ILeafRenderModule, ILeaferAttrData, ILeaferBase, ILeaferCanvas, ILeaferCanvasConfig, ILeaferCanvasView, ILeaferConfig, ILeaferEvent, ILeaferImage, ILeaferImageCacheCanvas, ILeaferImageConfig, ILeaferImageOnError, ILeaferImageOnLoaded, ILeaferImagePatternPaint, ILeaferType, ILeaferTypeCreator, ILeaferTypeFunction, ILeaferTypeList, ILocationType, IMaskType, IMatrix, IMatrixData, IMatrixWithBoundsData, IMatrixWithBoundsScaleData, IMatrixWithLayoutData, IMatrixWithOptionScaleData, IMatrixWithScaleData, IMiniapp, IMiniappSelect, IMiniappSizeView, IMoveEvent, IMultiTouchData, INumber, INumberFunction, INumberMap, IObject, IObjectFunction, IOffsetBoundsData, IPartLayoutConfig, IPath2D, IPathCommandData, IPathCreator, IPathDrawer, IPathString, IPercentData, IPickBottom, IPickOptions, IPickResult, IPlatform, IPlugin, IPoint, IPointData, IPointDataFunction, IPointDataMap, IPointGap, IPointerConfig, IPointerEvent, IPropertyEvent, IRadiusPointData, IRangeSize, IRenderEvent, IRenderOptions, IRenderer, IRendererConfig, IResizeEvent, IResizeEventListener, IRotateEvent, IScaleData, IScaleRotationData, IScreenSizeData, IScrollPointData, ISelector, ISelectorConfig, ISelectorProxy, ISize, ISizeData, ISkewData, ISkiaCanvas, ISkiaCanvasExportConfig, ISkiaNAPICanvas, IStateStyleType, IString, IStringFunction, IStringMap, ISwipeEvent, ITaskItem, ITaskOptions, ITaskProcessor, ITaskProcessorConfig, ITextMetrics, ITimer, ITwoPointBoundsData, IUICreator, IUIEvent, IUnitData, IUnitPointData, IUpdateEvent, IValue, IWatchEvent, IWatchEventData, IWatcher, IWatcherConfig, IWheelConfig, IWindingRule, IZoomEvent, IZoomType, IZoomView, InnerId, LCommandData, MCommandData, PointerType, QCommandData, RectCommandData, RoundRectCommandData, SCommandData, TCommandData, VCommandData, ZCommandData };
|