@leafer/interface 1.0.0-alpha.10 → 1.0.0-alpha.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/ILeafer.ts +5 -3
- package/src/canvas/ILeaferCanvas.ts +15 -15
- package/src/display/ILeaf.ts +20 -5
- package/src/display/module/ILeafRender.ts +2 -1
- package/src/image/ILeaferImage.ts +3 -1
- package/src/index.ts +1 -1
- package/src/math/IMath.ts +20 -20
- package/src/platform/IPlatform.ts +1 -0
package/package.json
CHANGED
package/src/app/ILeafer.ts
CHANGED
|
@@ -17,9 +17,9 @@ import { IEvent } from '../event/IEvent'
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
export interface ILeaferConfig extends IRendererConfig, ILeaferCanvasConfig, IInteractionConfig, ILayouterConfig {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
autoStart?: boolean
|
|
21
|
+
useZoom?: boolean
|
|
22
|
+
useMove?: boolean
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export interface ILeafer extends IZoomView {
|
|
@@ -46,6 +46,8 @@ export interface ILeafer extends IZoomView {
|
|
|
46
46
|
hitCanvasManager?: IHitCanvasManager
|
|
47
47
|
imageManager: IImageManager
|
|
48
48
|
|
|
49
|
+
config: ILeaferConfig
|
|
50
|
+
|
|
49
51
|
start(): void
|
|
50
52
|
stop(): void
|
|
51
53
|
|
|
@@ -10,6 +10,8 @@ export interface ILeaferCanvasConfig extends IAutoBoundsData {
|
|
|
10
10
|
view?: string | IObject
|
|
11
11
|
fill?: string
|
|
12
12
|
pixelRatio?: number
|
|
13
|
+
hittable?: boolean
|
|
14
|
+
offscreen?: boolean
|
|
13
15
|
webgl?: boolean
|
|
14
16
|
}
|
|
15
17
|
|
|
@@ -96,24 +98,23 @@ interface ICanvasMethod {
|
|
|
96
98
|
|
|
97
99
|
// custom
|
|
98
100
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
setBlur(blur: number): void
|
|
101
|
+
hitPath(point: IPointData, fillRule?: string): boolean
|
|
102
|
+
hitStroke(point: IPointData): boolean
|
|
102
103
|
|
|
104
|
+
setStroke(strokeStyle: string | object, strokeWidth: number, options?: ICanvasStrokeOptions): void
|
|
103
105
|
|
|
104
106
|
setWorld(matrix: IMatrixData, parentMatrix?: IMatrixData): void
|
|
105
107
|
|
|
108
|
+
setWorldShadow(x: number, y: number, blur: number, color?: string): void
|
|
109
|
+
setWorldBlur(blur: number): void
|
|
106
110
|
|
|
107
|
-
|
|
108
|
-
hitStroke(point: IPointData): boolean
|
|
109
|
-
|
|
110
|
-
replaceBy(canvas: ILeaferCanvas, fromBounds?: IBoundsData, toBounds?: IBoundsData): void
|
|
111
|
-
copy(canvas: ILeaferCanvas, fromBounds?: IBoundsData, toBounds?: IBoundsData, blendMode?: string): void
|
|
111
|
+
copyWorld(canvas: ILeaferCanvas, fromBounds?: IBoundsData, toBounds?: IBoundsData, blendMode?: string): void
|
|
112
112
|
copyWorldToLocal(canvas: ILeaferCanvas, fromWorld: IMatrixWithBoundsData, toLocalBounds: IBoundsData, blendMode?: string): void
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
113
|
+
fillWorld(bounds: IBoundsData, color: string | object, blendMode?: string): void
|
|
114
|
+
strokeWorld(bounds: IBoundsData, color: string | object, blendMode?: string): void
|
|
115
|
+
clipWorld(bounds: IBoundsData, ceilPixel?: boolean): void
|
|
116
|
+
clearWorld(bounds: IBoundsData, ceilPixel?: boolean): void
|
|
117
|
+
|
|
117
118
|
clear(): void
|
|
118
119
|
}
|
|
119
120
|
|
|
@@ -133,13 +134,12 @@ export interface ILeaferCanvas extends ICanvasAttr, ICanvasMethod, IPathDrawer {
|
|
|
133
134
|
bounds: IBounds
|
|
134
135
|
|
|
135
136
|
view: unknown
|
|
137
|
+
offscreen: boolean
|
|
136
138
|
context: ICanvasContext2D
|
|
137
139
|
|
|
138
140
|
recycled?: boolean
|
|
139
141
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
autoLayout(autoBounds: IAutoBounds, listener: IResizeEventListener): void
|
|
142
|
+
startAutoLayout(autoBounds: IAutoBounds, listener: IResizeEventListener): void
|
|
143
143
|
stopAutoLayout(): void
|
|
144
144
|
|
|
145
145
|
resize(size: IScreenSizeData): void
|
package/src/display/ILeaf.ts
CHANGED
|
@@ -23,6 +23,7 @@ export interface ICachedLeaf {
|
|
|
23
23
|
bounds: IBoundsData
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
|
|
26
27
|
export interface ILeafAttrData {
|
|
27
28
|
// layer data
|
|
28
29
|
id: __String
|
|
@@ -45,8 +46,14 @@ export interface ILeafAttrData {
|
|
|
45
46
|
skewY: __Number
|
|
46
47
|
|
|
47
48
|
draggable: __Boolean
|
|
49
|
+
|
|
50
|
+
hittable: __Boolean
|
|
51
|
+
hitType: IHitType
|
|
52
|
+
hitChildren: __Boolean
|
|
48
53
|
}
|
|
49
54
|
|
|
55
|
+
export type IHitType = 'visible' | 'fill-visible' | 'stroke-visible' | 'all' | 'fill' | 'stroke'
|
|
56
|
+
|
|
50
57
|
export interface ILeafInputData {
|
|
51
58
|
// layer data
|
|
52
59
|
id?: __String
|
|
@@ -69,6 +76,10 @@ export interface ILeafInputData {
|
|
|
69
76
|
skewY?: __Number
|
|
70
77
|
|
|
71
78
|
draggable?: __Boolean
|
|
79
|
+
|
|
80
|
+
hittable?: __Boolean
|
|
81
|
+
hitType?: IHitType
|
|
82
|
+
hitChildren?: __Boolean
|
|
72
83
|
}
|
|
73
84
|
export interface ILeafComputedData {
|
|
74
85
|
// layer data
|
|
@@ -92,6 +103,14 @@ export interface ILeafComputedData {
|
|
|
92
103
|
skewY?: number
|
|
93
104
|
|
|
94
105
|
draggable?: boolean
|
|
106
|
+
|
|
107
|
+
hittable?: boolean
|
|
108
|
+
hitType?: IHitType
|
|
109
|
+
hitChildren?: boolean
|
|
110
|
+
|
|
111
|
+
// other
|
|
112
|
+
__childBranchNumber?: number // 存在子分支的个数
|
|
113
|
+
__complex?: boolean // 外观是否复杂
|
|
95
114
|
}
|
|
96
115
|
|
|
97
116
|
export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDataProxy, ILeafInputData, IEventer {
|
|
@@ -103,9 +122,6 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
|
|
|
103
122
|
root?: ILeaf
|
|
104
123
|
parent?: ILeaf
|
|
105
124
|
|
|
106
|
-
__interactionOff?: boolean
|
|
107
|
-
__childrenInteractionOff?: boolean
|
|
108
|
-
|
|
109
125
|
__isRoot?: boolean
|
|
110
126
|
__isBranch?: boolean
|
|
111
127
|
__isBranchLeaf?: boolean
|
|
@@ -118,7 +134,6 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
|
|
|
118
134
|
|
|
119
135
|
__worldOpacity: number
|
|
120
136
|
__renderTime: number // μs 1000微秒 = 1毫秒
|
|
121
|
-
__complex: boolean // 外观是否复杂
|
|
122
137
|
|
|
123
138
|
__level: number // 图层级别 root(1) -> hight
|
|
124
139
|
__tempNumber?: number // 用于临时运算储存状态
|
|
@@ -171,6 +186,7 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
|
|
|
171
186
|
__draw(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
172
187
|
|
|
173
188
|
__updateWorldOpacity(): void
|
|
189
|
+
__updateRenderTime(): void
|
|
174
190
|
__updateChange(): void
|
|
175
191
|
|
|
176
192
|
// path
|
|
@@ -181,7 +197,6 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
|
|
|
181
197
|
|
|
182
198
|
// branch
|
|
183
199
|
children?: ILeaf[]
|
|
184
|
-
__childBranchNumber?: number // 存在子分支的个数
|
|
185
200
|
|
|
186
201
|
__updateSortChildren(): void
|
|
187
202
|
add(child: ILeaf, index?: number): void
|
|
@@ -6,12 +6,13 @@ export type ILeafRenderModule = ILeafRender & ThisType<ILeaf>
|
|
|
6
6
|
|
|
7
7
|
export interface ILeafRender {
|
|
8
8
|
__render?(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
9
|
-
__drawFast?(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
10
9
|
__draw?(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
10
|
+
__drawFast?(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
11
11
|
|
|
12
12
|
__drawBefore?(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
13
13
|
__drawAfter?(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
14
14
|
|
|
15
15
|
__updateWorldOpacity?(): void
|
|
16
|
+
__updateRenderTime?(): void
|
|
16
17
|
__updateChange?(): void
|
|
17
18
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { IApp } from './app/IApp'
|
|
2
2
|
export { ILeafer, ILeaferConfig, ICreator, IUICreator } from './app/ILeafer'
|
|
3
|
-
export { ILeaf, ILeafAttrData, ILeafComputedData, ILeafInputData, ICachedLeaf } from './display/ILeaf'
|
|
3
|
+
export { ILeaf, ILeafAttrData, ILeafComputedData, ILeafInputData, ICachedLeaf, IHitType } from './display/ILeaf'
|
|
4
4
|
export { IBranch } from './display/IBranch'
|
|
5
5
|
export { IZoomView } from './display/IView'
|
|
6
6
|
|
package/src/math/IMath.ts
CHANGED
|
@@ -10,10 +10,10 @@ export interface IPoint extends IPointData {
|
|
|
10
10
|
copy(point: IPointData): IPoint
|
|
11
11
|
clone(): IPoint
|
|
12
12
|
|
|
13
|
-
rotate(angle: number, center?: IPointData):
|
|
13
|
+
rotate(angle: number, center?: IPointData): IPoint
|
|
14
14
|
|
|
15
|
-
toLocal(matrix: IMatrixData):
|
|
16
|
-
toWorld(matrix: IMatrixData):
|
|
15
|
+
toLocal(matrix: IMatrixData, to?: IPointData): IPoint
|
|
16
|
+
toWorld(matrix: IMatrixData, to?: IPointData): IPoint
|
|
17
17
|
|
|
18
18
|
getCenter(to: IPointData): IPointData
|
|
19
19
|
getDistance(to: IPointData): number
|
|
@@ -54,27 +54,27 @@ export interface IBounds extends IBoundsData {
|
|
|
54
54
|
copy(bounds: IBoundsData): IBounds
|
|
55
55
|
clone(): IBounds
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
scale(scale: number): IBounds
|
|
58
|
+
toWorld(matrix: IMatrixData, to?: IBoundsData): IBounds
|
|
59
59
|
getFitMatrix(put: IBoundsData): IMatrix
|
|
60
|
-
spread(size: number): void
|
|
61
|
-
ceil(): void
|
|
62
60
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
61
|
+
spread(size: number): IBounds
|
|
62
|
+
ceil(): IBounds
|
|
63
|
+
|
|
64
|
+
add(bounds: IBoundsData): IBounds
|
|
65
|
+
addList(boundsList: IBounds[]): IBounds
|
|
66
|
+
setByList(boundsList: IBounds[], addMode?: boolean): IBounds
|
|
67
|
+
addListWithHandle(list: IObject[], boundsDataHandle: IBoundsDataHandle): IBounds
|
|
68
|
+
setByListWithHandle(list: IObject[], boundsDataHandle: IBoundsDataHandle, addMode: boolean): IBounds
|
|
69
|
+
setByPoints(points: IPointData[]): IBounds
|
|
70
70
|
|
|
71
71
|
hitPoint(point: IPointData, pointMatrix?: IMatrixData): boolean
|
|
72
72
|
hitRadiusPoint(point: IRadiusPointData, pointMatrix?: IMatrixData): boolean
|
|
73
73
|
hit(bounds: IBoundsData, boundsMatrix?: IMatrixData): boolean
|
|
74
74
|
includes(bounds: IBoundsData, boundsMatrix?: IMatrixData): boolean
|
|
75
75
|
|
|
76
|
+
intersect(bounds: IBoundsData, boundsMatrix?: IMatrixData): IBounds
|
|
76
77
|
getIntersect(bounds: IBoundsData, boundsMatrix?: IMatrixData): IBounds
|
|
77
|
-
setByIntersect(bounds: IBoundsData, boundsMatrix?: IMatrixData): void
|
|
78
78
|
|
|
79
79
|
isSame(bounds: IBoundsData): boolean
|
|
80
80
|
isEmpty(): boolean
|
|
@@ -129,12 +129,12 @@ export interface IMatrix extends IMatrixData {
|
|
|
129
129
|
scale(x: number, y?: number): IMatrix
|
|
130
130
|
rotate(angle: number): IMatrix
|
|
131
131
|
|
|
132
|
-
times(matrix: IMatrixData):
|
|
133
|
-
divide(matrix: IMatrixData):
|
|
134
|
-
invert():
|
|
132
|
+
times(matrix: IMatrixData): IMatrix
|
|
133
|
+
divide(matrix: IMatrixData): IMatrix
|
|
134
|
+
invert(): IMatrix
|
|
135
135
|
|
|
136
|
-
toWorldPoint(local: IPointData,
|
|
137
|
-
toLocalPoint(world: IPointData,
|
|
136
|
+
toWorldPoint(local: IPointData, to?: IPointData): void
|
|
137
|
+
toLocalPoint(world: IPointData, to?: IPointData): void
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
|