@leafer/interface 1.0.0-rc.2 → 1.0.0-rc.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/app/IApp.ts +3 -3
- package/src/app/ILeafer.ts +44 -20
- package/src/canvas/ICanvas.ts +7 -2
- package/src/canvas/IHitCanvasManager.ts +3 -3
- package/src/canvas/ILeaferCanvas.ts +19 -11
- package/src/canvas/ISkiaCanvas.ts +20 -1
- package/src/data/IData.ts +6 -5
- package/src/data/ILeafData.ts +11 -6
- package/src/data/IList.ts +9 -6
- package/src/display/IBranch.ts +2 -1
- package/src/display/ILeaf.ts +266 -93
- package/src/display/IView.ts +2 -6
- package/src/display/module/IBranchRender.ts +2 -2
- package/src/display/module/ILeafBounds.ts +2 -0
- package/src/display/module/ILeafDataProxy.ts +5 -3
- package/src/display/module/ILeafHit.ts +4 -1
- package/src/display/module/ILeafRender.ts +2 -1
- package/src/event/IEvent.ts +3 -23
- package/src/event/IEventer.ts +6 -1
- package/src/event/IUIEvent.ts +11 -8
- package/src/file/IExport.ts +34 -0
- package/src/file/IFileType.ts +1 -1
- package/src/function/IFunction.ts +9 -0
- package/src/image/IImageManager.ts +4 -0
- package/src/image/ILeaferImage.ts +13 -0
- package/src/index.ts +16 -15
- package/src/interaction/ICursor.ts +16 -0
- package/src/interaction/IInteraction.ts +33 -4
- package/src/layout/ILeafLayout.ts +30 -14
- package/src/layouter/ILayouter.ts +3 -0
- package/src/math/IMath.ts +72 -35
- package/src/path/IPathDrawer.ts +6 -3
- package/src/platform/IPlatform.ts +17 -2
- package/src/plugin/IPlugin.ts +2 -2
- package/src/renderer/IRenderer.ts +4 -2
- package/src/selector/ISelector.ts +26 -9
- package/types/index.d.ts +619 -325
- package/src/display/module/ILeafMask.ts +0 -12
package/src/event/IEvent.ts
CHANGED
|
@@ -3,8 +3,11 @@ import { IWatchEventData } from '../watcher/IWatcher'
|
|
|
3
3
|
import { ILayoutBlockData } from '../layouter/ILayouter'
|
|
4
4
|
import { ILeaf } from '../display/ILeaf'
|
|
5
5
|
import { IScreenSizeData, IPointData } from '../math/IMath'
|
|
6
|
+
import { IObject } from '../data/IData'
|
|
6
7
|
|
|
7
8
|
export interface IEvent {
|
|
9
|
+
origin?: IObject
|
|
10
|
+
|
|
8
11
|
type?: string
|
|
9
12
|
target?: IEventTarget
|
|
10
13
|
current?: IEventTarget
|
|
@@ -75,29 +78,6 @@ export interface IWatchEvent extends IEvent {
|
|
|
75
78
|
readonly data: IWatchEventData
|
|
76
79
|
}
|
|
77
80
|
|
|
78
|
-
export interface ITransformEventData {
|
|
79
|
-
x: number
|
|
80
|
-
y: number
|
|
81
|
-
scaleX: number
|
|
82
|
-
scaleY: number
|
|
83
|
-
rotation: number
|
|
84
|
-
|
|
85
|
-
readonly zooming: boolean
|
|
86
|
-
readonly moving: boolean
|
|
87
|
-
readonly rotating: boolean
|
|
88
|
-
readonly changing: boolean
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export interface ITransformEvent extends IEvent, ITransformEventData {
|
|
92
|
-
readonly x: number
|
|
93
|
-
readonly y: number
|
|
94
|
-
readonly scaleX: number
|
|
95
|
-
readonly scaleY: number
|
|
96
|
-
readonly rotation: number
|
|
97
|
-
}
|
|
98
|
-
export type TransformMode = 'move' | 'zoom' | 'rotate'
|
|
99
|
-
|
|
100
|
-
|
|
101
81
|
export interface IMultiTouchData {
|
|
102
82
|
move: IPointData,
|
|
103
83
|
scale: number,
|
package/src/event/IEventer.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import { IEvent, IFunction, IObject } from '@leafer/interface'
|
|
2
1
|
import { ILeafEventer } from '../display/module/ILeafEventer'
|
|
2
|
+
import { ILeaf } from '../display/ILeaf'
|
|
3
|
+
import { IFunction } from '../function/IFunction'
|
|
4
|
+
import { IEvent } from './IEvent'
|
|
5
|
+
import { IObject } from '../data/IData'
|
|
6
|
+
|
|
3
7
|
|
|
4
8
|
export type IEventListener = IFunction
|
|
5
9
|
|
|
@@ -18,6 +22,7 @@ export interface IEventListenerMap {
|
|
|
18
22
|
|
|
19
23
|
export interface IEventListenerId {
|
|
20
24
|
type: string | string[]
|
|
25
|
+
current: ILeaf
|
|
21
26
|
listener: IEventListener
|
|
22
27
|
options?: IEventListenerOptions | boolean
|
|
23
28
|
}
|
package/src/event/IUIEvent.ts
CHANGED
|
@@ -23,10 +23,9 @@ export interface IUIEvent extends IEvent {
|
|
|
23
23
|
path?: ILeafList
|
|
24
24
|
throughPath?: ILeafList // 穿透path,不受层级影响,从上到下只要碰撞到区域就算,一般点击的时候
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
getLocal?(target?: ILeaf): IPointData
|
|
26
|
+
getPage?(): IPointData
|
|
27
|
+
getInner?(relative?: ILeaf): IPointData
|
|
28
|
+
getLocal?(relative?: ILeaf): IPointData
|
|
30
29
|
}
|
|
31
30
|
|
|
32
31
|
|
|
@@ -39,6 +38,7 @@ export interface IPointerEvent extends IUIEvent {
|
|
|
39
38
|
tiltX?: number
|
|
40
39
|
tiltY?: number
|
|
41
40
|
twist?: number
|
|
41
|
+
isCancel?: boolean
|
|
42
42
|
}
|
|
43
43
|
export type PointerType = 'mouse' | 'pen' | 'touch'
|
|
44
44
|
|
|
@@ -48,10 +48,13 @@ export interface IDragEvent extends IPointerEvent {
|
|
|
48
48
|
totalX?: number
|
|
49
49
|
totalY?: number
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
getPageMove?(total?: boolean): IPointData
|
|
52
|
+
getInnerMove?(relative?: ILeaf): IPointData
|
|
53
|
+
getLocalMove?(relative?: ILeaf): IPointData
|
|
54
|
+
|
|
55
|
+
getPageTotal?(): IPointData
|
|
56
|
+
getInnerTotal?(relative?: ILeaf): IPointData
|
|
57
|
+
getLocalTotal?(relative?: ILeaf): IPointData
|
|
55
58
|
}
|
|
56
59
|
|
|
57
60
|
export interface IDropEvent extends IPointerEvent {
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { IBlob, ILeaferCanvas } from '../canvas/ILeaferCanvas'
|
|
2
|
+
import { ILeaf } from '../display/ILeaf'
|
|
3
|
+
import { ILocationType } from '../layout/ILeafLayout'
|
|
4
|
+
import { IBoundsData } from '../math/IMath'
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export interface IExportOptions {
|
|
8
|
+
quality?: number
|
|
9
|
+
blob?: boolean
|
|
10
|
+
scale?: number
|
|
11
|
+
pixelRatio?: number
|
|
12
|
+
slice?: boolean
|
|
13
|
+
trim?: boolean
|
|
14
|
+
fill?: string
|
|
15
|
+
screenshot?: IBoundsData | boolean
|
|
16
|
+
relative?: ILocationType | ILeaf
|
|
17
|
+
onCanvas?: IExportOnCanvasFunction
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface IExportResult {
|
|
21
|
+
data: ILeaferCanvas | IBlob | string | boolean
|
|
22
|
+
width?: number
|
|
23
|
+
height?: number
|
|
24
|
+
renderBounds?: IBoundsData
|
|
25
|
+
trimBounds?: IBoundsData
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface IExportResultFunction {
|
|
29
|
+
(data: IExportResult): void
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface IExportOnCanvasFunction {
|
|
33
|
+
(data: ILeaferCanvas): void
|
|
34
|
+
}
|
package/src/file/IFileType.ts
CHANGED
|
@@ -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'
|
|
@@ -10,4 +10,13 @@ export interface INumberFunction {
|
|
|
10
10
|
|
|
11
11
|
export interface IPointDataFunction {
|
|
12
12
|
(...arg: any): IPointData
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
export interface IAttrDecorator {
|
|
17
|
+
(...arg: any): IAttrDecoratorInner
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface IAttrDecoratorInner {
|
|
21
|
+
(target: any, key: string): any
|
|
13
22
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ILeaferImage, ILeaferImageConfig } from './ILeaferImage'
|
|
2
2
|
import { ITaskProcessor } from '../task/ITaskProcessor'
|
|
3
|
+
import { IExportFileType } from '../file/IFileType'
|
|
3
4
|
|
|
4
5
|
interface ILeaferImageMap {
|
|
5
6
|
[name: string]: ILeaferImage
|
|
@@ -10,9 +11,12 @@ export interface IImageManager {
|
|
|
10
11
|
recycledList: ILeaferImage[]
|
|
11
12
|
tasker: ITaskProcessor
|
|
12
13
|
patternTasker: ITaskProcessor
|
|
14
|
+
patternLocked?: boolean // 锁定pattern不更新, 一般用于创建碰撞位图 UIHit.ts
|
|
13
15
|
readonly isComplete: boolean
|
|
14
16
|
get(config: ILeaferImageConfig): ILeaferImage
|
|
15
17
|
recycle(image: ILeaferImage): void
|
|
16
18
|
clearRecycled(): void
|
|
19
|
+
hasOpacityPixel(config: ILeaferImageConfig): boolean // png / svg / webp
|
|
20
|
+
isFormat(format: IExportFileType, config: ILeaferImageConfig): boolean
|
|
17
21
|
destroy(): void
|
|
18
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,12 +1,12 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export { ILeaf, ILeafAttrData, ILeafComputedData, ILeafInputData, ICachedLeaf, IHitType, IBlendMode,
|
|
1
|
+
export { IAppBase } from './app/IApp'
|
|
2
|
+
export { ILeaferBase, ILeaferAttrData, ILeaferType, ILeaferTypeCreator, ILeaferTypeFunction, ILeaferTypeList, ILeaferConfig, ICreator, IUICreator, IZoomType } from './app/ILeafer'
|
|
3
|
+
export { ILeaf, ILeafAttrData, ILeafComputedData, ILeafInputData, ICachedLeaf, IHitType, IMaskType, IBlendMode, IEditSize, IImageCursor, ICursorType, IStateStyleType, IAround, ILeafAttrDescriptor, ILeafAttrDescriptorFn } from './display/ILeaf'
|
|
4
4
|
export { IBranch } from './display/IBranch'
|
|
5
5
|
export { IZoomView } from './display/IView'
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
export { ILeafData, IDataProcessor } from './data/ILeafData'
|
|
9
|
-
export { ILeafLayout,
|
|
8
|
+
export { ILeafData, IDataProcessor, ILeafDataOptions } from './data/ILeafData'
|
|
9
|
+
export { ILeafLayout, ILocationType, IBoundsType } from './layout/ILeafLayout'
|
|
10
10
|
|
|
11
11
|
export { ILeafDataProxy, ILeafDataProxyModule } from './display/module/ILeafDataProxy'
|
|
12
12
|
export { ILeafMatrix, ILeafMatrixModule } from './display/module/ILeafMatrix'
|
|
@@ -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,
|
|
22
|
+
export { ISelector, ISelectorConfig, ISelectorProxy, IFindMethod, IPickResult, IPickOptions, 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'
|
|
38
|
-
export { ISkiaCanvas, ISkiaCanvasExportConfig, ICanvasType } from './canvas/ISkiaCanvas'
|
|
36
|
+
export { ILeaferCanvas, ILeaferCanvasView, IHitCanvas, ICanvasAttr, ICanvasStrokeOptions, ICanvasCacheOptions, ILeaferCanvasConfig, IHitCanvasConfig, IBlobFunction, IBlob } from './canvas/ILeaferCanvas'
|
|
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, IExportResult, IExportResultFunction, IExportOnCanvasFunction } from './file/IExport'
|
|
45
45
|
|
|
46
46
|
export { InnerId, IEventer, IEventListener, IEventListenerOptions, IEventListenerMap, IEventListenerItem, IEventListenerId } from './event/IEventer'
|
|
47
|
-
export { IEventTarget, IEvent, ILeaferEvent, IPropertyEvent, ILayoutEvent, IRenderEvent, IAnimateEvent, IChildEvent, IResizeEvent, IResizeEventListener, IUpdateEvent, IWatchEvent,
|
|
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 {
|
|
53
|
+
export { INumber, IBoolean, IString, IValue, IFourNumber, IPathString, ITimer, IObject, INumberMap, IStringMap, IBooleanMap, 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,
|
|
55
|
-
export { IFunction } from './function/IFunction'
|
|
55
|
+
export { IPoint, IPointData, IRadiusPointData, ISize, ISizeData, IScreenSizeData, IBounds, IBoundsData, IBoundsDataFn, IOffsetBoundsData, ITwoPointBoundsData, IAutoBounds, IAutoBoundsData, IMatrix, IMatrixData, IMatrixWithBoundsData, IMatrixWithScaleData, IMatrixWithOptionScaleData, IMatrixWithBoundsScaleData, IMatrixWithLayoutData, IScaleRotationData, IScaleData, ISkewData, ILayoutBoundsData, ILayoutData, ILayoutAttr } from './math/IMath'
|
|
56
|
+
export { IFunction, 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
|
+
}
|
|
@@ -3,7 +3,7 @@ import { IPointerEvent, IMoveEvent, IZoomEvent, IRotateEvent, IUIEvent, IKeyEven
|
|
|
3
3
|
import { ILeaf, ICursorType } from '../display/ILeaf'
|
|
4
4
|
import { ILeafList } from '../data/IList'
|
|
5
5
|
import { IPointData } from '../math/IMath'
|
|
6
|
-
import { ISelector,
|
|
6
|
+
import { ISelector, IPickOptions } from '../selector/ISelector'
|
|
7
7
|
import { IBounds } from '../math/IMath'
|
|
8
8
|
import { IControl } from '../control/IControl'
|
|
9
9
|
import { IKeepTouchData } from '../event/IEvent'
|
|
@@ -17,6 +17,8 @@ export interface IInteraction extends IControl {
|
|
|
17
17
|
|
|
18
18
|
running: boolean
|
|
19
19
|
readonly dragging: boolean
|
|
20
|
+
readonly isDragEmpty: boolean
|
|
21
|
+
readonly isHoldRightKey: boolean
|
|
20
22
|
readonly moveMode: boolean
|
|
21
23
|
|
|
22
24
|
config: IInteractionConfig
|
|
@@ -29,6 +31,7 @@ export interface IInteraction extends IControl {
|
|
|
29
31
|
downData: IPointerEvent
|
|
30
32
|
hoverData: IPointerEvent
|
|
31
33
|
downTime: number
|
|
34
|
+
focusData: ILeaf
|
|
32
35
|
|
|
33
36
|
receive(event: any): void
|
|
34
37
|
|
|
@@ -47,11 +50,23 @@ export interface IInteraction extends IControl {
|
|
|
47
50
|
keyDown(data: IKeyEvent): void
|
|
48
51
|
keyUp(data: IKeyEvent): void
|
|
49
52
|
|
|
50
|
-
findPath(data: IPointerEvent, options?:
|
|
53
|
+
findPath(data: IPointerEvent, options?: IPickOptions): ILeafList
|
|
54
|
+
isRootPath(data: IPointerEvent): boolean
|
|
55
|
+
isTreePath(data: IPointerEvent): boolean
|
|
56
|
+
canMove(data: IPointerEvent): boolean
|
|
51
57
|
|
|
52
|
-
|
|
58
|
+
isDrag(leaf: ILeaf): boolean
|
|
59
|
+
isPress(leaf: ILeaf): boolean
|
|
60
|
+
isHover(leaf: ILeaf): boolean
|
|
61
|
+
isFocus(leaf: ILeaf): boolean
|
|
62
|
+
|
|
63
|
+
cancelHover(): void
|
|
64
|
+
|
|
65
|
+
updateDownData(data?: IPointerEvent, options?: IPickOptions, merge?: boolean): void
|
|
53
66
|
updateHoverData(data: IPointerEvent): void
|
|
67
|
+
|
|
54
68
|
updateCursor(hoverData?: IPointerEvent): void
|
|
69
|
+
setCursor(cursor: ICursorType | ICursorType[]): void
|
|
55
70
|
|
|
56
71
|
emit(type: string, data: IUIEvent, path?: ILeafList, excludePath?: ILeafList): void
|
|
57
72
|
}
|
|
@@ -63,25 +78,33 @@ export interface IInteractionCanvas extends ILeaferCanvas {
|
|
|
63
78
|
export interface IInteractionConfig {
|
|
64
79
|
wheel?: IWheelConfig
|
|
65
80
|
pointer?: IPointerConfig
|
|
81
|
+
cursor?: ICursorConfig
|
|
66
82
|
zoom?: IZoomConfig
|
|
67
83
|
move?: IMoveConfig
|
|
68
84
|
eventer?: IObject
|
|
69
85
|
}
|
|
70
86
|
|
|
71
87
|
export interface IZoomConfig {
|
|
88
|
+
disabled?: boolean
|
|
72
89
|
min?: number
|
|
73
90
|
max?: number
|
|
74
91
|
}
|
|
75
92
|
|
|
76
93
|
export interface IMoveConfig {
|
|
94
|
+
disabled?: boolean
|
|
77
95
|
holdSpaceKey?: boolean
|
|
96
|
+
holdMiddleKey?: boolean
|
|
97
|
+
holdRightKey?: boolean
|
|
98
|
+
scroll?: boolean | 'limit'
|
|
99
|
+
drag?: boolean
|
|
100
|
+
dragAnimate?: boolean
|
|
78
101
|
dragEmpty?: boolean
|
|
79
102
|
dragOut?: boolean
|
|
80
103
|
autoDistance?: number
|
|
81
104
|
}
|
|
82
105
|
|
|
83
106
|
export interface IWheelConfig {
|
|
84
|
-
zoomMode?: boolean
|
|
107
|
+
zoomMode?: boolean | 'mouse'
|
|
85
108
|
zoomSpeed?: number // 取值范围 0 ~ 1, 默认0.5
|
|
86
109
|
moveSpeed?: number
|
|
87
110
|
rotateSpeed?: number // 取值范围 0 ~ 1, 默认0.5
|
|
@@ -98,9 +121,15 @@ export interface IPointerConfig {
|
|
|
98
121
|
tapTime?: number
|
|
99
122
|
longPressTime?: number
|
|
100
123
|
transformTime?: number
|
|
124
|
+
hover?: boolean
|
|
101
125
|
dragHover?: boolean
|
|
102
126
|
dragDistance?: number
|
|
103
127
|
swipeDistance?: number
|
|
104
128
|
ignoreMove?: boolean // 性能优化字段, 控制move事件触发次数
|
|
105
129
|
preventDefault?: boolean
|
|
130
|
+
preventDefaultMenu?: boolean
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export interface ICursorConfig {
|
|
134
|
+
stop?: boolean
|
|
106
135
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { IBoundsData, IMatrixData } from '../math/IMath'
|
|
1
|
+
import { IBoundsData, IMatrixData, ILayoutBoundsData, IPointData } from '../math/IMath'
|
|
2
2
|
import { ILeaf } from '../display/ILeaf'
|
|
3
3
|
|
|
4
|
-
export type
|
|
5
|
-
export type
|
|
4
|
+
export type ILocationType = 'world' | 'page' | 'local' | 'inner'
|
|
5
|
+
export type IBoundsType = 'content' | 'box' | 'stroke' | 'margin' | 'render'
|
|
6
6
|
|
|
7
7
|
export interface ILeafLayout {
|
|
8
8
|
|
|
9
9
|
leaf: ILeaf
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
proxyZoom: boolean
|
|
12
12
|
|
|
13
13
|
// inner
|
|
14
14
|
|
|
@@ -23,17 +23,17 @@ export interface ILeafLayout {
|
|
|
23
23
|
// local
|
|
24
24
|
|
|
25
25
|
//localBoxBounds: IBoundsData = leaf.__local
|
|
26
|
-
localStrokeBounds
|
|
27
|
-
localRenderBounds
|
|
26
|
+
localStrokeBounds?: IBoundsData
|
|
27
|
+
localRenderBounds?: IBoundsData
|
|
28
28
|
|
|
29
29
|
// state
|
|
30
|
+
resized: boolean
|
|
31
|
+
waitAutoLayout: boolean
|
|
30
32
|
|
|
31
33
|
// matrix changed
|
|
32
34
|
matrixChanged: boolean // include positionChanged scaleChanged skewChanged
|
|
33
|
-
positionChanged: boolean // x, y
|
|
34
|
-
originChanged?: boolean // originX originY
|
|
35
35
|
scaleChanged: boolean // scaleX scaleY
|
|
36
|
-
rotationChanged: boolean // rotaiton, skewX
|
|
36
|
+
rotationChanged: boolean // rotaiton, skewX skewY 数据更新
|
|
37
37
|
|
|
38
38
|
// bounds changed
|
|
39
39
|
boundsChanged: boolean
|
|
@@ -58,14 +58,30 @@ export interface ILeafLayout {
|
|
|
58
58
|
affectChildrenSort?: boolean
|
|
59
59
|
|
|
60
60
|
strokeSpread: number
|
|
61
|
-
renderSpread: number
|
|
61
|
+
renderSpread: number // -1 表示监视变化,不影响实际renderBounds,目前用在Box上
|
|
62
62
|
strokeBoxSpread: number
|
|
63
63
|
renderShapeSpread: number
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
// temp local
|
|
66
|
+
a: number
|
|
67
|
+
b: number
|
|
68
|
+
c: number
|
|
69
|
+
d: number
|
|
70
|
+
e: number
|
|
71
|
+
f: number
|
|
72
|
+
x: number
|
|
73
|
+
y: number
|
|
74
|
+
width: number
|
|
75
|
+
height: number
|
|
66
76
|
|
|
67
|
-
|
|
68
|
-
|
|
77
|
+
createLocal(): void
|
|
78
|
+
|
|
79
|
+
update(): void
|
|
80
|
+
|
|
81
|
+
getTransform(relative?: ILocationType | ILeaf): IMatrixData
|
|
82
|
+
getBounds(type?: IBoundsType, relative?: ILocationType | ILeaf): IBoundsData
|
|
83
|
+
getLayoutBounds(type?: IBoundsType, relative?: ILocationType | ILeaf, unscale?: boolean): ILayoutBoundsData
|
|
84
|
+
getLayoutPoints(type?: IBoundsType, relative?: ILocationType | ILeaf): IPointData[]
|
|
69
85
|
|
|
70
86
|
// 独立 / 引用 boxBounds
|
|
71
87
|
spreadStroke(): void
|
|
@@ -80,9 +96,9 @@ export interface ILeafLayout {
|
|
|
80
96
|
renderChange(): void
|
|
81
97
|
|
|
82
98
|
// matrix
|
|
83
|
-
positionChange(): void
|
|
84
99
|
scaleChange(): void
|
|
85
100
|
rotationChange(): void
|
|
101
|
+
matrixChange(): void
|
|
86
102
|
|
|
87
103
|
// face
|
|
88
104
|
surfaceChange(): void
|
|
@@ -34,6 +34,7 @@ export interface ILayouterConfig {
|
|
|
34
34
|
export interface ILayouter extends IControl {
|
|
35
35
|
target: ILeaf
|
|
36
36
|
layoutedBlocks: ILayoutBlockData[]
|
|
37
|
+
extraBlock: ILayoutBlockData
|
|
37
38
|
|
|
38
39
|
totalTimes: number
|
|
39
40
|
times: number
|
|
@@ -54,6 +55,8 @@ export interface ILayouter extends IControl {
|
|
|
54
55
|
partLayout(): void
|
|
55
56
|
fullLayout(): void
|
|
56
57
|
|
|
58
|
+
addExtra(leaf: ILeaf): void
|
|
59
|
+
|
|
57
60
|
createBlock(data: ILeafList | ILeaf[]): ILayoutBlockData
|
|
58
61
|
getBlocks(list: ILeafList): ILayoutBlockData[]
|
|
59
62
|
addBlocks(current: ILayoutBlockData[]): void
|