@leafer/interface 1.0.0-rc.9 → 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.
@@ -1,7 +1,6 @@
1
1
  import { IBranch } from './IBranch'
2
- import { ILeaf } from './ILeaf'
2
+
3
3
 
4
4
  export interface IZoomView extends IBranch {
5
- zoomLayer?: ILeaf
6
- setZoomLayer(zoomLayer: ILeaf): void
5
+
7
6
  }
@@ -1,7 +1,7 @@
1
- import { ILeaferCanvas } from '../../canvas/ILeaferCanvas'
2
- import { IRenderOptions } from '../../renderer/IRenderer'
3
1
  import { IBranch } from '../IBranch'
4
2
  import { ILeafRender } from './ILeafRender'
3
+ import { ILeaferCanvas } from '../../canvas/ILeaferCanvas'
4
+ import { IRenderOptions } from '../../renderer/IRenderer'
5
5
 
6
6
  export type IBranchRenderModule = IBranchRender & ThisType<IBranch>
7
7
 
@@ -15,6 +15,7 @@ export interface ILeafBounds {
15
15
  __updateRenderBounds?(): void
16
16
 
17
17
  __updateAutoLayout?(): void
18
+ __updateFlowLayout?(): void
18
19
  __updateNaturalSize?(): void
19
20
 
20
21
  __updateStrokeSpread?(): number
@@ -4,7 +4,7 @@ import { IValue } from '../../data/IData'
4
4
  export type ILeafDataProxyModule = ILeafDataProxy & ThisType<ILeaf>
5
5
 
6
6
  export interface ILeafDataProxy {
7
- __setAttr?(name: string, newValue: IValue): void
7
+ __setAttr?(name: string, newValue: IValue): boolean
8
8
  __getAttr?(name: string): IValue
9
9
  setProxyAttr?(name: string, newValue: IValue): void
10
10
  getProxyAttr?(name: string): IValue
@@ -8,7 +8,7 @@ export type ILeafEventerModule = ILeafEventer & ThisType<ILeaf>
8
8
 
9
9
  export interface ILeafEventer {
10
10
  on?(type: string | string[], listener: IEventListener, options?: IEventListenerOptions | boolean): void
11
- off?(type: string | string[], listener: IEventListener, options?: IEventListenerOptions | boolean): void
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
14
14
  once?(type: string | string[], listener: IEventListener, capture?: boolean): void
@@ -6,7 +6,10 @@ export type ILeafHitModule = ILeafHit & ThisType<ILeaf>
6
6
 
7
7
  export interface ILeafHit {
8
8
  __hitWorld?(point: IRadiusPointData): boolean
9
- __hit?(local: IRadiusPointData): boolean
9
+ __hit?(inner: IRadiusPointData): boolean
10
+ __hitFill?(inner: IRadiusPointData): boolean
11
+ __hitStroke?(inner: IRadiusPointData, strokeWidth: number): boolean
12
+ __hitPixel(inner: IRadiusPointData): boolean
10
13
  __drawHitPath?(canvas: ILeaferCanvas): void
11
14
  __updateHitCanvas?(): void
12
15
  }
@@ -9,7 +9,8 @@ export interface ILeafRender {
9
9
  __draw?(canvas: ILeaferCanvas, options: IRenderOptions): void
10
10
  __drawFast?(canvas: ILeaferCanvas, options: IRenderOptions): void
11
11
 
12
- __renderShape?(canvas: ILeaferCanvas, options: IRenderOptions): void
12
+ __clip?(_canvas: ILeaferCanvas, _options: IRenderOptions): void
13
+ __renderShape?(canvas: ILeaferCanvas, options: IRenderOptions, ignoreFill?: boolean, ignoreStroke?: boolean): void
13
14
 
14
15
  __updateWorldOpacity?(): void
15
16
  __updateChange?(): void
@@ -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?: IEventListenerOptions | boolean
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?: IEventListenerOptions | boolean): void
39
- off(type: string | string[], listener: IEventListener, options?: IEventListenerOptions | boolean): void
40
- on_(type: string | string[], listener: IEventListener, bind?: IObject, options?: IEventListenerOptions | boolean): IEventListenerId
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
@@ -3,7 +3,7 @@ import { ILeafList } from '../data/IList'
3
3
  import { IEvent } from './IEvent'
4
4
  import { ILeaferImage } from '../image/ILeaferImage'
5
5
  import { ILeaf } from '../display/ILeaf'
6
- import { IPointData } from '../math/IMath'
6
+ import { IPointData, IBoundsData } from '../math/IMath'
7
7
 
8
8
  export interface IUIEvent extends IEvent {
9
9
  x: number
@@ -23,6 +23,7 @@ export interface IUIEvent extends IEvent {
23
23
  path?: ILeafList
24
24
  throughPath?: ILeafList // 穿透path,不受层级影响,从上到下只要碰撞到区域就算,一般点击的时候
25
25
 
26
+ getPage?(): IPointData
26
27
  getInner?(relative?: ILeaf): IPointData
27
28
  getLocal?(relative?: ILeaf): IPointData
28
29
  }
@@ -32,11 +33,13 @@ export interface IPointerEvent extends IUIEvent {
32
33
  width?: number
33
34
  height?: number
34
35
  pointerType?: PointerType
36
+ multiTouch?: boolean
35
37
  pressure?: number
36
38
  tangentialPressure?: number
37
39
  tiltX?: number
38
40
  tiltY?: number
39
41
  twist?: number
42
+ isCancel?: boolean
40
43
  }
41
44
  export type PointerType = 'mouse' | 'pen' | 'touch'
42
45
 
@@ -46,10 +49,15 @@ export interface IDragEvent extends IPointerEvent {
46
49
  totalX?: number
47
50
  totalY?: number
48
51
 
52
+ getPageMove?(total?: boolean): IPointData
49
53
  getInnerMove?(relative?: ILeaf): IPointData
50
54
  getLocalMove?(relative?: ILeaf): IPointData
55
+
56
+ getPageTotal?(): IPointData
51
57
  getInnerTotal?(relative?: ILeaf): IPointData
52
58
  getLocalTotal?(relative?: ILeaf): IPointData
59
+
60
+ getPageBounds?(): IBoundsData
53
61
  }
54
62
 
55
63
  export interface IDropEvent extends IPointerEvent {
@@ -66,7 +74,7 @@ export interface IZoomEvent extends IUIEvent {
66
74
  }
67
75
 
68
76
  export interface IMoveEvent extends IDragEvent {
69
-
77
+ moveType?: 'drag' | 'move'
70
78
  }
71
79
 
72
80
  export interface ISwipeEvent extends IDragEvent {
@@ -0,0 +1,41 @@
1
+ import { IBlob, ILeaferCanvas } from '../canvas/ILeaferCanvas'
2
+ import { ICanvasContext2DSettings } from '../canvas/ICanvas'
3
+ import { ILeaf } from '../display/ILeaf'
4
+ import { ILocationType } from '../layout/ILeafLayout'
5
+ import { IBoundsData } from '../math/IMath'
6
+
7
+ export interface IExportOptions {
8
+ quality?: number
9
+ blob?: boolean
10
+ scale?: number
11
+ smooth?: boolean
12
+ pixelRatio?: number
13
+ slice?: boolean
14
+ trim?: boolean
15
+ fill?: string
16
+ screenshot?: IBoundsData | boolean
17
+ relative?: ILocationType | ILeaf
18
+ json?: IJSONOptions
19
+ contextSettings?: ICanvasContext2DSettings
20
+ onCanvas?: IExportOnCanvasFunction
21
+ }
22
+
23
+ export interface IJSONOptions {
24
+ matrix?: boolean
25
+ }
26
+
27
+ export interface IExportResult {
28
+ data: ILeaferCanvas | IBlob | string | boolean
29
+ width?: number
30
+ height?: number
31
+ renderBounds?: IBoundsData
32
+ trimBounds?: IBoundsData
33
+ }
34
+
35
+ export interface IExportResultFunction {
36
+ (data: IExportResult): void
37
+ }
38
+
39
+ export interface IExportOnCanvasFunction {
40
+ (data: ILeaferCanvas): void
41
+ }
@@ -1,2 +1,2 @@
1
1
  export type IExportImageType = 'jpg' | 'png' | 'webp'
2
- export type IExportFileType = IExportImageType | 'svg' | 'pdf' | 'json'
2
+ export type IExportFileType = IExportImageType | 'svg' | 'pdf' | 'json'
@@ -1,3 +1,4 @@
1
+ import { IObject } from '../data/IData'
1
2
  import { IPointData } from '../math/IMath'
2
3
 
3
4
  export interface IFunction {
@@ -8,6 +9,14 @@ export interface INumberFunction {
8
9
  (...arg: any): number
9
10
  }
10
11
 
12
+ export interface IStringFunction {
13
+ (...arg: any): string
14
+ }
15
+
16
+ export interface IObjectFunction {
17
+ (...arg: any): IObject
18
+ }
19
+
11
20
  export interface IPointDataFunction {
12
21
  (...arg: any): IPointData
13
22
  }
@@ -11,11 +11,12 @@ export interface IImageManager {
11
11
  recycledList: ILeaferImage[]
12
12
  tasker: ITaskProcessor
13
13
  patternTasker: ITaskProcessor
14
+ patternLocked?: boolean // 锁定pattern不更新, 一般用于创建碰撞位图 UIHit.ts
14
15
  readonly isComplete: boolean
15
16
  get(config: ILeaferImageConfig): ILeaferImage
16
17
  recycle(image: ILeaferImage): void
17
18
  clearRecycled(): void
18
- isPixel(config: ILeaferImageConfig): boolean // png / svg / webp
19
+ hasOpacityPixel(config: ILeaferImageConfig): boolean // png / svg / webp
19
20
  isFormat(format: IExportFileType, config: ILeaferImageConfig): boolean
20
21
  destroy(): void
21
22
  }
@@ -1,6 +1,8 @@
1
+ import { ICanvasPattern } from '../canvas/ICanvas'
1
2
  import { IObject } from '../data/IData'
2
3
  import { InnerId } from '../event/IEventer'
3
4
  import { IExportFileType } from '../file/IFileType'
5
+ import { IMatrixData } from '../math/IMath'
4
6
 
5
7
  export interface ILeaferImageConfig {
6
8
  url: string
@@ -16,6 +18,15 @@ export interface ILeaferImageOnError {
16
18
  (error?: string | IObject, image?: ILeaferImage): any
17
19
  }
18
20
 
21
+ export interface ILeaferImageCacheCanvas {
22
+ data: IObject
23
+ params: IArguments
24
+ }
25
+
26
+ export interface ILeaferImagePatternPaint {
27
+ transform: IMatrixData
28
+ }
29
+
19
30
  export interface ILeaferImage {
20
31
  readonly innerId: InnerId
21
32
  readonly url: string
@@ -25,6 +36,7 @@ export interface ILeaferImage {
25
36
  height: number
26
37
 
27
38
  isSVG: boolean
39
+ hasOpacityPixel: boolean
28
40
 
29
41
  readonly completed: boolean
30
42
  ready: boolean
@@ -37,6 +49,7 @@ export interface ILeaferImage {
37
49
  load(onSuccess?: ILeaferImageOnLoaded, onError?: ILeaferImageOnError): number
38
50
  unload(index: number, stopEvent?: boolean): void
39
51
  getCanvas(width: number, height: number, opacity?: number, _filters?: IObject): unknown
52
+ getPattern(canvas: any, repeat: string | null, transform?: IMatrixData, paint?: IObject): ICanvasPattern
40
53
  destroy(): void
41
54
  }
42
55
 
package/src/index.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { IAppBase } from './app/IApp'
2
- export { ILeaferBase, ILeaferAttrData, ILeaferType, ILeaferTypeCreator, ILeaferTypeFunction, ILeaferTypeList, ILeaferConfig, ICreator, IUICreator } from './app/ILeafer'
3
- export { ILeaf, ILeafAttrData, ILeafComputedData, ILeafInputData, ICachedLeaf, IHitType, IBlendMode, IEditSize, ICursorType, ICursorTypeMap, IAround } from './display/ILeaf'
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'
4
4
  export { IBranch } from './display/IBranch'
5
5
  export { IZoomView } from './display/IView'
6
6
 
@@ -14,13 +14,12 @@ export { ILeafBounds, ILeafBoundsModule } from './display/module/ILeafBounds'
14
14
  export { ILeafHit, ILeafHitModule } from './display/module/ILeafHit'
15
15
  export { ILeafRender, ILeafRenderModule } from './display/module/ILeafRender'
16
16
  export { ILeafEventer, ILeafEventerModule } from './display/module/ILeafEventer'
17
- export { ILeafMask, ILeafMaskModule } from './display/module/ILeafMask'
18
17
  export { IBranchRender, IBranchRenderModule } from './display/module/IBranchRender'
19
18
 
20
19
  export { IRenderer, IRendererConfig, IRenderOptions } from './renderer/IRenderer'
21
20
  export { IWatcher, IWatchEventData, IWatcherConfig } from './watcher/IWatcher'
22
21
  export { ILayouter, ILayoutChangedData, ILayoutBlockData, ILayouterConfig, IPartLayoutConfig } from './layouter/ILayouter'
23
- export { ISelector, ISelectorConfig, ISelectorProxy, IFindMethod, ISelectPathResult, ISelectPathOptions, AnswerType } from './selector/ISelector'
22
+ export { ISelector, ISelectorConfig, ISelectorProxy, IFindCondition, IFindMethod, IPickResult, IPickOptions, IPickBottom, IAnswer } from './selector/ISelector'
24
23
 
25
24
  export { ICanvasManager } from './canvas/ICanvasManager'
26
25
  export { IHitCanvasManager } from './canvas/IHitCanvasManager'
@@ -34,22 +33,24 @@ export { IPlatform, IMiniapp, IMiniappSelect, IMiniappSizeView } from './platfor
34
33
  export { IPlugin } from './plugin/IPlugin'
35
34
 
36
35
 
37
- export { ILeaferCanvas, IHitCanvas, ICanvasAttr, ICanvasStrokeOptions, ILeaferCanvasConfig, IHitCanvasConfig, IBlobFunction, IBlob } from './canvas/ILeaferCanvas'
36
+ export { ILeaferCanvas, ILeaferCanvasView, IHitCanvas, ICanvasAttr, ICanvasStrokeOptions, ICanvasCacheOptions, ILeaferCanvasConfig, IHitCanvasConfig, IBlobFunction, IBlob } from './canvas/ILeaferCanvas'
38
37
  export { ISkiaCanvas, ISkiaCanvasExportConfig, ICanvasType, ISkiaNAPICanvas } from './canvas/ISkiaCanvas'
39
38
  export { IPathDrawer, IPathCreator } from './path/IPathDrawer'
40
- export { IWindingRule, ICanvasContext2D, ITextMetrics, IPath2D } from './canvas/ICanvas'
39
+ export { IWindingRule, ICanvasContext2D, ICanvasContext2DSettings, ITextMetrics, IPath2D, ICanvasPattern } from './canvas/ICanvas'
41
40
  export { CanvasPathCommand, IPathCommandData, MCommandData, HCommandData, VCommandData, LCommandData, CCommandData, SCommandData, QCommandData, TCommandData, ZCommandData, ACommandData, RectCommandData, RoundRectCommandData, EllipseCommandData, ArcCommandData, ArcToCommandData } from './path/IPathCommand'
42
41
 
43
- export { ILeaferImage, ILeaferImageConfig, ILeaferImageOnLoaded, ILeaferImageOnError } from './image/ILeaferImage'
42
+ export { ILeaferImage, ILeaferImageConfig, ILeaferImageOnLoaded, ILeaferImageOnError, ILeaferImageCacheCanvas, ILeaferImagePatternPaint } from './image/ILeaferImage'
44
43
  export { IExportFileType, IExportImageType } from './file/IFileType'
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
+ export { ICursorTypeMap, ICursorRotate, ICursorRotateMap } from './interaction/ICursor'
49
50
  export { IInteraction, IInteractionCanvas, IInteractionConfig, IWheelConfig, IPointerConfig } from './interaction/IInteraction'
50
51
 
51
52
 
52
- export { INumber, IBoolean, IString, IValue, IPathString, ITimer, IObject, INumberMap, IStringMap, IBooleanMap, IDataTypeHandle } from './data/IData'
53
+ export { INumber, IBoolean, IString, IValue, IFourNumber, IPathString, ITimer, IObject, INumberMap, IStringMap, IBooleanMap, IFunctionMap, IPointDataMap, IDataTypeHandle } from './data/IData'
53
54
  export { ILeafList, ILeafArrayMap, ILeafMap, ILeafLevelList, ILeafListItemCallback } from './data/IList'
54
- export { IPoint, IPointData, IRadiusPointData, ISize, ISizeData, IScreenSizeData, IBounds, IBoundsData, IBoundsDataFn, IOffsetBoundsData, ITwoPointBoundsData, IAutoBounds, IAutoBoundsData, IMatrix, IMatrixData, IMatrixWithBoundsData, IMatrixWithScaleData, IMatrixWithLayoutData, IScaleRotationData, IScaleData, ISkewData, ILayoutBoundsData, ILayoutData, ILayoutAttr } from './math/IMath'
55
- export { IFunction, IAttrDecorator } from './function/IFunction'
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 { IFunction, IStringFunction, INumberFunction, IObjectFunction, IPointDataFunction, IAttrDecorator } from './function/IFunction'
@@ -0,0 +1,16 @@
1
+ import { ICursorType } from '../display/ILeaf'
2
+
3
+
4
+ export interface ICursorTypeMap {
5
+ [name: string]: ICursorType | ICursorType[]
6
+ }
7
+
8
+
9
+ export interface ICursorRotate {
10
+ rotation?: number
11
+ data?: string
12
+ }
13
+
14
+ export interface ICursorRotateMap {
15
+ [name: string]: ICursorRotate
16
+ }
@@ -2,8 +2,8 @@ import { INumberFunction, IPointDataFunction } from '../function/IFunction'
2
2
  import { IPointerEvent, IMoveEvent, IZoomEvent, IRotateEvent, IUIEvent, IKeyEvent } from '../event/IUIEvent'
3
3
  import { ILeaf, ICursorType } from '../display/ILeaf'
4
4
  import { ILeafList } from '../data/IList'
5
- import { IPointData } from '../math/IMath'
6
- import { ISelector, ISelectPathOptions } from '../selector/ISelector'
5
+ import { IClientPointData, IPointData } from '../math/IMath'
6
+ import { ISelector, IPickOptions, IPickBottom } from '../selector/ISelector'
7
7
  import { IBounds } from '../math/IMath'
8
8
  import { IControl } from '../control/IControl'
9
9
  import { IKeepTouchData } from '../event/IEvent'
@@ -16,20 +16,32 @@ export interface IInteraction extends IControl {
16
16
  selector: ISelector
17
17
 
18
18
  running: boolean
19
+
19
20
  readonly dragging: boolean
20
- readonly isDragEmpty: boolean
21
+ readonly transforming: boolean
22
+
21
23
  readonly moveMode: boolean
24
+ readonly canHover: boolean
25
+
26
+ readonly isDragEmpty: boolean
27
+ readonly isMobileDragEmpty: boolean
28
+ readonly isHoldMiddleKey: boolean
29
+ readonly isHoldRightKey: boolean
30
+ readonly isHoldSpaceKey: boolean
22
31
 
23
32
  config: IInteractionConfig
24
33
 
25
34
  cursor: ICursorType | ICursorType[]
26
35
  readonly hitRadius: number
27
36
 
37
+ bottomList?: IPickBottom[] // 底部可拾取的虚拟元素
38
+
28
39
  shrinkCanvasBounds: IBounds
29
40
 
30
41
  downData: IPointerEvent
31
42
  hoverData: IPointerEvent
32
43
  downTime: number
44
+ focusData: ILeaf
33
45
 
34
46
  receive(event: any): void
35
47
 
@@ -48,12 +60,25 @@ export interface IInteraction extends IControl {
48
60
  keyDown(data: IKeyEvent): void
49
61
  keyUp(data: IKeyEvent): void
50
62
 
51
- findPath(data: IPointerEvent, options?: ISelectPathOptions): ILeafList
63
+ findPath(data: IPointerEvent, options?: IPickOptions): ILeafList
64
+ isRootPath(data: IPointerEvent): boolean
65
+ isTreePath(data: IPointerEvent): boolean
66
+ canMove(data: IPointerEvent): boolean
67
+
52
68
  isDrag(leaf: ILeaf): boolean
69
+ isPress(leaf: ILeaf): boolean
70
+ isHover(leaf: ILeaf): boolean
71
+ isFocus(leaf: ILeaf): boolean
72
+
73
+ cancelHover(): void
53
74
 
54
- updateDownData(data?: IPointerEvent): void
75
+ updateDownData(data?: IPointerEvent, options?: IPickOptions, merge?: boolean): void
55
76
  updateHoverData(data: IPointerEvent): void
77
+
56
78
  updateCursor(hoverData?: IPointerEvent): void
79
+ setCursor(cursor: ICursorType | ICursorType[]): void
80
+
81
+ getLocal(clientPoint: IClientPointData, updateClient?: boolean): IPointData
57
82
 
58
83
  emit(type: string, data: IUIEvent, path?: ILeafList, excludePath?: ILeafList): void
59
84
  }
@@ -65,26 +90,34 @@ export interface IInteractionCanvas extends ILeaferCanvas {
65
90
  export interface IInteractionConfig {
66
91
  wheel?: IWheelConfig
67
92
  pointer?: IPointerConfig
68
- cursor?: ICursorConfig
69
93
  zoom?: IZoomConfig
70
94
  move?: IMoveConfig
71
95
  eventer?: IObject
96
+ cursor?: boolean
97
+ keyEvent?: boolean
72
98
  }
73
99
 
74
100
  export interface IZoomConfig {
101
+ disabled?: boolean
75
102
  min?: number
76
103
  max?: number
77
104
  }
78
105
 
79
106
  export interface IMoveConfig {
107
+ disabled?: boolean
80
108
  holdSpaceKey?: boolean
109
+ holdMiddleKey?: boolean
110
+ holdRightKey?: boolean
111
+ scroll?: boolean | 'limit'
81
112
  drag?: boolean
113
+ dragAnimate?: boolean
82
114
  dragEmpty?: boolean
83
115
  dragOut?: boolean
84
116
  autoDistance?: number
85
117
  }
86
118
 
87
119
  export interface IWheelConfig {
120
+ disabled?: boolean
88
121
  zoomMode?: boolean | 'mouse'
89
122
  zoomSpeed?: number // 取值范围 0 ~ 1, 默认0.5
90
123
  moveSpeed?: number
@@ -102,11 +135,17 @@ export interface IPointerConfig {
102
135
  tapTime?: number
103
136
  longPressTime?: number
104
137
  transformTime?: number
138
+
139
+ // mobile
140
+ hover?: boolean
141
+ touch?: boolean // 使用touch事件代替pointer事件
142
+
105
143
  dragHover?: boolean
106
144
  dragDistance?: number
107
145
  swipeDistance?: number
108
146
  ignoreMove?: boolean // 性能优化字段, 控制move事件触发次数
109
147
  preventDefault?: boolean
148
+ preventDefaultMenu?: boolean
110
149
  }
111
150
 
112
151
  export interface ICursorConfig {
@@ -1,8 +1,8 @@
1
1
  import { IBoundsData, IMatrixData, ILayoutBoundsData, IPointData } from '../math/IMath'
2
2
  import { ILeaf } from '../display/ILeaf'
3
3
 
4
- export type ILocationType = 'world' | 'local' | 'inner'
5
- export type IBoundsType = 'content' | 'box' | 'stroke' | 'margin' | 'render'
4
+ export type ILocationType = 'world' | 'page' | 'local' | 'inner'
5
+ export type IBoundsType = 'content' | 'box' | 'stroke' | 'render'
6
6
 
7
7
  export interface ILeafLayout {
8
8
 
@@ -12,19 +12,24 @@ export interface ILeafLayout {
12
12
 
13
13
  // inner
14
14
 
15
+ contentBounds: IBoundsData // | content |
15
16
  boxBounds: IBoundsData // | content + padding |
16
17
  strokeBounds: IBoundsData // | boxBounds + border |
17
18
  renderBounds: IBoundsData // | strokeBounds + shadow |
18
19
 
19
- // auto layout
20
- marginBounds: IBoundsData // | strokeBounds + margin |
21
- contentBounds: IBoundsData // | content |
22
-
23
20
  // local
24
21
 
25
- //localBoxBounds: IBoundsData = leaf.__local
26
- localStrokeBounds?: IBoundsData
27
- localRenderBounds?: IBoundsData
22
+ localContentBounds: IBoundsData
23
+ // localBoxBounds: IBoundsData // use leaf.__localBoxBounds
24
+ localStrokeBounds: IBoundsData
25
+ localRenderBounds: IBoundsData
26
+
27
+ // world
28
+
29
+ worldContentBounds: IBoundsData
30
+ worldBoxBounds: IBoundsData
31
+ worldStrokeBounds: IBoundsData
32
+ // worldRenderBounds: IBoundsData // use leaf.__world
28
33
 
29
34
  // state
30
35
  resized: boolean
@@ -58,8 +63,8 @@ export interface ILeafLayout {
58
63
  affectChildrenSort?: boolean
59
64
 
60
65
  strokeSpread: number
61
- renderSpread: number
62
- strokeBoxSpread: number
66
+ strokeBoxSpread: number // 用于生成strokeBounds
67
+ renderSpread: number // -1 表示需监视变化,不影响实际renderBounds,目前用在Box上
63
68
  renderShapeSpread: number
64
69
 
65
70
  // temp local
@@ -69,6 +74,12 @@ export interface ILeafLayout {
69
74
  d: number
70
75
  e: number
71
76
  f: number
77
+ x: number
78
+ y: number
79
+ width: number
80
+ height: number
81
+
82
+ createLocal(): void
72
83
 
73
84
  update(): void
74
85
 
@@ -78,8 +89,10 @@ export interface ILeafLayout {
78
89
  getLayoutPoints(type?: IBoundsType, relative?: ILocationType | ILeaf): IPointData[]
79
90
 
80
91
  // 独立 / 引用 boxBounds
92
+ shrinkContent(): void
81
93
  spreadStroke(): void
82
94
  spreadRender(): void
95
+ shrinkContentCancel(): void
83
96
  spreadStrokeCancel(): void
84
97
  spreadRenderCancel(): void
85
98