@leafer/interface 1.0.0-beta.10 → 1.0.0-beta.12
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/canvas/IHitCanvasManager.ts +0 -1
- package/src/canvas/ILeaferCanvas.ts +1 -4
- package/src/display/ILeaf.ts +2 -0
- package/src/image/ILeaferImage.ts +1 -1
- package/src/index.ts +1 -1
- package/src/math/IMath.ts +4 -1
- package/src/platform/IPlatform.ts +2 -1
- package/src/task/ITaskProcessor.ts +19 -3
package/package.json
CHANGED
|
@@ -12,7 +12,6 @@ export interface ILeaferCanvasConfig extends IAutoBoundsData {
|
|
|
12
12
|
pixelRatio?: number
|
|
13
13
|
smooth?: boolean
|
|
14
14
|
hittable?: boolean
|
|
15
|
-
offscreen?: boolean
|
|
16
15
|
webgl?: boolean
|
|
17
16
|
}
|
|
18
17
|
|
|
@@ -157,8 +156,6 @@ export interface ILeaferCanvas extends ICanvasAttr, ICanvasMethod, IPathDrawer {
|
|
|
157
156
|
|
|
158
157
|
unreal?: boolean
|
|
159
158
|
|
|
160
|
-
offscreen: boolean
|
|
161
|
-
|
|
162
159
|
context: ICanvasContext2D
|
|
163
160
|
|
|
164
161
|
recycled?: boolean
|
|
@@ -168,7 +165,7 @@ export interface ILeaferCanvas extends ICanvasAttr, ICanvasMethod, IPathDrawer {
|
|
|
168
165
|
init(): void
|
|
169
166
|
|
|
170
167
|
toBlob(type?: string, quality?: number): Promise<IBlob>
|
|
171
|
-
toDataURL(type?: string, quality?: number): string
|
|
168
|
+
toDataURL(type?: string, quality?: number): string | Promise<string>
|
|
172
169
|
saveAs(filename: string, quality?: number): Promise<boolean>
|
|
173
170
|
|
|
174
171
|
startAutoLayout(autoBounds: IAutoBounds, listener: IResizeEventListener): void
|
package/src/display/ILeaf.ts
CHANGED
|
@@ -209,6 +209,8 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
|
|
|
209
209
|
__parentWait?: IFunction[]
|
|
210
210
|
__leaferWait?: IFunction[]
|
|
211
211
|
|
|
212
|
+
destroyed: boolean
|
|
213
|
+
|
|
212
214
|
waitParent(item: IFunction): void
|
|
213
215
|
waitLeafer(item: IFunction): void
|
|
214
216
|
|
|
@@ -33,7 +33,7 @@ export interface ILeaferImage {
|
|
|
33
33
|
config: ILeaferImageConfig
|
|
34
34
|
|
|
35
35
|
load(onSuccess?: ILeaferImageOnLoaded, onError?: ILeaferImageOnError): number
|
|
36
|
-
unload(index: number): void
|
|
36
|
+
unload(index: number, stopEvent?: boolean): void
|
|
37
37
|
getCanvas(width: number, height: number, opacity?: number, _filters?: IObject): unknown
|
|
38
38
|
destroy(): void
|
|
39
39
|
}
|
package/src/index.ts
CHANGED
|
@@ -26,7 +26,7 @@ export { ICanvasManager } from './canvas/ICanvasManager'
|
|
|
26
26
|
export { IHitCanvasManager } from './canvas/IHitCanvasManager'
|
|
27
27
|
export { IImageManager } from './image/IImageManager'
|
|
28
28
|
|
|
29
|
-
export { ITaskProcessor, ITaskProcessorConfig } from './task/ITaskProcessor'
|
|
29
|
+
export { ITaskProcessor, ITaskProcessorConfig, ITaskItem, ITaskOptions } from './task/ITaskProcessor'
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
export { IControl } from './control/IControl'
|
package/src/math/IMath.ts
CHANGED
|
@@ -177,4 +177,7 @@ export interface IMatrix extends IMatrixData {
|
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
|
|
180
|
-
export interface IMatrixWithBoundsData extends IMatrixData, IBoundsData {
|
|
180
|
+
export interface IMatrixWithBoundsData extends IMatrixData, IBoundsData {
|
|
181
|
+
scaleX?: number
|
|
182
|
+
scaleY?: number
|
|
183
|
+
}
|
|
@@ -20,13 +20,14 @@ export interface IPlatform {
|
|
|
20
20
|
realtimeLayout?: boolean
|
|
21
21
|
origin?: {
|
|
22
22
|
createCanvas(width: number, height: number, format?: 'svg' | 'pdf'): any
|
|
23
|
-
canvasToDataURL(canvas: any, type?: IExportImageType, quality?: number): string
|
|
23
|
+
canvasToDataURL(canvas: any, type?: IExportImageType, quality?: number): string | Promise<string>
|
|
24
24
|
canvasToBolb(canvas: any, type?: IExportFileType, quality?: number): Promise<any>
|
|
25
25
|
canvasSaveAs(canvas: any, filename: string, quality?: number): Promise<void>
|
|
26
26
|
loadImage(url: string): Promise<any>
|
|
27
27
|
noRepeat?: string // fix: 微信小程序 createPattern 直接使用 no-repeat 有bug,导致无法显示
|
|
28
28
|
},
|
|
29
29
|
miniapp?: IMiniapp
|
|
30
|
+
imageSuffix?: string // 需要带上后缀区分dom中image标签的缓存,否则会导致浏览器缓存跨域问题
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
|
|
@@ -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, start?: boolean,): 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
|
}
|