@leafer/interface 1.0.0-beta.9 → 1.0.0-rc.2
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 +5 -2
- package/src/app/ILeafer.ts +9 -4
- package/src/canvas/IHitCanvasManager.ts +0 -1
- package/src/canvas/ILeaferCanvas.ts +9 -5
- package/src/data/IData.ts +1 -2
- package/src/data/ILeafData.ts +5 -5
- package/src/display/IBranch.ts +2 -1
- package/src/display/ILeaf.ts +104 -12
- package/src/display/module/ILeafBounds.ts +2 -0
- package/src/event/IUIEvent.ts +10 -5
- package/src/image/IImageManager.ts +10 -2
- package/src/image/ILeaferImage.ts +19 -1
- package/src/index.ts +3 -3
- package/src/interaction/IInteraction.ts +20 -6
- package/src/layout/ILeafLayout.ts +5 -3
- package/src/math/IMath.ts +7 -5
- package/src/path/IPathDrawer.ts +5 -0
- package/src/platform/IPlatform.ts +7 -3
- package/src/task/ITaskProcessor.ts +19 -3
- package/src/watcher/IWatcher.ts +5 -1
- package/types/index.d.ts +1672 -0
package/src/math/IMath.ts
CHANGED
|
@@ -56,12 +56,13 @@ export interface IBounds extends IBoundsData {
|
|
|
56
56
|
copy(bounds: IBoundsData): IBounds
|
|
57
57
|
clone(): IBounds
|
|
58
58
|
|
|
59
|
-
scale(
|
|
59
|
+
scale(scaleX: number, scaleY?: number): IBounds
|
|
60
60
|
toOuterOf(matrix: IMatrixData, to?: IBoundsData): IBounds
|
|
61
61
|
getFitMatrix(put: IBoundsData): IMatrix
|
|
62
62
|
|
|
63
63
|
spread(size: number): IBounds
|
|
64
64
|
ceil(): IBounds
|
|
65
|
+
unsign(): IBounds
|
|
65
66
|
|
|
66
67
|
add(bounds: IBoundsData): IBounds
|
|
67
68
|
addList(boundsList: IBounds[]): IBounds
|
|
@@ -71,7 +72,7 @@ export interface IBounds extends IBoundsData {
|
|
|
71
72
|
setByPoints(points: IPointData[]): IBounds
|
|
72
73
|
|
|
73
74
|
hitPoint(point: IPointData, pointMatrix?: IMatrixData): boolean
|
|
74
|
-
hitRadiusPoint(point: IRadiusPointData, pointMatrix?:
|
|
75
|
+
hitRadiusPoint(point: IRadiusPointData, pointMatrix?: IMatrixWithLayoutData): boolean
|
|
75
76
|
hit(bounds: IBoundsData, boundsMatrix?: IMatrixData): boolean
|
|
76
77
|
includes(bounds: IBoundsData, boundsMatrix?: IMatrixData): boolean
|
|
77
78
|
|
|
@@ -168,13 +169,14 @@ export interface IMatrix extends IMatrixData {
|
|
|
168
169
|
preMultiply(matrix: IMatrixData): IMatrix
|
|
169
170
|
invert(): IMatrix
|
|
170
171
|
|
|
171
|
-
toOuterPoint(inner: IPointData, to?: IPointData): void
|
|
172
|
-
toInnerPoint(outer: IPointData, to?: IPointData): void
|
|
172
|
+
toOuterPoint(inner: IPointData, to?: IPointData, distance?: boolean): void
|
|
173
|
+
toInnerPoint(outer: IPointData, to?: IPointData, distance?: boolean): void
|
|
173
174
|
|
|
174
175
|
decompose(): IMatrixDecompositionData
|
|
175
176
|
|
|
176
177
|
reset(): void
|
|
177
178
|
}
|
|
178
179
|
|
|
179
|
-
|
|
180
180
|
export interface IMatrixWithBoundsData extends IMatrixData, IBoundsData { }
|
|
181
|
+
|
|
182
|
+
export interface IMatrixWithLayoutData extends IMatrixData, IMatrixDecompositionData, IBoundsData { }
|
package/src/path/IPathDrawer.ts
CHANGED
|
@@ -33,4 +33,9 @@ export interface IPathCreator {
|
|
|
33
33
|
|
|
34
34
|
rect(x: number, y: number, width: number, height: number): IPathCreator
|
|
35
35
|
roundRect(x: number, y: number, width: number, height: number, radius?: number | number[]): IPathCreator
|
|
36
|
+
|
|
37
|
+
// new
|
|
38
|
+
drawEllipse(x: number, y: number, radiusX: number, radiusY: number, rotation?: number, startAngle?: number, endAngle?: number, anticlockwise?: boolean): IPathCreator
|
|
39
|
+
drawArc(x: number, y: number, radius: number, startAngle?: number, endAngle?: number, anticlockwise?: boolean): IPathCreator
|
|
40
|
+
drawPoints(points: number[], curve?: boolean | number, close?: boolean): IPathCreator
|
|
36
41
|
}
|
|
@@ -11,21 +11,25 @@ export interface IPlatform {
|
|
|
11
11
|
requestRender?(render: IFunction): void
|
|
12
12
|
canvas?: ILeaferCanvas
|
|
13
13
|
isWorker?: boolean
|
|
14
|
+
isMobile?: boolean
|
|
14
15
|
devicePixelRatio?: number
|
|
15
|
-
intWheelDeltaY?: boolean //
|
|
16
|
+
intWheelDeltaY?: boolean // firefox / Windows need
|
|
16
17
|
conicGradientSupport?: boolean
|
|
17
|
-
conicGradientRotate90?: boolean //
|
|
18
|
+
conicGradientRotate90?: boolean // firefox need rotate
|
|
18
19
|
fullImageShadow?: boolean // safari need
|
|
20
|
+
syncDomFont?: boolean // firefox need
|
|
19
21
|
layout?(target: ILeaf): void
|
|
20
22
|
realtimeLayout?: boolean
|
|
21
23
|
origin?: {
|
|
22
24
|
createCanvas(width: number, height: number, format?: 'svg' | 'pdf'): any
|
|
23
|
-
canvasToDataURL(canvas: any, type?: IExportImageType, quality?: number): string
|
|
25
|
+
canvasToDataURL(canvas: any, type?: IExportImageType, quality?: number): string | Promise<string>
|
|
24
26
|
canvasToBolb(canvas: any, type?: IExportFileType, quality?: number): Promise<any>
|
|
25
27
|
canvasSaveAs(canvas: any, filename: string, quality?: number): Promise<void>
|
|
26
28
|
loadImage(url: string): Promise<any>
|
|
29
|
+
noRepeat?: string // fix: 微信小程序 createPattern 直接使用 no-repeat 有bug,导致无法显示
|
|
27
30
|
},
|
|
28
31
|
miniapp?: IMiniapp
|
|
32
|
+
imageSuffix?: string // 需要带上后缀区分dom中image标签的缓存,否则会导致浏览器缓存跨域问题
|
|
29
33
|
}
|
|
30
34
|
|
|
31
35
|
|
|
@@ -21,8 +21,24 @@ export interface ITaskProcessor {
|
|
|
21
21
|
resume(): void
|
|
22
22
|
skip(): void
|
|
23
23
|
stop(): void
|
|
24
|
-
add(taskCallback: IFunction,
|
|
25
|
-
addParallel(taskCallback: IFunction, taskTime?: number): void
|
|
26
|
-
addEmpty(callback?: IFunction): void
|
|
24
|
+
add(taskCallback: IFunction, options?: ITaskOptions | number): ITaskItem
|
|
27
25
|
destroy(): void
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface ITaskItem {
|
|
29
|
+
parent: ITaskProcessor
|
|
30
|
+
parallel: boolean
|
|
31
|
+
isComplete: boolean
|
|
32
|
+
isCancel: boolean
|
|
33
|
+
time: number
|
|
34
|
+
run(): Promise<void>
|
|
35
|
+
complete(): void
|
|
36
|
+
cancel(): void
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface ITaskOptions {
|
|
40
|
+
start?: boolean // default true
|
|
41
|
+
time?: number // default 1
|
|
42
|
+
parallel?: boolean // default true
|
|
43
|
+
delay?: number // default 0
|
|
28
44
|
}
|
package/src/watcher/IWatcher.ts
CHANGED
|
@@ -18,7 +18,11 @@ export interface IWatcher extends IControl {
|
|
|
18
18
|
disabled: boolean
|
|
19
19
|
running: boolean
|
|
20
20
|
changed: boolean
|
|
21
|
-
|
|
21
|
+
|
|
22
|
+
hasVisible: boolean
|
|
23
|
+
hasAdd: boolean
|
|
24
|
+
hasRemove: boolean
|
|
25
|
+
readonly childrenChanged: boolean
|
|
22
26
|
|
|
23
27
|
config: IWatcherConfig
|
|
24
28
|
|