@leafer/interface 1.0.0-rc.1 → 1.0.0-rc.10
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 +34 -15
- package/src/canvas/ICanvas.ts +2 -0
- package/src/canvas/ILeaferCanvas.ts +8 -8
- package/src/canvas/ISkiaCanvas.ts +20 -1
- package/src/data/IData.ts +4 -5
- package/src/data/ILeafData.ts +7 -1
- package/src/data/IList.ts +9 -6
- package/src/display/IBranch.ts +2 -1
- package/src/display/ILeaf.ts +172 -86
- package/src/display/IView.ts +1 -4
- 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 +3 -1
- package/src/display/module/ILeafRender.ts +1 -0
- package/src/event/IEvent.ts +3 -23
- package/src/event/IEventer.ts +6 -1
- package/src/event/IUIEvent.ts +10 -8
- package/src/file/IExport.ts +24 -0
- package/src/file/IFileType.ts +1 -1
- package/src/function/IFunction.ts +9 -0
- package/src/image/IImageManager.ts +3 -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 +18 -4
- package/src/layout/ILeafLayout.ts +29 -13
- package/src/layouter/ILayouter.ts +3 -0
- package/src/math/IMath.ts +64 -32
- package/src/platform/IPlatform.ts +15 -2
- package/src/plugin/IPlugin.ts +2 -2
- package/src/renderer/IRenderer.ts +3 -2
- package/src/selector/ISelector.ts +26 -9
- package/types/index.d.ts +447 -260
- package/src/display/module/ILeafMask.ts +0 -12
|
@@ -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
|
|
@@ -14,5 +15,7 @@ export interface IImageManager {
|
|
|
14
15
|
get(config: ILeaferImageConfig): ILeaferImage
|
|
15
16
|
recycle(image: ILeaferImage): void
|
|
16
17
|
clearRecycled(): void
|
|
18
|
+
hasOpacityPixel(config: ILeaferImageConfig): boolean // png / svg / webp
|
|
19
|
+
isFormat(format: IExportFileType, config: ILeaferImageConfig): boolean
|
|
17
20
|
destroy(): void
|
|
18
21
|
}
|
|
@@ -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 } from './app/ILeafer'
|
|
3
|
+
export { ILeaf, ILeafAttrData, ILeafComputedData, ILeafInputData, ICachedLeaf, IHitType, IMaskType, IBlendMode, IEditSize, IImageCursor, ICursorType, IAround } 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, 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, 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 } 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, 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
|
|
@@ -47,11 +49,14 @@ export interface IInteraction extends IControl {
|
|
|
47
49
|
keyDown(data: IKeyEvent): void
|
|
48
50
|
keyUp(data: IKeyEvent): void
|
|
49
51
|
|
|
50
|
-
findPath(data: IPointerEvent, options?:
|
|
52
|
+
findPath(data: IPointerEvent, options?: IPickOptions): ILeafList
|
|
53
|
+
isDrag(leaf: ILeaf): boolean
|
|
51
54
|
|
|
52
|
-
updateDownData(data?: IPointerEvent): void
|
|
55
|
+
updateDownData(data?: IPointerEvent, options?: IPickOptions): void
|
|
53
56
|
updateHoverData(data: IPointerEvent): void
|
|
57
|
+
|
|
54
58
|
updateCursor(hoverData?: IPointerEvent): void
|
|
59
|
+
setCursor(cursor: ICursorType | ICursorType[]): void
|
|
55
60
|
|
|
56
61
|
emit(type: string, data: IUIEvent, path?: ILeafList, excludePath?: ILeafList): void
|
|
57
62
|
}
|
|
@@ -63,6 +68,7 @@ export interface IInteractionCanvas extends ILeaferCanvas {
|
|
|
63
68
|
export interface IInteractionConfig {
|
|
64
69
|
wheel?: IWheelConfig
|
|
65
70
|
pointer?: IPointerConfig
|
|
71
|
+
cursor?: ICursorConfig
|
|
66
72
|
zoom?: IZoomConfig
|
|
67
73
|
move?: IMoveConfig
|
|
68
74
|
eventer?: IObject
|
|
@@ -75,13 +81,16 @@ export interface IZoomConfig {
|
|
|
75
81
|
|
|
76
82
|
export interface IMoveConfig {
|
|
77
83
|
holdSpaceKey?: boolean
|
|
84
|
+
holdMiddleKey?: boolean
|
|
85
|
+
holdRightKey?: boolean
|
|
86
|
+
drag?: boolean
|
|
78
87
|
dragEmpty?: boolean
|
|
79
88
|
dragOut?: boolean
|
|
80
89
|
autoDistance?: number
|
|
81
90
|
}
|
|
82
91
|
|
|
83
92
|
export interface IWheelConfig {
|
|
84
|
-
zoomMode?: boolean
|
|
93
|
+
zoomMode?: boolean | 'mouse'
|
|
85
94
|
zoomSpeed?: number // 取值范围 0 ~ 1, 默认0.5
|
|
86
95
|
moveSpeed?: number
|
|
87
96
|
rotateSpeed?: number // 取值范围 0 ~ 1, 默认0.5
|
|
@@ -103,4 +112,9 @@ export interface IPointerConfig {
|
|
|
103
112
|
swipeDistance?: number
|
|
104
113
|
ignoreMove?: boolean // 性能优化字段, 控制move事件触发次数
|
|
105
114
|
preventDefault?: boolean
|
|
115
|
+
preventDefaultMenu?: boolean
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export interface ICursorConfig {
|
|
119
|
+
stop?: boolean
|
|
106
120
|
}
|
|
@@ -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' | '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
|
|
@@ -62,10 +62,26 @@ export interface ILeafLayout {
|
|
|
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
|
package/src/math/IMath.ts
CHANGED
|
@@ -6,21 +6,28 @@ export interface IPointData {
|
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
export interface IPoint extends IPointData {
|
|
9
|
-
set(x?: number, y?: number):
|
|
10
|
-
|
|
9
|
+
set(x?: number | IPointData, y?: number): IPoint
|
|
10
|
+
get(): IPointData
|
|
11
11
|
clone(): IPoint
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
move(x: number, y: number): IPoint
|
|
14
|
+
scale(scaleX: number, scaleY?: number): IPoint
|
|
15
|
+
scaleOf(origin: IPointData, scaleX: number, scaleY?: number): IPoint
|
|
16
|
+
rotate(rotation: number, origin?: IPointData): IPoint
|
|
17
|
+
rotateOf(origin: IPointData, rotation: number): IPoint
|
|
18
|
+
getRotation(origin: IPointData, to: IPointData, toOrigin?: IPointData): number
|
|
14
19
|
|
|
15
20
|
toInnerOf(matrix: IMatrixData, to?: IPointData): IPoint
|
|
16
21
|
toOuterOf(matrix: IMatrixData, to?: IPointData): IPoint
|
|
17
22
|
|
|
18
|
-
getCenter(to: IPointData):
|
|
23
|
+
getCenter(to: IPointData): IPoint
|
|
19
24
|
getDistance(to: IPointData): number
|
|
25
|
+
getDistancePoint(to: IPointData, distance: number): IPoint
|
|
26
|
+
|
|
20
27
|
getAngle(to: IPointData): number
|
|
21
28
|
getAtan2(to: IPointData): number
|
|
22
29
|
|
|
23
|
-
reset():
|
|
30
|
+
reset(): IPoint
|
|
24
31
|
}
|
|
25
32
|
|
|
26
33
|
export interface IRadiusPointData extends IPointData {
|
|
@@ -47,29 +54,35 @@ export interface IOffsetBoundsData extends IBoundsData {
|
|
|
47
54
|
offsetY: number
|
|
48
55
|
}
|
|
49
56
|
|
|
50
|
-
export interface
|
|
57
|
+
export interface IBoundsDataFn {
|
|
51
58
|
(target: any): IBoundsData
|
|
52
59
|
}
|
|
53
60
|
|
|
54
|
-
export interface IBounds extends IBoundsData {
|
|
55
|
-
set(x?: number, y?: number, width?: number, height?: number):
|
|
56
|
-
|
|
61
|
+
export interface IBounds extends IBoundsData, ITwoPointBoundsData {
|
|
62
|
+
set(x?: number | IBoundsData, y?: number, width?: number, height?: number): IBounds
|
|
63
|
+
get(): IBoundsData
|
|
57
64
|
clone(): IBounds
|
|
58
65
|
|
|
66
|
+
move(x: number, y: number): IBounds
|
|
59
67
|
scale(scaleX: number, scaleY?: number): IBounds
|
|
68
|
+
scaleOf(origin: IPointData, scaleX: number, scaleY?: number): IBounds
|
|
60
69
|
toOuterOf(matrix: IMatrixData, to?: IBoundsData): IBounds
|
|
70
|
+
toInnerOf(matrix: IMatrixData, to?: IBoundsData): IBounds
|
|
61
71
|
getFitMatrix(put: IBoundsData): IMatrix
|
|
62
72
|
|
|
63
|
-
spread(
|
|
73
|
+
spread(spreadX: number, spreadY?: number): IBounds
|
|
64
74
|
ceil(): IBounds
|
|
65
75
|
unsign(): IBounds
|
|
76
|
+
float(maxLength?: number): IBounds
|
|
66
77
|
|
|
67
78
|
add(bounds: IBoundsData): IBounds
|
|
68
|
-
addList(boundsList:
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
79
|
+
addList(boundsList: IBoundsData[]): IBounds
|
|
80
|
+
setList(boundsList: IBoundsData[]): IBounds
|
|
81
|
+
addListWithFn(list: IObject[], boundsDataHandle: IBoundsDataFn): IBounds
|
|
82
|
+
setListWithFn(list: IObject[], boundsDataHandle: IBoundsDataFn): IBounds
|
|
83
|
+
|
|
84
|
+
setPoints(points: IPointData[]): IBounds
|
|
85
|
+
getPoints(): IPointData[] // topLeft, topRight, bottomRight, bottomLeft
|
|
73
86
|
|
|
74
87
|
hitPoint(point: IPointData, pointMatrix?: IMatrixData): boolean
|
|
75
88
|
hitRadiusPoint(point: IRadiusPointData, pointMatrix?: IMatrixWithLayoutData): boolean
|
|
@@ -91,12 +104,6 @@ export interface ITwoPointBoundsData {
|
|
|
91
104
|
maxY: number
|
|
92
105
|
}
|
|
93
106
|
|
|
94
|
-
export interface ITwoPointBounds extends ITwoPointBoundsData {
|
|
95
|
-
addPoint(x: number, y: number): void
|
|
96
|
-
addBounds(x: number, y: number, width: number, height: number): void
|
|
97
|
-
add(pointBounds: ITwoPointBoundsData): void
|
|
98
|
-
}
|
|
99
|
-
|
|
100
107
|
|
|
101
108
|
export interface IAutoBoundsData {
|
|
102
109
|
top?: number
|
|
@@ -125,17 +132,24 @@ export interface IMatrixData {
|
|
|
125
132
|
f: number
|
|
126
133
|
}
|
|
127
134
|
|
|
128
|
-
export interface
|
|
129
|
-
x: number
|
|
130
|
-
y: number
|
|
135
|
+
export interface IScaleData {
|
|
131
136
|
scaleX: number
|
|
132
137
|
scaleY: number
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export interface IScaleRotationData extends IScaleData {
|
|
133
141
|
rotation: number
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export interface ISkewData {
|
|
134
145
|
skewX: number
|
|
135
146
|
skewY: number
|
|
136
147
|
}
|
|
137
148
|
|
|
138
|
-
export
|
|
149
|
+
export interface ILayoutData extends IScaleRotationData, ISkewData, IPointData {
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export type ILayoutAttr =
|
|
139
153
|
| 'x'
|
|
140
154
|
| 'y'
|
|
141
155
|
| 'scaleX'
|
|
@@ -144,9 +158,13 @@ export type IMatrixDecompositionAttr =
|
|
|
144
158
|
| 'skewX'
|
|
145
159
|
| 'skewY'
|
|
146
160
|
|
|
161
|
+
|
|
162
|
+
export interface ILayoutBoundsData extends ILayoutData, IBoundsData {
|
|
163
|
+
}
|
|
147
164
|
export interface IMatrix extends IMatrixData {
|
|
148
|
-
|
|
149
|
-
|
|
165
|
+
|
|
166
|
+
set(a: number | IMatrixData, b: number, c: number, d: number, e: number, f: number): IMatrix
|
|
167
|
+
get(): IMatrixData
|
|
150
168
|
clone(): IMatrix
|
|
151
169
|
|
|
152
170
|
translate(x: number, y: number): IMatrix
|
|
@@ -164,19 +182,33 @@ export interface IMatrix extends IMatrixData {
|
|
|
164
182
|
skewOfOuter(origin: IPointData, x: number, y?: number): IMatrix
|
|
165
183
|
skewOfInner(origin: IPointData, x: number, y?: number): IMatrix
|
|
166
184
|
|
|
167
|
-
multiply(
|
|
168
|
-
|
|
169
|
-
|
|
185
|
+
multiply(child: IMatrixData): IMatrix
|
|
186
|
+
multiplyParent(parent: IMatrixData): IMatrix
|
|
187
|
+
|
|
188
|
+
divide(child: IMatrixData): IMatrix
|
|
189
|
+
divideParent(parent: IMatrixData): IMatrix
|
|
170
190
|
invert(): IMatrix
|
|
171
191
|
|
|
172
192
|
toOuterPoint(inner: IPointData, to?: IPointData, distance?: boolean): void
|
|
173
193
|
toInnerPoint(outer: IPointData, to?: IPointData, distance?: boolean): void
|
|
174
194
|
|
|
175
|
-
|
|
195
|
+
setLayout(data: ILayoutData, origin?: IPointData): IMatrix
|
|
196
|
+
getLayout(origin?: IPointData, firstSkewY?: boolean): ILayoutData
|
|
197
|
+
|
|
198
|
+
withScale(scaleX?: number, scaleY?: number): IMatrixWithScaleData
|
|
176
199
|
|
|
177
200
|
reset(): void
|
|
178
201
|
}
|
|
179
202
|
|
|
180
203
|
export interface IMatrixWithBoundsData extends IMatrixData, IBoundsData { }
|
|
181
204
|
|
|
182
|
-
export interface
|
|
205
|
+
export interface IMatrixWithScaleData extends IMatrixData, IScaleData { }
|
|
206
|
+
|
|
207
|
+
export interface IMatrixWithOptionScaleData extends IMatrixData {
|
|
208
|
+
scaleX?: number
|
|
209
|
+
scaleY?: number
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export interface IMatrixWithBoundsScaleData extends IMatrixData, IBoundsData, IScaleData { }
|
|
213
|
+
|
|
214
|
+
export interface IMatrixWithLayoutData extends IMatrixData, ILayoutBoundsData { }
|
|
@@ -4,12 +4,14 @@ import { ILeaf } from '../display/ILeaf'
|
|
|
4
4
|
import { IExportFileType, IExportImageType } from '../file/IFileType'
|
|
5
5
|
import { IBoundsData, ISizeData } from '../math/IMath'
|
|
6
6
|
import { IObject } from '../data/IData'
|
|
7
|
+
import { ICanvasType } from '../canvas/ISkiaCanvas'
|
|
7
8
|
|
|
8
9
|
export interface IPlatform {
|
|
9
10
|
name?: 'web' | 'node' | 'miniapp'
|
|
10
11
|
os?: 'Mac' | 'Windows' | 'Linux'
|
|
11
12
|
requestRender?(render: IFunction): void
|
|
12
13
|
canvas?: ILeaferCanvas
|
|
14
|
+
canvasType?: ICanvasType
|
|
13
15
|
isWorker?: boolean
|
|
14
16
|
isMobile?: boolean
|
|
15
17
|
devicePixelRatio?: number
|
|
@@ -19,7 +21,6 @@ export interface IPlatform {
|
|
|
19
21
|
fullImageShadow?: boolean // safari need
|
|
20
22
|
syncDomFont?: boolean // firefox need
|
|
21
23
|
layout?(target: ILeaf): void
|
|
22
|
-
realtimeLayout?: boolean
|
|
23
24
|
origin?: {
|
|
24
25
|
createCanvas(width: number, height: number, format?: 'svg' | 'pdf'): any
|
|
25
26
|
canvasToDataURL(canvas: any, type?: IExportImageType, quality?: number): string | Promise<string>
|
|
@@ -28,8 +29,20 @@ export interface IPlatform {
|
|
|
28
29
|
loadImage(url: string): Promise<any>
|
|
29
30
|
noRepeat?: string // fix: 微信小程序 createPattern 直接使用 no-repeat 有bug,导致无法显示
|
|
30
31
|
},
|
|
32
|
+
roundRectPatch?: boolean // fix: skia-canvas roundRect
|
|
33
|
+
ellipseToCurve?: boolean, // fix: skia 绘制圆环和椭圆弧
|
|
34
|
+
event?: {
|
|
35
|
+
stopDefault(origin: IObject): void
|
|
36
|
+
stopNow(origin: IObject): void
|
|
37
|
+
stop(origin: IObject): void
|
|
38
|
+
},
|
|
31
39
|
miniapp?: IMiniapp
|
|
32
|
-
|
|
40
|
+
image: {
|
|
41
|
+
maxCacheSize: number // 最大等级缓存,一般取当前屏幕大小,默认2k: 2560 * 1600
|
|
42
|
+
maxPatternSize: number // 最大repeat pattern缓存, 默认4k: 4096 * 2160
|
|
43
|
+
suffix: string // 需要带上后缀区分dom中image标签的缓存,否则会导致浏览器缓存跨域问题
|
|
44
|
+
crossOrigin: string | false // 跨域设置
|
|
45
|
+
}
|
|
33
46
|
}
|
|
34
47
|
|
|
35
48
|
|
package/src/plugin/IPlugin.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ILeaferBase } from '../app/ILeafer'
|
|
2
2
|
import { IObject } from '../data/IData'
|
|
3
3
|
|
|
4
4
|
export interface IPlugin extends IObject {
|
|
@@ -6,5 +6,5 @@ export interface IPlugin extends IObject {
|
|
|
6
6
|
importVersion: string
|
|
7
7
|
import: string[]
|
|
8
8
|
run(LeaferUI: IObject, config: IObject): void
|
|
9
|
-
onLeafer?(leafer:
|
|
9
|
+
onLeafer?(leafer: ILeaferBase): void
|
|
10
10
|
}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { ILeaferCanvas } from '../canvas/ILeaferCanvas'
|
|
2
2
|
import { ILeaf } from '../display/ILeaf'
|
|
3
|
-
import { IBounds,
|
|
3
|
+
import { IBounds, IMatrixWithScaleData } from '../math/IMath'
|
|
4
4
|
import { IFunction } from '../function/IFunction'
|
|
5
5
|
import { IControl } from '../control/IControl'
|
|
6
6
|
|
|
7
7
|
export interface IRenderOptions {
|
|
8
|
+
includes?: boolean,
|
|
8
9
|
bounds?: IBounds,
|
|
9
10
|
hideBounds?: IBounds,
|
|
10
|
-
matrix?:
|
|
11
|
+
matrix?: IMatrixWithScaleData,
|
|
11
12
|
inCamera?: boolean
|
|
12
13
|
}
|
|
13
14
|
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import { ILeaf } from '../display/ILeaf'
|
|
2
2
|
import { ILeafList } from '../data/IList'
|
|
3
3
|
import { IPointData } from '../math/IMath'
|
|
4
|
+
import { IBranch } from '../display/IBranch'
|
|
4
5
|
|
|
5
|
-
export interface
|
|
6
|
-
|
|
6
|
+
export interface IPickResult {
|
|
7
|
+
target: ILeaf
|
|
7
8
|
path: ILeafList
|
|
8
9
|
throughPath?: ILeafList
|
|
9
10
|
}
|
|
10
11
|
|
|
11
|
-
export interface
|
|
12
|
+
export interface IPickOptions {
|
|
12
13
|
name?: string
|
|
14
|
+
hitRadius?: number
|
|
13
15
|
through?: boolean
|
|
16
|
+
target?: IBranch
|
|
17
|
+
findList?: ILeaf[]
|
|
14
18
|
exclude?: ILeafList
|
|
15
19
|
ignoreHittable?: boolean
|
|
16
20
|
}
|
|
@@ -19,17 +23,30 @@ export interface ISelectorConfig {
|
|
|
19
23
|
|
|
20
24
|
}
|
|
21
25
|
|
|
26
|
+
export type IAnswer = 0 | 1 | 2 | 3
|
|
27
|
+
|
|
28
|
+
export interface IFindMethod {
|
|
29
|
+
(leaf: ILeaf, options?: any): IAnswer
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface ISelectorProxy {
|
|
33
|
+
list: ILeaf[]
|
|
34
|
+
}
|
|
35
|
+
|
|
22
36
|
export interface ISelector {
|
|
23
37
|
target: ILeaf
|
|
24
38
|
|
|
39
|
+
proxy?: ISelectorProxy
|
|
40
|
+
|
|
25
41
|
config: ISelectorConfig
|
|
26
42
|
|
|
27
|
-
getByPoint(hitPoint: IPointData, hitRadius: number, options?:
|
|
43
|
+
getByPoint(hitPoint: IPointData, hitRadius: number, options?: IPickOptions): IPickResult
|
|
28
44
|
|
|
29
|
-
|
|
30
|
-
getByInnerId(
|
|
31
|
-
getById(
|
|
32
|
-
getByClassName(
|
|
33
|
-
|
|
45
|
+
getBy(condition: number | string | IFindMethod, branch?: ILeaf, one?: boolean, options?: any): ILeaf | ILeaf[]
|
|
46
|
+
getByInnerId(innerId: number, branch?: ILeaf): ILeaf
|
|
47
|
+
getById(id: string, branch?: ILeaf): ILeaf
|
|
48
|
+
getByClassName(className: string, branch?: ILeaf): ILeaf[]
|
|
49
|
+
getByTag(tag: string, branch?: ILeaf): ILeaf[]
|
|
50
|
+
getByMethod(method: IFindMethod, branch?: ILeaf, one?: boolean, options?: any): ILeaf | ILeaf[]
|
|
34
51
|
destroy(): void
|
|
35
52
|
}
|