@leafer/interface 1.0.1 → 1.0.3

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer/interface",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "@leafer/interface",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -17,7 +17,7 @@ import { IControl } from '../control/IControl'
17
17
  import { IFunction } from '../function/IFunction'
18
18
 
19
19
 
20
- export type ILeaferType = 'draw' | 'editor' | 'design' | 'board' | 'document' | 'app' | 'website' | 'game' | 'player' | 'chart' | 'custom'
20
+ export type ILeaferType = 'draw' | 'block' | 'editor' | 'design' | 'board' | 'document' | 'app' | 'website' | 'game' | 'player' | 'chart' | 'custom'
21
21
  export interface ILeaferConfig extends IRendererConfig, ILeaferCanvasConfig, IInteractionConfig, ILayouterConfig {
22
22
  start?: boolean
23
23
  type?: ILeaferType
@@ -83,6 +83,10 @@ export interface ILeaferAttrData {
83
83
  getValidScale(changeScale: number): number
84
84
 
85
85
  getWorldPointByClient(clientPoint: IClientPointData, updateClient?: boolean): IPointData
86
+ getPagePointByClient(clientPoint: IClientPointData, updateClient?: boolean): IPointData
87
+ updateClientBounds(): void
88
+
89
+ receiveEvent(event: any): void
86
90
  }
87
91
 
88
92
  export type IZoomType = 'in' | 'out' | 'fit' | 'fit-width' | 'fit-height' | number | ILeaf | ILeaf[] | IBoundsData
@@ -1,6 +1,6 @@
1
1
  import { IExportFileType, IExportImageType } from '../file/IFileType'
2
2
 
3
- export type ICanvasType = 'skia' | 'napi' | 'canvas' | 'wx'
3
+ export type ICanvasType = 'skia' | 'napi' | 'canvas' | 'miniapp'
4
4
 
5
5
  // skia
6
6
  export interface ISkiaCanvas {
@@ -5,7 +5,7 @@ import { ILeaferCanvas, IHitCanvas } from '../canvas/ILeaferCanvas'
5
5
  import { IRenderOptions } from '../renderer/IRenderer'
6
6
 
7
7
  import { IObject, INumber, IBoolean, IValue, IString, IPathString, IFourNumber } from '../data/IData'
8
- import { IMatrixWithBoundsData, IMatrix, IPointData, IBoundsData, IRadiusPointData, ILayoutBoundsData, IMatrixData, IMatrixWithBoundsScaleData, IMatrixWithScaleData, IAutoBoxData, IUnitPointData } from '../math/IMath'
8
+ import { IMatrixWithBoundsData, IMatrix, IPointData, IBoundsData, IRadiusPointData, ILayoutBoundsData, IMatrixData, IMatrixWithBoundsScaleData, IMatrixWithScaleData, IAutoBoxData, IUnitPointData, IRotationPointData } from '../math/IMath'
9
9
  import { IFunction } from '../function/IFunction'
10
10
 
11
11
  import { ILeafDataProxy } from './module/ILeafDataProxy'
@@ -19,6 +19,7 @@ import { IFindMethod } from '../selector/ISelector'
19
19
  import { IPathCommandData } from '../path/IPathCommand'
20
20
  import { IWindingRule, IPath2D } from '../canvas/ICanvas'
21
21
  import { IJSONOptions } from '../file/IExport'
22
+ import { IMotionPathData } from '../path/IPathData'
22
23
 
23
24
 
24
25
  export interface ICachedLeaf {
@@ -28,97 +29,7 @@ export interface ICachedLeaf {
28
29
  }
29
30
 
30
31
 
31
- export interface ILeafAttrData {
32
- // layer data
33
- id?: IString
34
- name?: IString
35
- className?: IString
36
-
37
- blendMode?: IBlendMode
38
- opacity?: INumber
39
- visible?: IBoolean | 0 // 0 = display: none
40
- selected?: IBoolean
41
- disabled?: IBoolean
42
- locked?: IBoolean
43
- zIndex?: INumber
44
-
45
- mask?: IBoolean | IMaskType
46
- eraser?: IBoolean | IEraserType
47
-
48
- // layout data
49
- x?: INumber
50
- y?: INumber
51
- width?: INumber
52
- height?: INumber
53
- scaleX?: INumber
54
- scaleY?: INumber
55
- rotation?: INumber
56
- skewX?: INumber
57
- skewY?: INumber
58
-
59
- scale?: INumber | IPointData // helper
60
-
61
- offsetX?: INumber
62
- offsetY?: INumber
63
- scrollX?: INumber
64
- scrollY?: INumber
65
-
66
- origin?: IAlign | IUnitPointData
67
- around?: IAlign | IUnitPointData
68
-
69
- lazy?: IBoolean
70
- pixelRatio?: INumber
71
-
72
- path?: IPathCommandData | IPathString
73
- windingRule?: IWindingRule
74
- closed?: IBoolean
75
-
76
- // auto layout
77
- flow?: IFlowType
78
- padding?: IFourNumber
79
- gap?: IGap | IPointGap
80
- flowAlign?: IFlowAlign | IFlowAxisAlign
81
- flowWrap?: IFlowWrap
82
- itemBox?: IFlowBoxType
83
-
84
- inFlow?: IBoolean
85
- autoWidth?: IAutoSize
86
- autoHeight?: IAutoSize
87
- lockRatio?: IBoolean
88
- autoBox?: IAutoBoxData | IConstraint
89
-
90
- widthRange?: IRangeSize
91
- heightRange?: IRangeSize
92
-
93
- // interactive
94
- draggable?: IBoolean | IAxis
95
- dragBounds?: IBoundsData | 'parent'
96
-
97
- editable?: IBoolean
98
-
99
- hittable?: IBoolean
100
- hitFill?: IHitType
101
- hitStroke?: IHitType
102
- hitBox?: IBoolean
103
- hitChildren?: IBoolean
104
- hitSelf?: IBoolean
105
- hitRadius?: INumber
106
-
107
- cursor?: ICursorType | ICursorType[]
108
-
109
- event?: IEventMap
110
-
111
- normalStyle?: ILeafInputData // restore hover / press / focus / selected / disabled style
112
- hoverStyle?: ILeafInputData
113
- pressStyle?: ILeafInputData
114
- focusStyle?: ILeafInputData
115
- selectedStyle?: ILeafInputData
116
- disabledStyle?: ILeafInputData
117
-
118
- // 预留给用户使用的数据对象
119
- data: IObject
120
- }
121
-
32
+ export type ISide = 'width' | 'height'
122
33
 
123
34
  export type IAxis = 'x' | 'y'
124
35
 
@@ -292,9 +203,9 @@ export type IStateStyleType =
292
203
  | 'selectedStyle'
293
204
  | 'disabledStyle'
294
205
 
295
- export interface ILeafInputData {
296
- tag?: string
297
206
 
207
+
208
+ export interface ILeafAttrData {
298
209
  // layer data
299
210
  id?: IString
300
211
  name?: IString
@@ -302,7 +213,7 @@ export interface ILeafInputData {
302
213
 
303
214
  blendMode?: IBlendMode
304
215
  opacity?: INumber
305
- visible?: IBoolean | 0
216
+ visible?: IBoolean | 0 // 0 = display: none
306
217
  selected?: IBoolean
307
218
  disabled?: IBoolean
308
219
  locked?: IBoolean
@@ -370,25 +281,30 @@ export interface ILeafInputData {
370
281
  hitSelf?: IBoolean
371
282
  hitRadius?: INumber
372
283
 
284
+ button?: IBoolean
373
285
  cursor?: ICursorType | ICursorType[]
374
286
 
375
- event?: IEventMap
287
+ motionPath?: IBoolean
288
+ motion?: INumber | IUnitData
289
+ motionRotation?: INumber | IBoolean
290
+
291
+ normalStyle?: IObject
376
292
 
377
- normalStyle?: ILeafInputData
378
- hoverStyle?: ILeafInputData
379
- pressStyle?: ILeafInputData
380
- focusStyle?: ILeafInputData
381
- selectedStyle?: ILeafInputData
382
- disabledStyle?: ILeafInputData
293
+ event?: IEventMap
383
294
 
384
295
  // 预留给用户使用的数据对象
385
296
  data?: IObject
297
+ }
298
+
299
+ export interface ILeafInputData extends ILeafAttrData {
300
+ tag?: string
386
301
 
387
302
  children?: ILeafInputData[]
388
303
 
389
304
  // other
390
305
  noBounds?: boolean
391
306
  }
307
+
392
308
  export interface ILeafComputedData {
393
309
  // layer data
394
310
  id?: string
@@ -463,15 +379,14 @@ export interface ILeafComputedData {
463
379
  hitSelf?: boolean
464
380
  hitRadius?: number
465
381
 
382
+ button?: boolean
466
383
  cursor?: ICursorType | ICursorType[]
467
384
 
468
- normalStyle?: ILeafInputData
469
- hoverStyle?: ILeafInputData
470
- pressStyle?: ILeafInputData
471
- focusStyle?: ILeafInputData
472
- selectedStyle?: ILeafInputData
473
- disabledStyle?: ILeafInputData
385
+ motionPath?: boolean
386
+ motion?: number | IUnitData
387
+ motionRotation?: number | boolean
474
388
 
389
+ normalStyle?: IObject
475
390
 
476
391
  // 预留给用户使用的数据对象
477
392
  data?: IObject
@@ -485,8 +400,8 @@ export interface ILeafComputedData {
485
400
 
486
401
  readonly __autoWidth?: boolean
487
402
  readonly __autoHeight?: boolean
488
- readonly __autoSide?: boolean
489
- readonly __autoSize?: boolean
403
+ readonly __autoSide?: boolean // 自动宽或自动高
404
+ readonly __autoSize?: boolean // 自动宽高
490
405
 
491
406
  readonly __useNaturalRatio: boolean // 宽高存在一个值时,另一个自动值是否采用natural尺寸比例
492
407
  readonly __isLinePath: boolean
@@ -498,6 +413,7 @@ export interface ILeafComputedData {
498
413
  __pathInputed?: number // 是否为输入path, 0:否,1:是,2:永远是(不自动检测)
499
414
  __pathForRender?: IPathCommandData
500
415
  __path2DForRender?: IPath2D
416
+ __pathForMotion?: IMotionPathData
501
417
  }
502
418
 
503
419
  export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDataProxy, ILeafInputData, IEventer {
@@ -525,6 +441,7 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
525
441
  __proxyData?: ILeafInputData
526
442
 
527
443
  syncEventer?: ILeaf // 同步触发一样事件的元素
444
+ lockNormalStyle?: boolean
528
445
 
529
446
  __layout: ILeafLayout
530
447
 
@@ -555,7 +472,12 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
555
472
 
556
473
  readonly __worldFlipped: boolean
557
474
 
475
+ animation?: IObject
476
+ animationOut?: IObject
477
+
558
478
  __hasAutoLayout?: boolean
479
+ __hasMotionPath?: boolean
480
+
559
481
  __hasMask?: boolean
560
482
  __hasEraser?: boolean
561
483
  __hitCanvas?: IHitCanvas
@@ -571,9 +493,6 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
571
493
 
572
494
  readonly pathInputed: boolean
573
495
 
574
- __parentWait?: IFunction[]
575
- __leaferWait?: IFunction[]
576
-
577
496
  destroyed: boolean
578
497
 
579
498
  reset(data?: ILeafInputData): void
@@ -586,7 +505,7 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
586
505
 
587
506
  __bindLeafer(leafer: ILeaferBase | null): void
588
507
 
589
- set(data: IObject): void
508
+ set(data: IObject, isTemp?: boolean): void
590
509
  get(name?: string | string[] | IObject): ILeafInputData | IValue
591
510
  setAttr(name: string, value: any): void
592
511
  getAttr(name: string): any
@@ -612,6 +531,7 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
612
531
 
613
532
  focus(value?: boolean): void
614
533
 
534
+ updateState(): void
615
535
  updateLayout(): void
616
536
  forceUpdate(attrName?: string): void
617
537
  forceRender(_bounds?: IBoundsData): void
@@ -629,7 +549,7 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
629
549
  __updateLocalRenderBounds(): void
630
550
 
631
551
  __updateContentBounds(): void
632
- __updateBoxBounds(): void
552
+ __updateBoxBounds(secondLayout?: boolean): void
633
553
  __updateStrokeBounds(): void
634
554
  __updateRenderBounds(): void
635
555
 
@@ -664,21 +584,25 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
664
584
  worldToInner(world: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void
665
585
  innerToWorld(inner: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void
666
586
 
587
+ getBoxPoint(world: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData
588
+ getBoxPointByInner(inner: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData
667
589
  getInnerPoint(world: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData
590
+ getInnerPointByBox(box: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData
668
591
  getInnerPointByLocal(local: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData
669
592
  getLocalPoint(world: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData
670
593
  getLocalPointByInner(inner: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData
594
+ getPagePoint(world: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData
671
595
  getWorldPoint(inner: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData
596
+ getWorldPointByBox(box: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData
672
597
  getWorldPointByLocal(local: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData
673
- getPagePoint(world: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData
674
598
  getWorldPointByPage(page: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData
675
599
 
676
-
677
600
  // transform
678
601
  setTransform(transform?: IMatrixData, resize?: boolean): void
679
602
  transform(transform?: IMatrixData, resize?: boolean): void
680
-
681
603
  move(x: number | IPointData, y?: number): void
604
+
605
+ moveInner(x: number | IPointData, y?: number): void
682
606
  scaleOf(origin: IPointData | IAlign, scaleX: number, scaleY?: number, resize?: boolean): void
683
607
  rotateOf(origin: IPointData | IAlign, rotation: number): void
684
608
  skewOf(origin: IPointData | IAlign, skewX: number, skewY?: number, resize?: boolean): void
@@ -723,7 +647,16 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
723
647
  __updatePath(): void
724
648
  __updateRenderPath(): void
725
649
 
726
- //
650
+ // motion path
651
+ getMotionPathData(): IMotionPathData
652
+ getMotionPoint(motionDistance: number | IUnitData): IRotationPointData
653
+ getMotionTotal(): number
654
+
655
+ __updateMotionPath(): void
656
+
657
+ __runAnimation(type: 'in' | 'out', complete?: IFunction): void
658
+
659
+ __emitLifeEvent(type: string): void
727
660
 
728
661
  // branch
729
662
  children?: ILeaf[]
@@ -10,7 +10,7 @@ export interface ILeafBounds {
10
10
  __updateLocalStrokeBounds?(): void
11
11
  __updateLocalRenderBounds?(): void
12
12
 
13
- __updateBoxBounds?(): void
13
+ __updateBoxBounds?(secondLayout?: boolean): void
14
14
  __updateStrokeBounds?(): void
15
15
  __updateRenderBounds?(): void
16
16
 
@@ -6,6 +6,7 @@ export type ILeafDataProxyModule = ILeafDataProxy & ThisType<ILeaf>
6
6
  export interface ILeafDataProxy {
7
7
  __setAttr?(name: string, newValue: IValue): boolean
8
8
  __getAttr?(name: string): IValue
9
+ __realSetAttr?(name: string, newValue: IValue): void
9
10
  setProxyAttr?(name: string, newValue: IValue): void
10
11
  getProxyAttr?(name: string): IValue
11
12
  }
@@ -1,5 +1,5 @@
1
1
  import { ILeaf } from '../ILeaf'
2
- import { IEventListener, IEventListenerId, IEventListenerOptions } from '../../event/IEventer'
2
+ import { IEventListener, IEventListenerId, IEventListenerOptions, IEventMap } from '../../event/IEventer'
3
3
  import { } from '@leafer/interface'
4
4
  import { IEvent } from '../../event/IEvent'
5
5
  import { IObject } from '../../data/IData'
@@ -7,7 +7,7 @@ import { IObject } from '../../data/IData'
7
7
  export type ILeafEventerModule = ILeafEventer & ThisType<ILeaf>
8
8
 
9
9
  export interface ILeafEventer {
10
- on?(type: string | string[], listener: IEventListener, options?: IEventListenerOptions | boolean): void
10
+ on?(type: string | string[] | IEventMap, listener?: IEventListener, options?: IEventListenerOptions | boolean): void
11
11
  off?(type?: string | string[], listener?: IEventListener, options?: IEventListenerOptions | boolean): void
12
12
  on_?(type: string | string[], listener: IEventListener, bind?: IObject, options?: IEventListenerOptions | boolean): IEventListenerId
13
13
  off_?(id: IEventListenerId | IEventListenerId[]): void
@@ -15,4 +15,5 @@ export interface ILeafEventer {
15
15
  emit?(type: string, event?: IEvent | IObject, capture?: boolean): void
16
16
  emitEvent?(event?: IEvent, capture?: boolean): void
17
17
  hasEvent?(type: string, capture?: boolean): boolean
18
+ destroyEventer?(): void
18
19
  }
@@ -36,12 +36,13 @@ export interface IEventListenerId {
36
36
  export type InnerId = number
37
37
 
38
38
  export interface IEventer extends ILeafEventer {
39
-
40
39
  readonly innerId: InnerId
41
40
  __captureMap?: IEventListenerMap
42
41
  __bubbleMap?: IEventListenerMap
42
+ syncEventer?: IEventer
43
+ event?: IEventMap
43
44
 
44
- on(type: string | string[], listener: IEventListener, options?: IEventOption): void
45
+ on(type: string | string[] | IEventMap, listener?: IEventListener, options?: IEventOption): void
45
46
  off(type?: string | string[], listener?: IEventListener, options?: IEventOption): void
46
47
  on_(type: string | string[], listener: IEventListener, bind?: IObject, options?: IEventOption): IEventListenerId
47
48
  off_(id: IEventListenerId | IEventListenerId[]): void
@@ -23,9 +23,15 @@ export interface IUIEvent extends IEvent {
23
23
  path?: ILeafList
24
24
  throughPath?: ILeafList // 穿透path,不受层级影响,从上到下只要碰撞到区域就算,一般点击的时候
25
25
 
26
- getPage?(): IPointData
26
+ getBoxPoint?(relative?: ILeaf): IPointData
27
+ getInnerPoint?(relative?: ILeaf): IPointData
28
+ getLocalPoint?(relative?: ILeaf): IPointData
29
+ getPagePoint?(): IPointData
30
+
31
+ // 兼容代码,未来可移除
27
32
  getInner?(relative?: ILeaf): IPointData
28
33
  getLocal?(relative?: ILeaf): IPointData
34
+ getPage?(): IPointData
29
35
  }
30
36
 
31
37
 
@@ -2,12 +2,13 @@ import { IBlob, ILeaferCanvas } from '../canvas/ILeaferCanvas'
2
2
  import { ICanvasContext2DSettings } from '../canvas/ICanvas'
3
3
  import { ILeaf } from '../display/ILeaf'
4
4
  import { ILocationType } from '../layout/ILeafLayout'
5
- import { IBoundsData } from '../math/IMath'
5
+ import { IBoundsData, IPointData, ISizeData } from '../math/IMath'
6
6
 
7
7
  export interface IExportOptions {
8
8
  quality?: number
9
9
  blob?: boolean
10
- scale?: number
10
+ scale?: number | IPointData
11
+ size?: number | ISizeData
11
12
  smooth?: boolean
12
13
  pixelRatio?: number
13
14
  slice?: boolean
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, IDirection4, IAround, ILeafAttrDescriptor, ILeafAttrDescriptorFn } from './display/ILeaf'
3
+ export { ILeaf, ILeafAttrData, ILeafComputedData, ILeafInputData, ICachedLeaf, IFlowType, IFlowBoxType, IAlign, IAxisAlign, IFlowAlign, IFlowAxisAlign, ISide, 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
 
@@ -36,6 +36,7 @@ export { IPlugin } from './plugin/IPlugin'
36
36
  export { ILeaferCanvas, ILeaferCanvasView, IHitCanvas, ICanvasAttr, ICanvasStrokeOptions, ICanvasCacheOptions, ILeaferCanvasConfig, IHitCanvasConfig, IBlobFunction, IBlob } from './canvas/ILeaferCanvas'
37
37
  export { ISkiaCanvas, ISkiaCanvasExportConfig, ICanvasType, ISkiaNAPICanvas } from './canvas/ISkiaCanvas'
38
38
  export { IPathDrawer, IPathCreator } from './path/IPathDrawer'
39
+ export { IMotionPathData } from './path/IPathData'
39
40
  export { IWindingRule, ICanvasContext2D, ICanvasContext2DSettings, ITextMetrics, IPath2D, ICanvasPattern } from './canvas/ICanvas'
40
41
  export { CanvasPathCommand, IPathCommandData, MCommandData, HCommandData, VCommandData, LCommandData, CCommandData, SCommandData, QCommandData, TCommandData, ZCommandData, ACommandData, RectCommandData, RoundRectCommandData, EllipseCommandData, ArcCommandData, ArcToCommandData } from './path/IPathCommand'
41
42
 
@@ -47,10 +48,10 @@ export { InnerId, IEventer, IEventMap, IEventListener, IEventOption, IEventListe
47
48
  export { IEventTarget, IEvent, ILeaferEvent, IPropertyEvent, ILayoutEvent, IRenderEvent, IAnimateEvent, IChildEvent, IResizeEvent, IResizeEventListener, IUpdateEvent, IWatchEvent, IMultiTouchData, IKeepTouchData } from './event/IEvent'
48
49
  export { IUIEvent, IPointerEvent, PointerType, IDragEvent, IDropEvent, ISwipeEvent, IMoveEvent, IZoomEvent, IRotateEvent, IKeyEvent, IImageEvent } from './event/IUIEvent'
49
50
  export { ICursorTypeMap, ICursorRotate, ICursorRotateMap } from './interaction/ICursor'
50
- export { IInteraction, IInteractionCanvas, IInteractionConfig, IWheelConfig, IPointerConfig } from './interaction/IInteraction'
51
+ export { IInteraction, IInteractionCanvas, IInteractionConfig, IWheelConfig, ITouchConfig, IPointerConfig } from './interaction/IInteraction'
51
52
 
52
53
 
53
54
  export { INumber, IBoolean, IString, IValue, IFourNumber, IPathString, ITimer, IObject, INumberMap, IStringMap, IBooleanMap, IFunctionMap, IPointDataMap, IDataTypeHandle } from './data/IData'
54
55
  export { ILeafList, ILeafArrayMap, ILeafMap, ILeafLevelList, ILeafListItemCallback } from './data/IList'
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
+ export { IPoint, IPointData, IFromToData, IUnitPointData, IRotationPointData, 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
57
  export { IFunction, IStringFunction, INumberFunction, IObjectFunction, IPointDataFunction, IAttrDecorator } from './function/IFunction'
@@ -53,6 +53,9 @@ export interface IInteraction extends IControl {
53
53
 
54
54
  multiTouch(data: IUIEvent, list: IKeepTouchData[]): void
55
55
 
56
+ menu(data: IPointerEvent): void
57
+ menuTap(data: IPointerEvent): void
58
+
56
59
  move(data: IMoveEvent): void
57
60
  zoom(data: IZoomEvent): void
58
61
  rotate(data: IRotateEvent): void
@@ -90,6 +93,7 @@ export interface IInteractionCanvas extends ILeaferCanvas {
90
93
  export interface IInteractionConfig {
91
94
  wheel?: IWheelConfig
92
95
  pointer?: IPointerConfig
96
+ touch?: ITouchConfig
93
97
  zoom?: IZoomConfig
94
98
  move?: IMoveConfig
95
99
  eventer?: IObject
@@ -109,7 +113,7 @@ export interface IMoveConfig {
109
113
  holdMiddleKey?: boolean
110
114
  holdRightKey?: boolean
111
115
  scroll?: boolean | 'limit'
112
- drag?: boolean
116
+ drag?: boolean | 'auto'
113
117
  dragAnimate?: boolean
114
118
  dragEmpty?: boolean
115
119
  dragOut?: boolean
@@ -148,6 +152,11 @@ export interface IPointerConfig {
148
152
  preventDefaultMenu?: boolean
149
153
  }
150
154
 
155
+ export interface ITouchConfig {
156
+ preventDefault?: boolean | 'auto'
157
+ }
158
+
159
+
151
160
  export interface ICursorConfig {
152
161
  stop?: boolean
153
162
  }
@@ -56,6 +56,7 @@ export interface ILeafLayout {
56
56
  hitCanvasChanged: boolean
57
57
 
58
58
  childrenSortChanged?: boolean
59
+ stateStyleChanged?: boolean // hoverStyle ...
59
60
 
60
61
  // keep state
61
62
  affectScaleOrRotation: boolean
package/src/math/IMath.ts CHANGED
@@ -1,14 +1,13 @@
1
1
  import { IFourNumber, IObject } from '../data/IData'
2
+ import { ISide } from '../display/ILeaf'
2
3
 
3
4
  export interface IPointData {
4
5
  x: number
5
6
  y: number
6
7
  }
7
8
 
8
- export interface IUnitPointData {
9
+ export interface IUnitPointData extends IPointData {
9
10
  type?: 'percent' | 'px'
10
- x: number
11
- y: number
12
11
  }
13
12
 
14
13
  export interface IFromToData {
@@ -16,6 +15,10 @@ export interface IFromToData {
16
15
  to: IPointData
17
16
  }
18
17
 
18
+ export interface IRotationPointData extends IPointData {
19
+ rotation: number
20
+ }
21
+
19
22
  export interface IScrollPointData {
20
23
  scrollX: number
21
24
  scrollY: number
@@ -91,8 +94,8 @@ export interface IBounds extends IBoundsData, ITwoPointBoundsData {
91
94
  toInnerOf(matrix: IMatrixData, to?: IBoundsData): IBounds
92
95
  getFitMatrix(put: IBoundsData, baseScale?: number): IMatrix
93
96
 
94
- spread(fourNumber: IFourNumber): IBounds
95
- shrink(fourNumber: IFourNumber): IBounds
97
+ spread(fourNumber: IFourNumber, side?: ISide): IBounds
98
+ shrink(fourNumber: IFourNumber, side?: ISide): IBounds
96
99
  ceil(): IBounds
97
100
  unsign(): IBounds
98
101
  float(maxLength?: number): IBounds
@@ -0,0 +1,6 @@
1
+ import { IPathCommandData } from './IPathCommand'
2
+ export interface IMotionPathData {
3
+ total: number
4
+ segments: number[] // 每个命令对应一个片段距离
5
+ data: IPathCommandData // M L C Z 命令的路径数据
6
+ }
@@ -12,6 +12,7 @@ export interface IPlatform {
12
12
  toURL(text: string, fileType?: 'text' | 'svg'): string
13
13
  requestRender?(render: IFunction): void
14
14
  canvas?: ILeaferCanvas
15
+ renderCanvas?: ILeaferCanvas
15
16
  canvasType?: ICanvasType
16
17
  isWorker?: boolean
17
18
  isMobile?: boolean
package/types/index.d.ts CHANGED
@@ -4,15 +4,16 @@ interface IPointData {
4
4
  x: number;
5
5
  y: number;
6
6
  }
7
- interface IUnitPointData {
7
+ interface IUnitPointData extends IPointData {
8
8
  type?: 'percent' | 'px';
9
- x: number;
10
- y: number;
11
9
  }
12
10
  interface IFromToData {
13
11
  from: IPointData;
14
12
  to: IPointData;
15
13
  }
14
+ interface IRotationPointData extends IPointData {
15
+ rotation: number;
16
+ }
16
17
  interface IScrollPointData {
17
18
  scrollX: number;
18
19
  scrollY: number;
@@ -72,8 +73,8 @@ interface IBounds extends IBoundsData, ITwoPointBoundsData {
72
73
  toOuterOf(matrix: IMatrixData, to?: IBoundsData): IBounds;
73
74
  toInnerOf(matrix: IMatrixData, to?: IBoundsData): IBounds;
74
75
  getFitMatrix(put: IBoundsData, baseScale?: number): IMatrix;
75
- spread(fourNumber: IFourNumber): IBounds;
76
- shrink(fourNumber: IFourNumber): IBounds;
76
+ spread(fourNumber: IFourNumber, side?: ISide): IBounds;
77
+ shrink(fourNumber: IFourNumber, side?: ISide): IBounds;
77
78
  ceil(): IBounds;
78
79
  unsign(): IBounds;
79
80
  float(maxLength?: number): IBounds;
@@ -412,7 +413,7 @@ interface IKeepTouchData {
412
413
 
413
414
  type ILeafEventerModule = ILeafEventer & ThisType<ILeaf>;
414
415
  interface ILeafEventer {
415
- on?(type: string | string[], listener: IEventListener, options?: IEventListenerOptions | boolean): void;
416
+ on?(type: string | string[] | IEventMap, listener?: IEventListener, options?: IEventListenerOptions | boolean): void;
416
417
  off?(type?: string | string[], listener?: IEventListener, options?: IEventListenerOptions | boolean): void;
417
418
  on_?(type: string | string[], listener: IEventListener, bind?: IObject, options?: IEventListenerOptions | boolean): IEventListenerId;
418
419
  off_?(id: IEventListenerId | IEventListenerId[]): void;
@@ -420,6 +421,7 @@ interface ILeafEventer {
420
421
  emit?(type: string, event?: IEvent | IObject, capture?: boolean): void;
421
422
  emitEvent?(event?: IEvent, capture?: boolean): void;
422
423
  hasEvent?(type: string, capture?: boolean): boolean;
424
+ destroyEventer?(): void;
423
425
  }
424
426
 
425
427
  type IEventListener = IFunction;
@@ -448,7 +450,9 @@ interface IEventer extends ILeafEventer {
448
450
  readonly innerId: InnerId;
449
451
  __captureMap?: IEventListenerMap;
450
452
  __bubbleMap?: IEventListenerMap;
451
- on(type: string | string[], listener: IEventListener, options?: IEventOption): void;
453
+ syncEventer?: IEventer;
454
+ event?: IEventMap;
455
+ on(type: string | string[] | IEventMap, listener?: IEventListener, options?: IEventOption): void;
452
456
  off(type?: string | string[], listener?: IEventListener, options?: IEventOption): void;
453
457
  on_(type: string | string[], listener: IEventListener, bind?: IObject, options?: IEventOption): IEventListenerId;
454
458
  off_(id: IEventListenerId | IEventListenerId[]): void;
@@ -841,6 +845,7 @@ interface ILeafLayout {
841
845
  opacityChanged: boolean;
842
846
  hitCanvasChanged: boolean;
843
847
  childrenSortChanged?: boolean;
848
+ stateStyleChanged?: boolean;
844
849
  affectScaleOrRotation: boolean;
845
850
  affectRotation: boolean;
846
851
  affectChildrenSort?: boolean;
@@ -886,7 +891,8 @@ interface ILeafLayout {
886
891
  interface IExportOptions {
887
892
  quality?: number;
888
893
  blob?: boolean;
889
- scale?: number;
894
+ scale?: number | IPointData;
895
+ size?: number | ISizeData;
890
896
  smooth?: boolean;
891
897
  pixelRatio?: number;
892
898
  slice?: boolean;
@@ -1105,6 +1111,7 @@ type ILeafDataProxyModule = ILeafDataProxy & ThisType<ILeaf>;
1105
1111
  interface ILeafDataProxy {
1106
1112
  __setAttr?(name: string, newValue: IValue): boolean;
1107
1113
  __getAttr?(name: string): IValue;
1114
+ __realSetAttr?(name: string, newValue: IValue): void;
1108
1115
  setProxyAttr?(name: string, newValue: IValue): void;
1109
1116
  getProxyAttr?(name: string): IValue;
1110
1117
  }
@@ -1122,7 +1129,7 @@ interface ILeafBounds {
1122
1129
  __updateLocalBoxBounds?(): void;
1123
1130
  __updateLocalStrokeBounds?(): void;
1124
1131
  __updateLocalRenderBounds?(): void;
1125
- __updateBoxBounds?(): void;
1132
+ __updateBoxBounds?(secondLayout?: boolean): void;
1126
1133
  __updateStrokeBounds?(): void;
1127
1134
  __updateRenderBounds?(): void;
1128
1135
  __updateAutoLayout?(): void;
@@ -1234,78 +1241,18 @@ interface ISelector {
1234
1241
  destroy(): void;
1235
1242
  }
1236
1243
 
1244
+ interface IMotionPathData {
1245
+ total: number;
1246
+ segments: number[];
1247
+ data: IPathCommandData;
1248
+ }
1249
+
1237
1250
  interface ICachedLeaf {
1238
1251
  canvas: ILeaferCanvas;
1239
1252
  matrix?: IMatrix;
1240
1253
  bounds: IBoundsData;
1241
1254
  }
1242
- interface ILeafAttrData {
1243
- id?: IString;
1244
- name?: IString;
1245
- className?: IString;
1246
- blendMode?: IBlendMode;
1247
- opacity?: INumber;
1248
- visible?: IBoolean | 0;
1249
- selected?: IBoolean;
1250
- disabled?: IBoolean;
1251
- locked?: IBoolean;
1252
- zIndex?: INumber;
1253
- mask?: IBoolean | IMaskType;
1254
- eraser?: IBoolean | IEraserType;
1255
- x?: INumber;
1256
- y?: INumber;
1257
- width?: INumber;
1258
- height?: INumber;
1259
- scaleX?: INumber;
1260
- scaleY?: INumber;
1261
- rotation?: INumber;
1262
- skewX?: INumber;
1263
- skewY?: INumber;
1264
- scale?: INumber | IPointData;
1265
- offsetX?: INumber;
1266
- offsetY?: INumber;
1267
- scrollX?: INumber;
1268
- scrollY?: INumber;
1269
- origin?: IAlign | IUnitPointData;
1270
- around?: IAlign | IUnitPointData;
1271
- lazy?: IBoolean;
1272
- pixelRatio?: INumber;
1273
- path?: IPathCommandData | IPathString;
1274
- windingRule?: IWindingRule;
1275
- closed?: IBoolean;
1276
- flow?: IFlowType;
1277
- padding?: IFourNumber;
1278
- gap?: IGap | IPointGap;
1279
- flowAlign?: IFlowAlign | IFlowAxisAlign;
1280
- flowWrap?: IFlowWrap;
1281
- itemBox?: IFlowBoxType;
1282
- inFlow?: IBoolean;
1283
- autoWidth?: IAutoSize;
1284
- autoHeight?: IAutoSize;
1285
- lockRatio?: IBoolean;
1286
- autoBox?: IAutoBoxData | IConstraint;
1287
- widthRange?: IRangeSize;
1288
- heightRange?: IRangeSize;
1289
- draggable?: IBoolean | IAxis;
1290
- dragBounds?: IBoundsData | 'parent';
1291
- editable?: IBoolean;
1292
- hittable?: IBoolean;
1293
- hitFill?: IHitType;
1294
- hitStroke?: IHitType;
1295
- hitBox?: IBoolean;
1296
- hitChildren?: IBoolean;
1297
- hitSelf?: IBoolean;
1298
- hitRadius?: INumber;
1299
- cursor?: ICursorType | ICursorType[];
1300
- event?: IEventMap;
1301
- normalStyle?: ILeafInputData;
1302
- hoverStyle?: ILeafInputData;
1303
- pressStyle?: ILeafInputData;
1304
- focusStyle?: ILeafInputData;
1305
- selectedStyle?: ILeafInputData;
1306
- disabledStyle?: ILeafInputData;
1307
- data: IObject;
1308
- }
1255
+ type ISide = 'width' | 'height';
1309
1256
  type IAxis = 'x' | 'y';
1310
1257
  type IAxisReverse = 'x-reverse' | 'y-reverse';
1311
1258
  type IFlowType = boolean | IAxis | IAxisReverse;
@@ -1358,8 +1305,7 @@ type IFlowAlign = IAlign | IBaseLineAlign;
1358
1305
  type IAround = IAlign | IUnitPointData;
1359
1306
  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';
1360
1307
  type IStateStyleType = 'hoverStyle' | 'pressStyle' | 'focusStyle' | 'selectedStyle' | 'disabledStyle';
1361
- interface ILeafInputData {
1362
- tag?: string;
1308
+ interface ILeafAttrData {
1363
1309
  id?: IString;
1364
1310
  name?: IString;
1365
1311
  className?: IString;
@@ -1416,15 +1362,17 @@ interface ILeafInputData {
1416
1362
  hitChildren?: IBoolean;
1417
1363
  hitSelf?: IBoolean;
1418
1364
  hitRadius?: INumber;
1365
+ button?: IBoolean;
1419
1366
  cursor?: ICursorType | ICursorType[];
1367
+ motionPath?: IBoolean;
1368
+ motion?: INumber | IUnitData;
1369
+ motionRotation?: INumber | IBoolean;
1370
+ normalStyle?: IObject;
1420
1371
  event?: IEventMap;
1421
- normalStyle?: ILeafInputData;
1422
- hoverStyle?: ILeafInputData;
1423
- pressStyle?: ILeafInputData;
1424
- focusStyle?: ILeafInputData;
1425
- selectedStyle?: ILeafInputData;
1426
- disabledStyle?: ILeafInputData;
1427
1372
  data?: IObject;
1373
+ }
1374
+ interface ILeafInputData extends ILeafAttrData {
1375
+ tag?: string;
1428
1376
  children?: ILeafInputData[];
1429
1377
  noBounds?: boolean;
1430
1378
  }
@@ -1484,13 +1432,12 @@ interface ILeafComputedData {
1484
1432
  hitChildren?: boolean;
1485
1433
  hitSelf?: boolean;
1486
1434
  hitRadius?: number;
1435
+ button?: boolean;
1487
1436
  cursor?: ICursorType | ICursorType[];
1488
- normalStyle?: ILeafInputData;
1489
- hoverStyle?: ILeafInputData;
1490
- pressStyle?: ILeafInputData;
1491
- focusStyle?: ILeafInputData;
1492
- selectedStyle?: ILeafInputData;
1493
- disabledStyle?: ILeafInputData;
1437
+ motionPath?: boolean;
1438
+ motion?: number | IUnitData;
1439
+ motionRotation?: number | boolean;
1440
+ normalStyle?: IObject;
1494
1441
  data?: IObject;
1495
1442
  __childBranchNumber?: number;
1496
1443
  __complex?: boolean;
@@ -1508,6 +1455,7 @@ interface ILeafComputedData {
1508
1455
  __pathInputed?: number;
1509
1456
  __pathForRender?: IPathCommandData;
1510
1457
  __path2DForRender?: IPath2D;
1458
+ __pathForMotion?: IMotionPathData;
1511
1459
  }
1512
1460
  interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDataProxy, ILeafInputData, IEventer {
1513
1461
  tag: string;
@@ -1528,6 +1476,7 @@ interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDa
1528
1476
  proxyData?: ILeafInputData;
1529
1477
  __proxyData?: ILeafInputData;
1530
1478
  syncEventer?: ILeaf;
1479
+ lockNormalStyle?: boolean;
1531
1480
  __layout: ILeafLayout;
1532
1481
  __world: IMatrixWithBoundsScaleData;
1533
1482
  __local?: IMatrixWithBoundsData;
@@ -1547,7 +1496,10 @@ interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDa
1547
1496
  __level: number;
1548
1497
  __tempNumber?: number;
1549
1498
  readonly __worldFlipped: boolean;
1499
+ animation?: IObject;
1500
+ animationOut?: IObject;
1550
1501
  __hasAutoLayout?: boolean;
1502
+ __hasMotionPath?: boolean;
1551
1503
  __hasMask?: boolean;
1552
1504
  __hasEraser?: boolean;
1553
1505
  __hitCanvas?: IHitCanvas;
@@ -1559,8 +1511,6 @@ interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDa
1559
1511
  readonly __ignoreHitWorld: boolean;
1560
1512
  readonly __inLazyBounds: boolean;
1561
1513
  readonly pathInputed: boolean;
1562
- __parentWait?: IFunction[];
1563
- __leaferWait?: IFunction[];
1564
1514
  destroyed: boolean;
1565
1515
  reset(data?: ILeafInputData): void;
1566
1516
  resetCustom(): void;
@@ -1569,7 +1519,7 @@ interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDa
1569
1519
  nextRender(item: IFunction, bind?: IObject, off?: 'off'): void;
1570
1520
  removeNextRender(item: IFunction): void;
1571
1521
  __bindLeafer(leafer: ILeaferBase | null): void;
1572
- set(data: IObject): void;
1522
+ set(data: IObject, isTemp?: boolean): void;
1573
1523
  get(name?: string | string[] | IObject): ILeafInputData | IValue;
1574
1524
  setAttr(name: string, value: any): void;
1575
1525
  getAttr(name: string): any;
@@ -1588,6 +1538,7 @@ interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDa
1588
1538
  findOne(condition: number | string | IFindMethod, options?: any): ILeaf | undefined;
1589
1539
  findId(id: number | string): ILeaf | undefined;
1590
1540
  focus(value?: boolean): void;
1541
+ updateState(): void;
1591
1542
  updateLayout(): void;
1592
1543
  forceUpdate(attrName?: string): void;
1593
1544
  forceRender(_bounds?: IBoundsData): void;
@@ -1599,7 +1550,7 @@ interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDa
1599
1550
  __updateLocalStrokeBounds(): void;
1600
1551
  __updateLocalRenderBounds(): void;
1601
1552
  __updateContentBounds(): void;
1602
- __updateBoxBounds(): void;
1553
+ __updateBoxBounds(secondLayout?: boolean): void;
1603
1554
  __updateStrokeBounds(): void;
1604
1555
  __updateRenderBounds(): void;
1605
1556
  __updateAutoLayout(): void;
@@ -1622,17 +1573,22 @@ interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDa
1622
1573
  localToWorld(local: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void;
1623
1574
  worldToInner(world: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void;
1624
1575
  innerToWorld(inner: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void;
1576
+ getBoxPoint(world: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
1577
+ getBoxPointByInner(inner: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
1625
1578
  getInnerPoint(world: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
1579
+ getInnerPointByBox(box: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
1626
1580
  getInnerPointByLocal(local: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
1627
1581
  getLocalPoint(world: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
1628
1582
  getLocalPointByInner(inner: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
1583
+ getPagePoint(world: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
1629
1584
  getWorldPoint(inner: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
1585
+ getWorldPointByBox(box: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
1630
1586
  getWorldPointByLocal(local: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
1631
- getPagePoint(world: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
1632
1587
  getWorldPointByPage(page: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
1633
1588
  setTransform(transform?: IMatrixData, resize?: boolean): void;
1634
1589
  transform(transform?: IMatrixData, resize?: boolean): void;
1635
1590
  move(x: number | IPointData, y?: number): void;
1591
+ moveInner(x: number | IPointData, y?: number): void;
1636
1592
  scaleOf(origin: IPointData | IAlign, scaleX: number, scaleY?: number, resize?: boolean): void;
1637
1593
  rotateOf(origin: IPointData | IAlign, rotation: number): void;
1638
1594
  skewOf(origin: IPointData | IAlign, skewX: number, skewY?: number, resize?: boolean): void;
@@ -1664,6 +1620,12 @@ interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDa
1664
1620
  __drawRenderPath(canvas: ILeaferCanvas): void;
1665
1621
  __updatePath(): void;
1666
1622
  __updateRenderPath(): void;
1623
+ getMotionPathData(): IMotionPathData;
1624
+ getMotionPoint(motionDistance: number | IUnitData): IRotationPointData;
1625
+ getMotionTotal(): number;
1626
+ __updateMotionPath(): void;
1627
+ __runAnimation(type: 'in' | 'out', complete?: IFunction): void;
1628
+ __emitLifeEvent(type: string): void;
1667
1629
  children?: ILeaf[];
1668
1630
  __updateSortChildren(): void;
1669
1631
  add(child: ILeaf, index?: number): void;
@@ -1728,9 +1690,13 @@ interface IUIEvent extends IEvent {
1728
1690
  buttons?: number;
1729
1691
  path?: ILeafList;
1730
1692
  throughPath?: ILeafList;
1731
- getPage?(): IPointData;
1693
+ getBoxPoint?(relative?: ILeaf): IPointData;
1694
+ getInnerPoint?(relative?: ILeaf): IPointData;
1695
+ getLocalPoint?(relative?: ILeaf): IPointData;
1696
+ getPagePoint?(): IPointData;
1732
1697
  getInner?(relative?: ILeaf): IPointData;
1733
1698
  getLocal?(relative?: ILeaf): IPointData;
1699
+ getPage?(): IPointData;
1734
1700
  }
1735
1701
  interface IPointerEvent extends IUIEvent {
1736
1702
  width?: number;
@@ -1814,6 +1780,8 @@ interface IInteraction extends IControl {
1814
1780
  pointerUp(data?: IPointerEvent): void;
1815
1781
  pointerCancel(): void;
1816
1782
  multiTouch(data: IUIEvent, list: IKeepTouchData[]): void;
1783
+ menu(data: IPointerEvent): void;
1784
+ menuTap(data: IPointerEvent): void;
1817
1785
  move(data: IMoveEvent): void;
1818
1786
  zoom(data: IZoomEvent): void;
1819
1787
  rotate(data: IRotateEvent): void;
@@ -1840,6 +1808,7 @@ interface IInteractionCanvas extends ILeaferCanvas {
1840
1808
  interface IInteractionConfig {
1841
1809
  wheel?: IWheelConfig;
1842
1810
  pointer?: IPointerConfig;
1811
+ touch?: ITouchConfig;
1843
1812
  zoom?: IZoomConfig;
1844
1813
  move?: IMoveConfig;
1845
1814
  eventer?: IObject;
@@ -1857,7 +1826,7 @@ interface IMoveConfig {
1857
1826
  holdMiddleKey?: boolean;
1858
1827
  holdRightKey?: boolean;
1859
1828
  scroll?: boolean | 'limit';
1860
- drag?: boolean;
1829
+ drag?: boolean | 'auto';
1861
1830
  dragAnimate?: boolean;
1862
1831
  dragEmpty?: boolean;
1863
1832
  dragOut?: boolean;
@@ -1890,6 +1859,9 @@ interface IPointerConfig {
1890
1859
  preventDefault?: boolean;
1891
1860
  preventDefaultMenu?: boolean;
1892
1861
  }
1862
+ interface ITouchConfig {
1863
+ preventDefault?: boolean | 'auto';
1864
+ }
1893
1865
 
1894
1866
  interface IHitCanvasManager extends ICanvasManager {
1895
1867
  maxTotal: number;
@@ -1900,7 +1872,7 @@ interface IHitCanvasManager extends ICanvasManager {
1900
1872
  interface IZoomView extends IBranch {
1901
1873
  }
1902
1874
 
1903
- type ILeaferType = 'draw' | 'editor' | 'design' | 'board' | 'document' | 'app' | 'website' | 'game' | 'player' | 'chart' | 'custom';
1875
+ type ILeaferType = 'draw' | 'block' | 'editor' | 'design' | 'board' | 'document' | 'app' | 'website' | 'game' | 'player' | 'chart' | 'custom';
1904
1876
  interface ILeaferConfig extends IRendererConfig, ILeaferCanvasConfig, IInteractionConfig, ILayouterConfig {
1905
1877
  start?: boolean;
1906
1878
  type?: ILeaferType;
@@ -1948,6 +1920,9 @@ interface ILeaferAttrData {
1948
1920
  getValidMove(moveX: number, moveY: number): IPointData;
1949
1921
  getValidScale(changeScale: number): number;
1950
1922
  getWorldPointByClient(clientPoint: IClientPointData, updateClient?: boolean): IPointData;
1923
+ getPagePointByClient(clientPoint: IClientPointData, updateClient?: boolean): IPointData;
1924
+ updateClientBounds(): void;
1925
+ receiveEvent(event: any): void;
1951
1926
  }
1952
1927
  type IZoomType = 'in' | 'out' | 'fit' | 'fit-width' | 'fit-height' | number | ILeaf | ILeaf[] | IBoundsData;
1953
1928
  interface ILeaferBase extends IZoomView, IControl, ILeaferAttrData {
@@ -2051,7 +2026,7 @@ interface IImageManager {
2051
2026
  destroy(): void;
2052
2027
  }
2053
2028
 
2054
- type ICanvasType = 'skia' | 'napi' | 'canvas' | 'wx';
2029
+ type ICanvasType = 'skia' | 'napi' | 'canvas' | 'miniapp';
2055
2030
  interface ISkiaCanvas {
2056
2031
  toBuffer(format: IExportFileType, config: ISkiaCanvasExportConfig): Promise<any>;
2057
2032
  toBufferSync(format: IExportFileType, config: ISkiaCanvasExportConfig): any;
@@ -2086,6 +2061,7 @@ interface IPlatform {
2086
2061
  toURL(text: string, fileType?: 'text' | 'svg'): string;
2087
2062
  requestRender?(render: IFunction): void;
2088
2063
  canvas?: ILeaferCanvas;
2064
+ renderCanvas?: ILeaferCanvas;
2089
2065
  canvasType?: ICanvasType;
2090
2066
  isWorker?: boolean;
2091
2067
  isMobile?: boolean;
@@ -2156,4 +2132,4 @@ interface ICursorRotateMap {
2156
2132
  [name: string]: ICursorRotate;
2157
2133
  }
2158
2134
 
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 };
2135
+ 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, IMotionPathData, 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, IRotationPointData, IScaleData, IScaleRotationData, IScreenSizeData, IScrollPointData, ISelector, ISelectorConfig, ISelectorProxy, ISide, ISize, ISizeData, ISkewData, ISkiaCanvas, ISkiaCanvasExportConfig, ISkiaNAPICanvas, IStateStyleType, IString, IStringFunction, IStringMap, ISwipeEvent, ITaskItem, ITaskOptions, ITaskProcessor, ITaskProcessorConfig, ITextMetrics, ITimer, ITouchConfig, 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 };