@leafer/interface 1.0.0-rc.3 → 1.0.0-rc.30
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 +46 -21
- package/src/canvas/ICanvas.ts +7 -2
- package/src/canvas/IHitCanvasManager.ts +3 -3
- package/src/canvas/ILeaferCanvas.ts +23 -11
- package/src/canvas/ISkiaCanvas.ts +20 -1
- package/src/data/IData.ts +12 -5
- package/src/data/ILeafData.ts +12 -6
- package/src/data/IList.ts +9 -6
- package/src/display/IBranch.ts +2 -1
- package/src/display/ILeaf.ts +452 -108
- package/src/display/IView.ts +2 -6
- package/src/display/module/IBranchRender.ts +2 -2
- package/src/display/module/ILeafBounds.ts +3 -0
- package/src/display/module/ILeafDataProxy.ts +5 -3
- package/src/display/module/ILeafEventer.ts +1 -1
- 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 +7 -2
- package/src/event/IUIEvent.ts +14 -9
- package/src/file/IExport.ts +41 -0
- package/src/file/IFileType.ts +1 -1
- package/src/function/IFunction.ts +18 -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 +40 -5
- package/src/layout/ILeafLayout.ts +41 -18
- package/src/layouter/ILayouter.ts +3 -0
- package/src/math/IMath.ts +98 -37
- package/src/path/IPathDrawer.ts +6 -3
- package/src/platform/IPlatform.ts +22 -4
- package/src/plugin/IPlugin.ts +2 -2
- package/src/renderer/IRenderer.ts +4 -2
- package/src/selector/ISelector.ts +38 -9
- package/types/index.d.ts +884 -418
- package/src/display/module/ILeafMask.ts +0 -12
package/src/display/IView.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { IBranch } from './IBranch'
|
|
2
|
-
|
|
3
|
-
import { ITransformEventData } from '../event/IEvent'
|
|
2
|
+
|
|
4
3
|
|
|
5
4
|
export interface IZoomView extends IBranch {
|
|
6
|
-
|
|
7
|
-
moveLayer?: ILeaf
|
|
8
|
-
transformData?: ITransformEventData
|
|
9
|
-
setZoomLayer(zoomLayer: ILeaf, moveLayer?: ILeaf): void
|
|
5
|
+
|
|
10
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
|
|
|
@@ -4,6 +4,7 @@ export type ILeafBoundsModule = ILeafBounds & ThisType<ILeaf>
|
|
|
4
4
|
|
|
5
5
|
export interface ILeafBounds {
|
|
6
6
|
__updateWorldBounds?(): void
|
|
7
|
+
__updateLocalBounds?(): void
|
|
7
8
|
|
|
8
9
|
__updateLocalBoxBounds?(): void
|
|
9
10
|
__updateLocalStrokeBounds?(): void
|
|
@@ -13,6 +14,8 @@ export interface ILeafBounds {
|
|
|
13
14
|
__updateStrokeBounds?(): void
|
|
14
15
|
__updateRenderBounds?(): void
|
|
15
16
|
|
|
17
|
+
__updateAutoLayout?(): void
|
|
18
|
+
__updateFlowLayout?(): void
|
|
16
19
|
__updateNaturalSize?(): void
|
|
17
20
|
|
|
18
21
|
__updateStrokeSpread?(): number
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { ILeaf } from '../ILeaf'
|
|
2
|
-
import {
|
|
2
|
+
import { IValue } from '../../data/IData'
|
|
3
3
|
|
|
4
4
|
export type ILeafDataProxyModule = ILeafDataProxy & ThisType<ILeaf>
|
|
5
5
|
|
|
6
6
|
export interface ILeafDataProxy {
|
|
7
|
-
__setAttr?(name: string, newValue:
|
|
8
|
-
__getAttr?(name: string):
|
|
7
|
+
__setAttr?(name: string, newValue: IValue): boolean
|
|
8
|
+
__getAttr?(name: string): IValue
|
|
9
|
+
setProxyAttr?(name: string, newValue: IValue): void
|
|
10
|
+
getProxyAttr?(name: string): IValue
|
|
9
11
|
}
|
|
10
12
|
|
|
@@ -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
|
|
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?(
|
|
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
|
-
|
|
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
|
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
|
}
|
|
@@ -31,7 +36,7 @@ export interface IEventer extends ILeafEventer {
|
|
|
31
36
|
__bubbleMap?: IEventListenerMap
|
|
32
37
|
|
|
33
38
|
on(type: string | string[], listener: IEventListener, options?: IEventListenerOptions | boolean): void
|
|
34
|
-
off(type
|
|
39
|
+
off(type?: string | string[], listener?: IEventListener, options?: IEventListenerOptions | boolean): void
|
|
35
40
|
on_(type: string | string[], listener: IEventListener, bind?: IObject, options?: IEventListenerOptions | boolean): IEventListenerId
|
|
36
41
|
off_(id: IEventListenerId | IEventListenerId[]): void
|
|
37
42
|
once(type: string | string[], listener: IEventListener): void
|
package/src/event/IUIEvent.ts
CHANGED
|
@@ -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,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,15 @@ 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
|
|
58
|
+
|
|
59
|
+
getPageBounds?(): IBoundsData
|
|
55
60
|
}
|
|
56
61
|
|
|
57
62
|
export interface IDropEvent extends IPointerEvent {
|
|
@@ -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
|
+
}
|
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'
|
|
@@ -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,23 @@ 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
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
export interface IAttrDecorator {
|
|
26
|
+
(...arg: any): IAttrDecoratorInner
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface IAttrDecoratorInner {
|
|
30
|
+
(target: any, key: string): any
|
|
13
31
|
}
|
|
@@ -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, IFlowType, IFlowBoxType, IAlign, IAxisAlign, IFlowAlign, IFlowAxisAlign, IAxis, IGap, IPointGap, IAxisReverse, IBaseLineAlign, IFlowWrap, IAutoSize, IRangeSize, IPercentData, IUnitData, IConstraint, IConstraintType, IHitType, IMaskType, IEraserType, IBlendMode, IEditSize, IImageCursor, ICursorType, IStateStyleType, IDirection, IAround, ILeafAttrDescriptor, ILeafAttrDescriptorFn } from './display/ILeaf'
|
|
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, 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'
|
|
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, IJSONOptions, 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, 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,
|
|
55
|
-
export { IFunction } 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,
|
|
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'
|
|
@@ -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
|
|
@@ -24,11 +26,14 @@ export interface IInteraction extends IControl {
|
|
|
24
26
|
cursor: ICursorType | ICursorType[]
|
|
25
27
|
readonly hitRadius: number
|
|
26
28
|
|
|
29
|
+
bottomList?: IPickBottom[] // 底部可拾取的虚拟元素
|
|
30
|
+
|
|
27
31
|
shrinkCanvasBounds: IBounds
|
|
28
32
|
|
|
29
33
|
downData: IPointerEvent
|
|
30
34
|
hoverData: IPointerEvent
|
|
31
35
|
downTime: number
|
|
36
|
+
focusData: ILeaf
|
|
32
37
|
|
|
33
38
|
receive(event: any): void
|
|
34
39
|
|
|
@@ -47,11 +52,25 @@ export interface IInteraction extends IControl {
|
|
|
47
52
|
keyDown(data: IKeyEvent): void
|
|
48
53
|
keyUp(data: IKeyEvent): void
|
|
49
54
|
|
|
50
|
-
findPath(data: IPointerEvent, options?:
|
|
55
|
+
findPath(data: IPointerEvent, options?: IPickOptions): ILeafList
|
|
56
|
+
isRootPath(data: IPointerEvent): boolean
|
|
57
|
+
isTreePath(data: IPointerEvent): boolean
|
|
58
|
+
canMove(data: IPointerEvent): boolean
|
|
59
|
+
|
|
60
|
+
isDrag(leaf: ILeaf): boolean
|
|
61
|
+
isPress(leaf: ILeaf): boolean
|
|
62
|
+
isHover(leaf: ILeaf): boolean
|
|
63
|
+
isFocus(leaf: ILeaf): boolean
|
|
51
64
|
|
|
52
|
-
|
|
65
|
+
cancelHover(): void
|
|
66
|
+
|
|
67
|
+
updateDownData(data?: IPointerEvent, options?: IPickOptions, merge?: boolean): void
|
|
53
68
|
updateHoverData(data: IPointerEvent): void
|
|
69
|
+
|
|
54
70
|
updateCursor(hoverData?: IPointerEvent): void
|
|
71
|
+
setCursor(cursor: ICursorType | ICursorType[]): void
|
|
72
|
+
|
|
73
|
+
getLocal(clientPoint: IClientPointData, updateClient?: boolean): IPointData
|
|
55
74
|
|
|
56
75
|
emit(type: string, data: IUIEvent, path?: ILeafList, excludePath?: ILeafList): void
|
|
57
76
|
}
|
|
@@ -66,22 +85,32 @@ export interface IInteractionConfig {
|
|
|
66
85
|
zoom?: IZoomConfig
|
|
67
86
|
move?: IMoveConfig
|
|
68
87
|
eventer?: IObject
|
|
88
|
+
cursor?: boolean
|
|
89
|
+
keyEvent?: boolean
|
|
69
90
|
}
|
|
70
91
|
|
|
71
92
|
export interface IZoomConfig {
|
|
93
|
+
disabled?: boolean
|
|
72
94
|
min?: number
|
|
73
95
|
max?: number
|
|
74
96
|
}
|
|
75
97
|
|
|
76
98
|
export interface IMoveConfig {
|
|
99
|
+
disabled?: boolean
|
|
77
100
|
holdSpaceKey?: boolean
|
|
101
|
+
holdMiddleKey?: boolean
|
|
102
|
+
holdRightKey?: boolean
|
|
103
|
+
scroll?: boolean | 'limit'
|
|
104
|
+
drag?: boolean
|
|
105
|
+
dragAnimate?: boolean
|
|
78
106
|
dragEmpty?: boolean
|
|
79
107
|
dragOut?: boolean
|
|
80
108
|
autoDistance?: number
|
|
81
109
|
}
|
|
82
110
|
|
|
83
111
|
export interface IWheelConfig {
|
|
84
|
-
|
|
112
|
+
disabled?: boolean
|
|
113
|
+
zoomMode?: boolean | 'mouse'
|
|
85
114
|
zoomSpeed?: number // 取值范围 0 ~ 1, 默认0.5
|
|
86
115
|
moveSpeed?: number
|
|
87
116
|
rotateSpeed?: number // 取值范围 0 ~ 1, 默认0.5
|
|
@@ -98,9 +127,15 @@ export interface IPointerConfig {
|
|
|
98
127
|
tapTime?: number
|
|
99
128
|
longPressTime?: number
|
|
100
129
|
transformTime?: number
|
|
130
|
+
hover?: boolean
|
|
101
131
|
dragHover?: boolean
|
|
102
132
|
dragDistance?: number
|
|
103
133
|
swipeDistance?: number
|
|
104
134
|
ignoreMove?: boolean // 性能优化字段, 控制move事件触发次数
|
|
105
135
|
preventDefault?: boolean
|
|
136
|
+
preventDefaultMenu?: boolean
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export interface ICursorConfig {
|
|
140
|
+
stop?: boolean
|
|
106
141
|
}
|
|
@@ -1,39 +1,44 @@
|
|
|
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' | '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
|
|
|
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
|
-
|
|
22
|
+
localContentBounds: IBoundsData
|
|
23
|
+
// localBoxBounds: IBoundsData // use leaf.__localBoxBounds
|
|
26
24
|
localStrokeBounds: IBoundsData
|
|
27
25
|
localRenderBounds: IBoundsData
|
|
28
26
|
|
|
27
|
+
// world
|
|
28
|
+
|
|
29
|
+
worldContentBounds: IBoundsData
|
|
30
|
+
worldBoxBounds: IBoundsData
|
|
31
|
+
worldStrokeBounds: IBoundsData
|
|
32
|
+
// worldRenderBounds: IBoundsData // use leaf.__world
|
|
33
|
+
|
|
29
34
|
// state
|
|
35
|
+
resized: boolean
|
|
36
|
+
waitAutoLayout: boolean
|
|
30
37
|
|
|
31
38
|
// matrix changed
|
|
32
39
|
matrixChanged: boolean // include positionChanged scaleChanged skewChanged
|
|
33
|
-
positionChanged: boolean // x, y
|
|
34
|
-
originChanged?: boolean // originX originY
|
|
35
40
|
scaleChanged: boolean // scaleX scaleY
|
|
36
|
-
rotationChanged: boolean // rotaiton, skewX
|
|
41
|
+
rotationChanged: boolean // rotaiton, skewX skewY 数据更新
|
|
37
42
|
|
|
38
43
|
// bounds changed
|
|
39
44
|
boundsChanged: boolean
|
|
@@ -58,18 +63,36 @@ export interface ILeafLayout {
|
|
|
58
63
|
affectChildrenSort?: boolean
|
|
59
64
|
|
|
60
65
|
strokeSpread: number
|
|
61
|
-
|
|
62
|
-
|
|
66
|
+
strokeBoxSpread: number // 用于生成strokeBounds
|
|
67
|
+
renderSpread: number // -1 表示需监视变化,不影响实际renderBounds,目前用在Box上
|
|
63
68
|
renderShapeSpread: number
|
|
64
69
|
|
|
65
|
-
|
|
70
|
+
// temp local
|
|
71
|
+
a: number
|
|
72
|
+
b: number
|
|
73
|
+
c: number
|
|
74
|
+
d: number
|
|
75
|
+
e: number
|
|
76
|
+
f: number
|
|
77
|
+
x: number
|
|
78
|
+
y: number
|
|
79
|
+
width: number
|
|
80
|
+
height: number
|
|
81
|
+
|
|
82
|
+
createLocal(): void
|
|
83
|
+
|
|
84
|
+
update(): void
|
|
66
85
|
|
|
67
|
-
getTransform(
|
|
68
|
-
getBounds(type
|
|
86
|
+
getTransform(relative?: ILocationType | ILeaf): IMatrixData
|
|
87
|
+
getBounds(type?: IBoundsType, relative?: ILocationType | ILeaf): IBoundsData
|
|
88
|
+
getLayoutBounds(type?: IBoundsType, relative?: ILocationType | ILeaf, unscale?: boolean): ILayoutBoundsData
|
|
89
|
+
getLayoutPoints(type?: IBoundsType, relative?: ILocationType | ILeaf): IPointData[]
|
|
69
90
|
|
|
70
91
|
// 独立 / 引用 boxBounds
|
|
92
|
+
shrinkContent(): void
|
|
71
93
|
spreadStroke(): void
|
|
72
94
|
spreadRender(): void
|
|
95
|
+
shrinkContentCancel(): void
|
|
73
96
|
spreadStrokeCancel(): void
|
|
74
97
|
spreadRenderCancel(): void
|
|
75
98
|
|
|
@@ -80,9 +103,9 @@ export interface ILeafLayout {
|
|
|
80
103
|
renderChange(): void
|
|
81
104
|
|
|
82
105
|
// matrix
|
|
83
|
-
positionChange(): void
|
|
84
106
|
scaleChange(): void
|
|
85
107
|
rotationChange(): void
|
|
108
|
+
matrixChange(): void
|
|
86
109
|
|
|
87
110
|
// face
|
|
88
111
|
surfaceChange(): void
|