@leafer/interface 1.0.0-rc.4 → 1.0.0-rc.6
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 -2
- package/src/canvas/ISkiaCanvas.ts +20 -1
- package/src/data/ILeafData.ts +6 -1
- package/src/display/ILeaf.ts +19 -4
- package/src/display/IView.ts +1 -4
- package/src/display/module/ILeafDataProxy.ts +2 -0
- package/src/display/module/ILeafMask.ts +1 -1
- package/src/event/IEvent.ts +3 -23
- package/src/event/IUIEvent.ts +6 -8
- package/src/image/IImageManager.ts +3 -0
- package/src/index.ts +4 -4
- package/src/interaction/IInteraction.ts +2 -1
- package/src/layout/ILeafLayout.ts +3 -5
- package/src/math/IMath.ts +2 -1
- package/src/platform/IPlatform.ts +9 -0
- package/src/renderer/IRenderer.ts +1 -0
- package/src/selector/ISelector.ts +12 -5
- package/types/index.d.ts +109 -84
package/package.json
CHANGED
package/src/app/ILeafer.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { ILayouter, ILayouterConfig } from '../layouter/ILayouter'
|
|
|
5
5
|
import { ISelector, ISelectorConfig } from '../selector/ISelector'
|
|
6
6
|
import { IInteraction, IInteractionCanvas, IInteractionConfig } from '../interaction/IInteraction'
|
|
7
7
|
import { IWatcher, IWatcherConfig } from '../watcher/IWatcher'
|
|
8
|
-
import { IAutoBounds, IScreenSizeData } from '../math/IMath'
|
|
8
|
+
import { IAutoBounds, IPointData, IScreenSizeData } from '../math/IMath'
|
|
9
9
|
import { ICanvasManager } from '../canvas/ICanvasManager'
|
|
10
10
|
import { IHitCanvasManager } from '../canvas/IHitCanvasManager'
|
|
11
11
|
import { IEventListenerId } from '../event/IEventer'
|
|
@@ -56,11 +56,14 @@ export interface ILeafer extends IZoomView, IControl {
|
|
|
56
56
|
|
|
57
57
|
config: ILeaferConfig
|
|
58
58
|
|
|
59
|
+
readonly cursorPoint: IPointData
|
|
60
|
+
leafs: number
|
|
61
|
+
|
|
59
62
|
__eventIds: IEventListenerId[]
|
|
60
63
|
__nextRenderWait: IFunction[]
|
|
61
64
|
|
|
62
65
|
init(userConfig?: ILeaferConfig, parentApp?: IApp): void
|
|
63
|
-
setZoomLayer(zoomLayer: ILeaf
|
|
66
|
+
setZoomLayer(zoomLayer: ILeaf): void
|
|
64
67
|
forceFullRender(): void
|
|
65
68
|
updateCursor(): void
|
|
66
69
|
resize(size: IScreenSizeData): void
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { IExportFileType, IExportImageType } from '../file/IFileType'
|
|
2
2
|
|
|
3
|
-
export type ICanvasType = 'skia' | 'canvas' | 'wx'
|
|
3
|
+
export type ICanvasType = 'skia' | 'napi' | 'canvas' | 'wx'
|
|
4
4
|
|
|
5
|
+
// skia
|
|
5
6
|
export interface ISkiaCanvas {
|
|
6
7
|
toBuffer(format: IExportFileType, config: ISkiaCanvasExportConfig): Promise<any>
|
|
7
8
|
toBufferSync(format: IExportFileType, config: ISkiaCanvasExportConfig): any
|
|
@@ -17,4 +18,22 @@ export interface ISkiaCanvasExportConfig {
|
|
|
17
18
|
density?: number,
|
|
18
19
|
quality?: number,
|
|
19
20
|
outline?: boolean
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// skia-napi
|
|
24
|
+
export interface ISkiaNAPICanvas {
|
|
25
|
+
encodeSync(format: 'webp' | 'jpeg', quality?: number): any
|
|
26
|
+
encodeSync(format: 'png'): any
|
|
27
|
+
|
|
28
|
+
encode(format: 'webp' | 'jpeg' | string, quality?: number): Promise<any>
|
|
29
|
+
encode(format: 'png'): Promise<any>
|
|
30
|
+
|
|
31
|
+
toBuffer(mime: 'image/png'): any
|
|
32
|
+
toBuffer(mime: 'image/jpeg' | 'image/webp' | string, quality?: number): any
|
|
33
|
+
|
|
34
|
+
toDataURL(mime?: 'image/png'): string
|
|
35
|
+
toDataURL(mime: 'image/jpeg' | 'image/webp' | string, quality?: number): string
|
|
36
|
+
|
|
37
|
+
toDataURLAsync(mime?: 'image/png'): Promise<string>
|
|
38
|
+
toDataURLAsync(mime: 'image/jpeg' | 'image/webp' | string, quality?: number): Promise<string>
|
|
20
39
|
}
|
package/src/data/ILeafData.ts
CHANGED
|
@@ -14,7 +14,7 @@ export interface IDataProcessor extends IObject {
|
|
|
14
14
|
__setInput(name: string, value: any): void
|
|
15
15
|
__getInput(name: string): any
|
|
16
16
|
__removeInput(name: string): void
|
|
17
|
-
__getInputData(): IObject
|
|
17
|
+
__getInputData(options?: ILeafDataOptions): IObject
|
|
18
18
|
|
|
19
19
|
__setMiddle(name: string, value: any): void
|
|
20
20
|
__getMiddle(name: string): any
|
|
@@ -22,6 +22,11 @@ export interface IDataProcessor extends IObject {
|
|
|
22
22
|
destroy(): void
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
export interface ILeafDataOptions {
|
|
26
|
+
attrs?: 'all' | string[]
|
|
27
|
+
children?: boolean
|
|
28
|
+
}
|
|
29
|
+
|
|
25
30
|
export interface ILeafData extends IDataProcessor, ILeafComputedData {
|
|
26
31
|
|
|
27
32
|
}
|
package/src/display/ILeaf.ts
CHANGED
|
@@ -15,7 +15,8 @@ import { ILeafLayout, ILayoutBoundsType, ILayoutLocationType } from '../layout/I
|
|
|
15
15
|
import { ILeafHit } from './module/ILeafHit'
|
|
16
16
|
import { ILeafRender } from './module/ILeafRender'
|
|
17
17
|
import { ILeafMask } from './module/ILeafMask'
|
|
18
|
-
import { ILeafData } from '../data/ILeafData'
|
|
18
|
+
import { ILeafData, ILeafDataOptions } from '../data/ILeafData'
|
|
19
|
+
import { IFindMethod } from '../selector/ISelector'
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
export interface ICachedLeaf {
|
|
@@ -57,6 +58,7 @@ export interface ILeafAttrData {
|
|
|
57
58
|
hittable: __Boolean
|
|
58
59
|
hitFill: IHitType
|
|
59
60
|
hitStroke: IHitType
|
|
61
|
+
hitBox: __Boolean
|
|
60
62
|
hitChildren: __Boolean
|
|
61
63
|
hitSelf: __Boolean
|
|
62
64
|
hitRadius: __Number
|
|
@@ -96,6 +98,7 @@ export type IBlendMode =
|
|
|
96
98
|
| 'destination-in'
|
|
97
99
|
| 'destination-out'
|
|
98
100
|
| 'destination-atop'
|
|
101
|
+
| 'xor'
|
|
99
102
|
|
|
100
103
|
export type IResizeType = 'size' | 'scale'
|
|
101
104
|
export interface IImageCursor {
|
|
@@ -183,6 +186,7 @@ export interface ILeafInputData extends IObject {
|
|
|
183
186
|
hittable?: __Boolean
|
|
184
187
|
hitFill?: IHitType
|
|
185
188
|
hitStroke?: IHitType
|
|
189
|
+
hitBox?: __Boolean
|
|
186
190
|
hitChildren?: __Boolean
|
|
187
191
|
hitSelf?: __Boolean
|
|
188
192
|
hitRadius?: __Number
|
|
@@ -222,6 +226,7 @@ export interface ILeafComputedData {
|
|
|
222
226
|
hittable?: boolean
|
|
223
227
|
hitFill?: IHitType
|
|
224
228
|
hitStroke?: IHitType
|
|
229
|
+
hitBox?: boolean
|
|
225
230
|
hitChildren?: boolean
|
|
226
231
|
hitSelf?: boolean
|
|
227
232
|
hitRadius?: number
|
|
@@ -252,6 +257,8 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
|
|
|
252
257
|
isBranchLeaf?: boolean
|
|
253
258
|
|
|
254
259
|
__: ILeafData
|
|
260
|
+
proxyData?: ILeafInputData
|
|
261
|
+
|
|
255
262
|
__layout: ILeafLayout
|
|
256
263
|
|
|
257
264
|
__world: IMatrixWithLayoutData
|
|
@@ -269,8 +276,6 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
|
|
|
269
276
|
|
|
270
277
|
readonly worldOpacity: number
|
|
271
278
|
|
|
272
|
-
__renderTime?: number // μs 1000微秒 = 1毫秒
|
|
273
|
-
|
|
274
279
|
__level: number // 图层级别 root(1) -> hight
|
|
275
280
|
__tempNumber?: number // 用于临时运算储存状态
|
|
276
281
|
|
|
@@ -290,6 +295,9 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
|
|
|
290
295
|
|
|
291
296
|
destroyed: boolean
|
|
292
297
|
|
|
298
|
+
reset(data?: ILeafInputData): void
|
|
299
|
+
resetCustom(): void
|
|
300
|
+
|
|
293
301
|
waitParent(item: IFunction): void
|
|
294
302
|
waitLeafer(item: IFunction): void
|
|
295
303
|
nextRender(item: IFunction): void
|
|
@@ -297,12 +305,19 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
|
|
|
297
305
|
__bindLeafer(leafer: ILeafer | null): void
|
|
298
306
|
|
|
299
307
|
set(data: IObject): void
|
|
308
|
+
get(options?: ILeafDataOptions): ILeafInputData
|
|
300
309
|
toJSON(): IObject
|
|
301
310
|
toString(): string
|
|
302
311
|
|
|
303
312
|
// ILeafData ->
|
|
304
313
|
__setAttr(attrName: string, newValue: __Value): void
|
|
305
314
|
__getAttr(attrName: string): __Value
|
|
315
|
+
setProxyAttr(name: string, newValue: __Value): void
|
|
316
|
+
getProxyAttr(name: string): __Value
|
|
317
|
+
|
|
318
|
+
// find
|
|
319
|
+
find(condition: number | string | IFindMethod): ILeaf[]
|
|
320
|
+
findOne(condition: number | string | IFindMethod): ILeaf
|
|
306
321
|
|
|
307
322
|
forceUpdate(attrName?: string): void
|
|
308
323
|
|
|
@@ -331,7 +346,7 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
|
|
|
331
346
|
// IBranchMask ->
|
|
332
347
|
__updateEraser(value?: boolean): void
|
|
333
348
|
__updateMask(value?: boolean): void
|
|
334
|
-
__renderMask(canvas: ILeaferCanvas, content: ILeaferCanvas, mask: ILeaferCanvas): void
|
|
349
|
+
__renderMask(canvas: ILeaferCanvas, content: ILeaferCanvas, mask: ILeaferCanvas, recycle?: boolean): void
|
|
335
350
|
__removeMask(child?: ILeaf): void
|
|
336
351
|
|
|
337
352
|
// convert
|
package/src/display/IView.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { IBranch } from './IBranch'
|
|
2
2
|
import { ILeaf } from './ILeaf'
|
|
3
|
-
import { ITransformEventData } from '../event/IEvent'
|
|
4
3
|
|
|
5
4
|
export interface IZoomView extends IBranch {
|
|
6
5
|
zoomLayer?: ILeaf
|
|
7
|
-
|
|
8
|
-
transformData?: ITransformEventData
|
|
9
|
-
setZoomLayer(zoomLayer: ILeaf, moveLayer?: ILeaf): void
|
|
6
|
+
setZoomLayer(zoomLayer: ILeaf): void
|
|
10
7
|
}
|
|
@@ -6,5 +6,7 @@ export type ILeafDataProxyModule = ILeafDataProxy & ThisType<ILeaf>
|
|
|
6
6
|
export interface ILeafDataProxy {
|
|
7
7
|
__setAttr?(name: string, newValue: __Value): void
|
|
8
8
|
__getAttr?(name: string): __Value
|
|
9
|
+
setProxyAttr?(name: string, newValue: __Value): void
|
|
10
|
+
getProxyAttr?(name: string): __Value
|
|
9
11
|
}
|
|
10
12
|
|
|
@@ -6,7 +6,7 @@ export type ILeafMaskModule = ILeafMask & ThisType<ILeaf>
|
|
|
6
6
|
export interface ILeafMask {
|
|
7
7
|
__updateEraser?(value?: boolean): void
|
|
8
8
|
__updateMask?(value?: boolean): void
|
|
9
|
-
__renderMask?(canvas: ILeaferCanvas, content: ILeaferCanvas, mask: ILeaferCanvas): void
|
|
9
|
+
__renderMask?(canvas: ILeaferCanvas, content: ILeaferCanvas, mask: ILeaferCanvas, recycle?: boolean): void
|
|
10
10
|
__removeMask?(child?: ILeaf): void
|
|
11
11
|
}
|
|
12
12
|
|
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/IUIEvent.ts
CHANGED
|
@@ -23,10 +23,8 @@ export interface IUIEvent extends IEvent {
|
|
|
23
23
|
path?: ILeafList
|
|
24
24
|
throughPath?: ILeafList // 穿透path,不受层级影响,从上到下只要碰撞到区域就算,一般点击的时候
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
getInner?(target?: ILeaf): IPointData
|
|
29
|
-
getLocal?(target?: ILeaf): IPointData
|
|
26
|
+
getInner?(relative?: ILeaf): IPointData
|
|
27
|
+
getLocal?(relative?: ILeaf): IPointData
|
|
30
28
|
}
|
|
31
29
|
|
|
32
30
|
|
|
@@ -48,10 +46,10 @@ export interface IDragEvent extends IPointerEvent {
|
|
|
48
46
|
totalX?: number
|
|
49
47
|
totalY?: number
|
|
50
48
|
|
|
51
|
-
getInnerMove?(
|
|
52
|
-
getLocalMove?(
|
|
53
|
-
getInnerTotal?(
|
|
54
|
-
getLocalTotal?(
|
|
49
|
+
getInnerMove?(relative?: ILeaf): IPointData
|
|
50
|
+
getLocalMove?(relative?: ILeaf): IPointData
|
|
51
|
+
getInnerTotal?(relative?: ILeaf): IPointData
|
|
52
|
+
getLocalTotal?(relative?: ILeaf): IPointData
|
|
55
53
|
}
|
|
56
54
|
|
|
57
55
|
export interface IDropEvent extends IPointerEvent {
|
|
@@ -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
|
+
isPixel(config: ILeaferImageConfig): boolean // png / svg / webp
|
|
19
|
+
isFormat(format: IExportFileType, config: ILeaferImageConfig): boolean
|
|
17
20
|
destroy(): void
|
|
18
21
|
}
|
package/src/index.ts
CHANGED
|
@@ -5,7 +5,7 @@ export { IBranch } from './display/IBranch'
|
|
|
5
5
|
export { IZoomView } from './display/IView'
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
export { ILeafData, IDataProcessor } from './data/ILeafData'
|
|
8
|
+
export { ILeafData, IDataProcessor, ILeafDataOptions } from './data/ILeafData'
|
|
9
9
|
export { ILeafLayout, ILayoutLocationType, ILayoutBoundsType } from './layout/ILeafLayout'
|
|
10
10
|
|
|
11
11
|
export { ILeafDataProxy, ILeafDataProxyModule } from './display/module/ILeafDataProxy'
|
|
@@ -20,7 +20,7 @@ export { IBranchRender, IBranchRenderModule } from './display/module/IBranchRend
|
|
|
20
20
|
export { IRenderer, IRendererConfig, IRenderOptions } from './renderer/IRenderer'
|
|
21
21
|
export { IWatcher, IWatchEventData, IWatcherConfig } from './watcher/IWatcher'
|
|
22
22
|
export { ILayouter, ILayoutChangedData, ILayoutBlockData, ILayouterConfig, IPartLayoutConfig } from './layouter/ILayouter'
|
|
23
|
-
export { ISelector, ISelectorConfig, ISelectPathResult, ISelectPathOptions } from './selector/ISelector'
|
|
23
|
+
export { ISelector, ISelectorConfig, IFindMethod, ISelectPathResult, ISelectPathOptions } from './selector/ISelector'
|
|
24
24
|
|
|
25
25
|
export { ICanvasManager } from './canvas/ICanvasManager'
|
|
26
26
|
export { IHitCanvasManager } from './canvas/IHitCanvasManager'
|
|
@@ -35,7 +35,7 @@ export { IPlugin } from './plugin/IPlugin'
|
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
export { ILeaferCanvas, IHitCanvas, ICanvasAttr, ICanvasStrokeOptions, ILeaferCanvasConfig, IHitCanvasConfig, IBlobFunction, IBlob } from './canvas/ILeaferCanvas'
|
|
38
|
-
export { ISkiaCanvas, ISkiaCanvasExportConfig, ICanvasType } from './canvas/ISkiaCanvas'
|
|
38
|
+
export { ISkiaCanvas, ISkiaCanvasExportConfig, ICanvasType, ISkiaNAPICanvas } from './canvas/ISkiaCanvas'
|
|
39
39
|
export { IPathDrawer, IPathCreator } from './path/IPathDrawer'
|
|
40
40
|
export { IWindingRule, ICanvasContext2D, ITextMetrics, IPath2D } from './canvas/ICanvas'
|
|
41
41
|
export { CanvasPathCommand, IPathCommandData, MCommandData, HCommandData, VCommandData, LCommandData, CCommandData, SCommandData, QCommandData, TCommandData, ZCommandData, ACommandData, RectCommandData, RoundRectCommandData, EllipseCommandData, ArcCommandData, ArcToCommandData } from './path/IPathCommand'
|
|
@@ -44,7 +44,7 @@ export { ILeaferImage, ILeaferImageConfig, ILeaferImageOnLoaded, ILeaferImageOnE
|
|
|
44
44
|
export { IExportFileType, IExportImageType } from './file/IFileType'
|
|
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
49
|
export { IInteraction, IInteractionCanvas, IInteractionConfig, IWheelConfig, IPointerConfig } from './interaction/IInteraction'
|
|
50
50
|
|
|
@@ -48,6 +48,7 @@ export interface IInteraction extends IControl {
|
|
|
48
48
|
keyUp(data: IKeyEvent): void
|
|
49
49
|
|
|
50
50
|
findPath(data: IPointerEvent, options?: ISelectPathOptions): ILeafList
|
|
51
|
+
isDrag(leaf: ILeaf): boolean
|
|
51
52
|
|
|
52
53
|
updateDownData(data?: IPointerEvent): void
|
|
53
54
|
updateHoverData(data: IPointerEvent): void
|
|
@@ -82,7 +83,7 @@ export interface IMoveConfig {
|
|
|
82
83
|
}
|
|
83
84
|
|
|
84
85
|
export interface IWheelConfig {
|
|
85
|
-
zoomMode?: boolean
|
|
86
|
+
zoomMode?: boolean | 'mouse'
|
|
86
87
|
zoomSpeed?: number // 取值范围 0 ~ 1, 默认0.5
|
|
87
88
|
moveSpeed?: number
|
|
88
89
|
rotateSpeed?: number // 取值范围 0 ~ 1, 默认0.5
|
|
@@ -8,7 +8,7 @@ export interface ILeafLayout {
|
|
|
8
8
|
|
|
9
9
|
leaf: ILeaf
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
proxyZoom: boolean
|
|
12
12
|
|
|
13
13
|
// inner
|
|
14
14
|
|
|
@@ -30,10 +30,8 @@ export interface ILeafLayout {
|
|
|
30
30
|
|
|
31
31
|
// matrix changed
|
|
32
32
|
matrixChanged: boolean // include positionChanged scaleChanged skewChanged
|
|
33
|
-
positionChanged: boolean // x, y
|
|
34
|
-
originChanged?: boolean // originX originY
|
|
35
33
|
scaleChanged: boolean // scaleX scaleY
|
|
36
|
-
rotationChanged: boolean // rotaiton, skewX
|
|
34
|
+
rotationChanged: boolean // rotaiton, skewX skewY 数据更新
|
|
37
35
|
|
|
38
36
|
// bounds changed
|
|
39
37
|
boundsChanged: boolean
|
|
@@ -80,9 +78,9 @@ export interface ILeafLayout {
|
|
|
80
78
|
renderChange(): void
|
|
81
79
|
|
|
82
80
|
// matrix
|
|
83
|
-
positionChange(): void
|
|
84
81
|
scaleChange(): void
|
|
85
82
|
rotationChange(): void
|
|
83
|
+
matrixChange(): void
|
|
86
84
|
|
|
87
85
|
// face
|
|
88
86
|
surfaceChange(): void
|
package/src/math/IMath.ts
CHANGED
|
@@ -57,10 +57,11 @@ export interface IBounds extends IBoundsData {
|
|
|
57
57
|
clone(): IBounds
|
|
58
58
|
|
|
59
59
|
scale(scaleX: number, scaleY?: number): IBounds
|
|
60
|
+
scaleOf(origin: IPointData, scaleX: number, scaleY?: number): IBounds
|
|
60
61
|
toOuterOf(matrix: IMatrixData, to?: IBoundsData): IBounds
|
|
61
62
|
getFitMatrix(put: IBoundsData): IMatrix
|
|
62
63
|
|
|
63
|
-
spread(
|
|
64
|
+
spread(spreadX: number, spreadY?: number): IBounds
|
|
64
65
|
ceil(): IBounds
|
|
65
66
|
unsign(): IBounds
|
|
66
67
|
|
|
@@ -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
|
|
@@ -28,6 +30,13 @@ export interface IPlatform {
|
|
|
28
30
|
loadImage(url: string): Promise<any>
|
|
29
31
|
noRepeat?: string // fix: 微信小程序 createPattern 直接使用 no-repeat 有bug,导致无法显示
|
|
30
32
|
},
|
|
33
|
+
roundRectPatch?: boolean // fix: skia-canvas roundRect
|
|
34
|
+
ellipseToCurve?: boolean, // fix: skia 绘制圆环和椭圆弧
|
|
35
|
+
event?: {
|
|
36
|
+
stopDefault(origin: IObject): void
|
|
37
|
+
stopNow(origin: IObject): void
|
|
38
|
+
stop(origin: IObject): void
|
|
39
|
+
},
|
|
31
40
|
miniapp?: IMiniapp
|
|
32
41
|
imageSuffix?: string // 需要带上后缀区分dom中image标签的缓存,否则会导致浏览器缓存跨域问题
|
|
33
42
|
}
|
|
@@ -19,17 +19,24 @@ export interface ISelectorConfig {
|
|
|
19
19
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
export interface IFindMethod {
|
|
23
|
+
(leaf: ILeaf, options?: any): any
|
|
24
|
+
}
|
|
25
|
+
|
|
22
26
|
export interface ISelector {
|
|
23
27
|
target: ILeaf
|
|
24
28
|
|
|
29
|
+
list: ILeafList
|
|
30
|
+
|
|
25
31
|
config: ISelectorConfig
|
|
26
32
|
|
|
27
33
|
getByPoint(hitPoint: IPointData, hitRadius: number, options?: ISelectPathOptions): ISelectPathResult
|
|
28
34
|
|
|
29
|
-
|
|
30
|
-
getByInnerId(
|
|
31
|
-
getById(
|
|
32
|
-
getByClassName(
|
|
33
|
-
|
|
35
|
+
getBy(condition: number | string | IFindMethod, branch?: ILeaf, one?: boolean, options?: any): ILeaf | ILeaf[]
|
|
36
|
+
getByInnerId(innerId: number, branch?: ILeaf): ILeaf
|
|
37
|
+
getById(id: string, branch?: ILeaf): ILeaf
|
|
38
|
+
getByClassName(className: string, branch?: ILeaf): ILeaf[]
|
|
39
|
+
getByTag(tag: string, branch?: ILeaf): ILeaf[]
|
|
40
|
+
getByMethod(method: IFindMethod, branch?: ILeaf, one?: boolean, options?: any): ILeaf | ILeaf[]
|
|
34
41
|
destroy(): void
|
|
35
42
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -133,9 +133,10 @@ interface IBounds extends IBoundsData {
|
|
|
133
133
|
copy(bounds: IBoundsData): IBounds;
|
|
134
134
|
clone(): IBounds;
|
|
135
135
|
scale(scaleX: number, scaleY?: number): IBounds;
|
|
136
|
+
scaleOf(origin: IPointData, scaleX: number, scaleY?: number): IBounds;
|
|
136
137
|
toOuterOf(matrix: IMatrixData, to?: IBoundsData): IBounds;
|
|
137
138
|
getFitMatrix(put: IBoundsData): IMatrix;
|
|
138
|
-
spread(
|
|
139
|
+
spread(spreadX: number, spreadY?: number): IBounds;
|
|
139
140
|
ceil(): IBounds;
|
|
140
141
|
unsign(): IBounds;
|
|
141
142
|
add(bounds: IBoundsData): IBounds;
|
|
@@ -269,6 +270,7 @@ interface ILayouter extends IControl {
|
|
|
269
270
|
}
|
|
270
271
|
|
|
271
272
|
interface IEvent {
|
|
273
|
+
origin?: IObject;
|
|
272
274
|
type?: string;
|
|
273
275
|
target?: IEventTarget;
|
|
274
276
|
current?: IEventTarget;
|
|
@@ -319,25 +321,6 @@ interface ILayoutEvent extends IEvent {
|
|
|
319
321
|
interface IWatchEvent extends IEvent {
|
|
320
322
|
readonly data: IWatchEventData;
|
|
321
323
|
}
|
|
322
|
-
interface ITransformEventData {
|
|
323
|
-
x: number;
|
|
324
|
-
y: number;
|
|
325
|
-
scaleX: number;
|
|
326
|
-
scaleY: number;
|
|
327
|
-
rotation: number;
|
|
328
|
-
readonly zooming: boolean;
|
|
329
|
-
readonly moving: boolean;
|
|
330
|
-
readonly rotating: boolean;
|
|
331
|
-
readonly changing: boolean;
|
|
332
|
-
}
|
|
333
|
-
interface ITransformEvent extends IEvent, ITransformEventData {
|
|
334
|
-
readonly x: number;
|
|
335
|
-
readonly y: number;
|
|
336
|
-
readonly scaleX: number;
|
|
337
|
-
readonly scaleY: number;
|
|
338
|
-
readonly rotation: number;
|
|
339
|
-
}
|
|
340
|
-
type TransformMode = 'move' | 'zoom' | 'rotate';
|
|
341
324
|
interface IMultiTouchData {
|
|
342
325
|
move: IPointData;
|
|
343
326
|
scale: number;
|
|
@@ -886,6 +869,7 @@ interface IPointDataFunction {
|
|
|
886
869
|
}
|
|
887
870
|
|
|
888
871
|
interface IRenderOptions {
|
|
872
|
+
includes?: boolean;
|
|
889
873
|
bounds?: IBounds;
|
|
890
874
|
hideBounds?: IBounds;
|
|
891
875
|
matrix?: IMatrix;
|
|
@@ -926,6 +910,8 @@ type ILeafDataProxyModule = ILeafDataProxy & ThisType<ILeaf>;
|
|
|
926
910
|
interface ILeafDataProxy {
|
|
927
911
|
__setAttr?(name: string, newValue: __Value): void;
|
|
928
912
|
__getAttr?(name: string): __Value;
|
|
913
|
+
setProxyAttr?(name: string, newValue: __Value): void;
|
|
914
|
+
getProxyAttr?(name: string): __Value;
|
|
929
915
|
}
|
|
930
916
|
|
|
931
917
|
type ILeafMatrixModule = ILeafMatrix & ThisType<ILeaf>;
|
|
@@ -953,7 +939,7 @@ type ILayoutLocationType = 'world' | 'local' | 'inner';
|
|
|
953
939
|
type ILayoutBoundsType = 'content' | 'box' | 'stroke' | 'margin' | 'render';
|
|
954
940
|
interface ILeafLayout {
|
|
955
941
|
leaf: ILeaf;
|
|
956
|
-
|
|
942
|
+
proxyZoom: boolean;
|
|
957
943
|
boxBounds: IBoundsData;
|
|
958
944
|
strokeBounds: IBoundsData;
|
|
959
945
|
renderBounds: IBoundsData;
|
|
@@ -962,8 +948,6 @@ interface ILeafLayout {
|
|
|
962
948
|
localStrokeBounds: IBoundsData;
|
|
963
949
|
localRenderBounds: IBoundsData;
|
|
964
950
|
matrixChanged: boolean;
|
|
965
|
-
positionChanged: boolean;
|
|
966
|
-
originChanged?: boolean;
|
|
967
951
|
scaleChanged: boolean;
|
|
968
952
|
rotationChanged: boolean;
|
|
969
953
|
boundsChanged: boolean;
|
|
@@ -993,9 +977,9 @@ interface ILeafLayout {
|
|
|
993
977
|
localBoxChange(): void;
|
|
994
978
|
strokeChange(): void;
|
|
995
979
|
renderChange(): void;
|
|
996
|
-
positionChange(): void;
|
|
997
980
|
scaleChange(): void;
|
|
998
981
|
rotationChange(): void;
|
|
982
|
+
matrixChange(): void;
|
|
999
983
|
surfaceChange(): void;
|
|
1000
984
|
opacityChange(): void;
|
|
1001
985
|
childrenSortChange(): void;
|
|
@@ -1024,7 +1008,7 @@ type ILeafMaskModule = ILeafMask & ThisType<ILeaf>;
|
|
|
1024
1008
|
interface ILeafMask {
|
|
1025
1009
|
__updateEraser?(value?: boolean): void;
|
|
1026
1010
|
__updateMask?(value?: boolean): void;
|
|
1027
|
-
__renderMask?(canvas: ILeaferCanvas, content: ILeaferCanvas, mask: ILeaferCanvas): void;
|
|
1011
|
+
__renderMask?(canvas: ILeaferCanvas, content: ILeaferCanvas, mask: ILeaferCanvas, recycle?: boolean): void;
|
|
1028
1012
|
__removeMask?(child?: ILeaf): void;
|
|
1029
1013
|
}
|
|
1030
1014
|
|
|
@@ -1038,14 +1022,48 @@ interface IDataProcessor extends IObject {
|
|
|
1038
1022
|
__setInput(name: string, value: any): void;
|
|
1039
1023
|
__getInput(name: string): any;
|
|
1040
1024
|
__removeInput(name: string): void;
|
|
1041
|
-
__getInputData(): IObject;
|
|
1025
|
+
__getInputData(options?: ILeafDataOptions): IObject;
|
|
1042
1026
|
__setMiddle(name: string, value: any): void;
|
|
1043
1027
|
__getMiddle(name: string): any;
|
|
1044
1028
|
destroy(): void;
|
|
1045
1029
|
}
|
|
1030
|
+
interface ILeafDataOptions {
|
|
1031
|
+
attrs?: 'all' | string[];
|
|
1032
|
+
children?: boolean;
|
|
1033
|
+
}
|
|
1046
1034
|
interface ILeafData extends IDataProcessor, ILeafComputedData {
|
|
1047
1035
|
}
|
|
1048
1036
|
|
|
1037
|
+
interface ISelectPathResult {
|
|
1038
|
+
leaf: ILeaf;
|
|
1039
|
+
path: ILeafList;
|
|
1040
|
+
throughPath?: ILeafList;
|
|
1041
|
+
}
|
|
1042
|
+
interface ISelectPathOptions {
|
|
1043
|
+
name?: string;
|
|
1044
|
+
through?: boolean;
|
|
1045
|
+
exclude?: ILeafList;
|
|
1046
|
+
ignoreHittable?: boolean;
|
|
1047
|
+
}
|
|
1048
|
+
interface ISelectorConfig {
|
|
1049
|
+
}
|
|
1050
|
+
interface IFindMethod {
|
|
1051
|
+
(leaf: ILeaf, options?: any): any;
|
|
1052
|
+
}
|
|
1053
|
+
interface ISelector {
|
|
1054
|
+
target: ILeaf;
|
|
1055
|
+
list: ILeafList;
|
|
1056
|
+
config: ISelectorConfig;
|
|
1057
|
+
getByPoint(hitPoint: IPointData, hitRadius: number, options?: ISelectPathOptions): ISelectPathResult;
|
|
1058
|
+
getBy(condition: number | string | IFindMethod, branch?: ILeaf, one?: boolean, options?: any): ILeaf | ILeaf[];
|
|
1059
|
+
getByInnerId(innerId: number, branch?: ILeaf): ILeaf;
|
|
1060
|
+
getById(id: string, branch?: ILeaf): ILeaf;
|
|
1061
|
+
getByClassName(className: string, branch?: ILeaf): ILeaf[];
|
|
1062
|
+
getByTag(tag: string, branch?: ILeaf): ILeaf[];
|
|
1063
|
+
getByMethod(method: IFindMethod, branch?: ILeaf, one?: boolean, options?: any): ILeaf | ILeaf[];
|
|
1064
|
+
destroy(): void;
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1049
1067
|
interface ICachedLeaf {
|
|
1050
1068
|
canvas: ILeaferCanvas;
|
|
1051
1069
|
matrix?: IMatrix;
|
|
@@ -1076,13 +1094,14 @@ interface ILeafAttrData {
|
|
|
1076
1094
|
hittable: __Boolean;
|
|
1077
1095
|
hitFill: IHitType;
|
|
1078
1096
|
hitStroke: IHitType;
|
|
1097
|
+
hitBox: __Boolean;
|
|
1079
1098
|
hitChildren: __Boolean;
|
|
1080
1099
|
hitSelf: __Boolean;
|
|
1081
1100
|
hitRadius: __Number;
|
|
1082
1101
|
cursor: ICursorType | ICursorType[];
|
|
1083
1102
|
}
|
|
1084
1103
|
type IHitType = 'path' | 'pixel' | 'all' | 'none';
|
|
1085
|
-
type IBlendMode = 'pass-through' | 'normal' | 'multiply' | 'screen' | 'overlay' | 'darken' | 'lighten' | 'color-dodge' | 'color-burn' | 'hard-light' | 'soft-light' | 'difference' | 'exclusion' | 'hue' | 'saturation' | 'color' | 'luminosity' | 'source-over' | 'source-in' | 'source-out' | 'source-atop' | 'destination-over' | 'destination-in' | 'destination-out' | 'destination-atop';
|
|
1104
|
+
type IBlendMode = 'pass-through' | 'normal' | 'multiply' | 'screen' | 'overlay' | 'darken' | 'lighten' | 'color-dodge' | 'color-burn' | 'hard-light' | 'soft-light' | 'difference' | 'exclusion' | 'hue' | 'saturation' | 'color' | 'luminosity' | 'source-over' | 'source-in' | 'source-out' | 'source-atop' | 'destination-over' | 'destination-in' | 'destination-out' | 'destination-atop' | 'xor';
|
|
1086
1105
|
type IResizeType = 'size' | 'scale';
|
|
1087
1106
|
interface IImageCursor {
|
|
1088
1107
|
url: string;
|
|
@@ -1120,6 +1139,7 @@ interface ILeafInputData extends IObject {
|
|
|
1120
1139
|
hittable?: __Boolean;
|
|
1121
1140
|
hitFill?: IHitType;
|
|
1122
1141
|
hitStroke?: IHitType;
|
|
1142
|
+
hitBox?: __Boolean;
|
|
1123
1143
|
hitChildren?: __Boolean;
|
|
1124
1144
|
hitSelf?: __Boolean;
|
|
1125
1145
|
hitRadius?: __Number;
|
|
@@ -1150,6 +1170,7 @@ interface ILeafComputedData {
|
|
|
1150
1170
|
hittable?: boolean;
|
|
1151
1171
|
hitFill?: IHitType;
|
|
1152
1172
|
hitStroke?: IHitType;
|
|
1173
|
+
hitBox?: boolean;
|
|
1153
1174
|
hitChildren?: boolean;
|
|
1154
1175
|
hitSelf?: boolean;
|
|
1155
1176
|
hitRadius?: number;
|
|
@@ -1172,6 +1193,7 @@ interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, ILeafMatr
|
|
|
1172
1193
|
isBranch?: boolean;
|
|
1173
1194
|
isBranchLeaf?: boolean;
|
|
1174
1195
|
__: ILeafData;
|
|
1196
|
+
proxyData?: ILeafInputData;
|
|
1175
1197
|
__layout: ILeafLayout;
|
|
1176
1198
|
__world: IMatrixWithLayoutData;
|
|
1177
1199
|
__local: IMatrixWithBoundsData;
|
|
@@ -1183,7 +1205,6 @@ interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, ILeafMatr
|
|
|
1183
1205
|
readonly worldStrokeBounds: IBoundsData;
|
|
1184
1206
|
readonly worldRenderBounds: IBoundsData;
|
|
1185
1207
|
readonly worldOpacity: number;
|
|
1186
|
-
__renderTime?: number;
|
|
1187
1208
|
__level: number;
|
|
1188
1209
|
__tempNumber?: number;
|
|
1189
1210
|
readonly resizeable: boolean;
|
|
@@ -1196,15 +1217,22 @@ interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, ILeafMatr
|
|
|
1196
1217
|
__parentWait?: IFunction[];
|
|
1197
1218
|
__leaferWait?: IFunction[];
|
|
1198
1219
|
destroyed: boolean;
|
|
1220
|
+
reset(data?: ILeafInputData): void;
|
|
1221
|
+
resetCustom(): void;
|
|
1199
1222
|
waitParent(item: IFunction): void;
|
|
1200
1223
|
waitLeafer(item: IFunction): void;
|
|
1201
1224
|
nextRender(item: IFunction): void;
|
|
1202
1225
|
__bindLeafer(leafer: ILeafer | null): void;
|
|
1203
1226
|
set(data: IObject): void;
|
|
1227
|
+
get(options?: ILeafDataOptions): ILeafInputData;
|
|
1204
1228
|
toJSON(): IObject;
|
|
1205
1229
|
toString(): string;
|
|
1206
1230
|
__setAttr(attrName: string, newValue: __Value): void;
|
|
1207
1231
|
__getAttr(attrName: string): __Value;
|
|
1232
|
+
setProxyAttr(name: string, newValue: __Value): void;
|
|
1233
|
+
getProxyAttr(name: string): __Value;
|
|
1234
|
+
find(condition: number | string | IFindMethod): ILeaf[];
|
|
1235
|
+
findOne(condition: number | string | IFindMethod): ILeaf;
|
|
1208
1236
|
forceUpdate(attrName?: string): void;
|
|
1209
1237
|
__updateWorldMatrix(): void;
|
|
1210
1238
|
__updateLocalMatrix(): void;
|
|
@@ -1221,7 +1249,7 @@ interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, ILeafMatr
|
|
|
1221
1249
|
__onUpdateSize(): void;
|
|
1222
1250
|
__updateEraser(value?: boolean): void;
|
|
1223
1251
|
__updateMask(value?: boolean): void;
|
|
1224
|
-
__renderMask(canvas: ILeaferCanvas, content: ILeaferCanvas, mask: ILeaferCanvas): void;
|
|
1252
|
+
__renderMask(canvas: ILeaferCanvas, content: ILeaferCanvas, mask: ILeaferCanvas, recycle?: boolean): void;
|
|
1225
1253
|
__removeMask(child?: ILeaf): void;
|
|
1226
1254
|
getWorld(attrName: IMatrixDecompositionAttr): number;
|
|
1227
1255
|
getBounds(type: ILayoutBoundsType, locationType?: ILayoutLocationType): IBoundsData;
|
|
@@ -1259,31 +1287,6 @@ interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, ILeafMatr
|
|
|
1259
1287
|
remove(child?: ILeaf, destroy?: boolean): void;
|
|
1260
1288
|
}
|
|
1261
1289
|
|
|
1262
|
-
interface ISelectPathResult {
|
|
1263
|
-
leaf: ILeaf;
|
|
1264
|
-
path: ILeafList;
|
|
1265
|
-
throughPath?: ILeafList;
|
|
1266
|
-
}
|
|
1267
|
-
interface ISelectPathOptions {
|
|
1268
|
-
name?: string;
|
|
1269
|
-
through?: boolean;
|
|
1270
|
-
exclude?: ILeafList;
|
|
1271
|
-
ignoreHittable?: boolean;
|
|
1272
|
-
}
|
|
1273
|
-
interface ISelectorConfig {
|
|
1274
|
-
}
|
|
1275
|
-
interface ISelector {
|
|
1276
|
-
target: ILeaf;
|
|
1277
|
-
config: ISelectorConfig;
|
|
1278
|
-
getByPoint(hitPoint: IPointData, hitRadius: number, options?: ISelectPathOptions): ISelectPathResult;
|
|
1279
|
-
find(name: number | string, branch?: ILeaf): ILeaf | ILeaf[];
|
|
1280
|
-
getByInnerId(name: number, branch?: ILeaf): ILeaf;
|
|
1281
|
-
getById(name: string, branch?: ILeaf): ILeaf;
|
|
1282
|
-
getByClassName(name: string, branch?: ILeaf): ILeaf[];
|
|
1283
|
-
getByTagName(name: string, branch?: ILeaf): ILeaf[];
|
|
1284
|
-
destroy(): void;
|
|
1285
|
-
}
|
|
1286
|
-
|
|
1287
1290
|
type IExportImageType = 'jpg' | 'png' | 'webp';
|
|
1288
1291
|
type IExportFileType = IExportImageType | 'svg' | 'pdf' | 'json';
|
|
1289
1292
|
|
|
@@ -1331,9 +1334,8 @@ interface IUIEvent extends IEvent {
|
|
|
1331
1334
|
buttons?: number;
|
|
1332
1335
|
path?: ILeafList;
|
|
1333
1336
|
throughPath?: ILeafList;
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
getLocal?(target?: ILeaf): IPointData;
|
|
1337
|
+
getInner?(relative?: ILeaf): IPointData;
|
|
1338
|
+
getLocal?(relative?: ILeaf): IPointData;
|
|
1337
1339
|
}
|
|
1338
1340
|
interface IPointerEvent extends IUIEvent {
|
|
1339
1341
|
width?: number;
|
|
@@ -1351,10 +1353,10 @@ interface IDragEvent extends IPointerEvent {
|
|
|
1351
1353
|
moveY: number;
|
|
1352
1354
|
totalX?: number;
|
|
1353
1355
|
totalY?: number;
|
|
1354
|
-
getInnerMove?(
|
|
1355
|
-
getLocalMove?(
|
|
1356
|
-
getInnerTotal?(
|
|
1357
|
-
getLocalTotal?(
|
|
1356
|
+
getInnerMove?(relative?: ILeaf): IPointData;
|
|
1357
|
+
getLocalMove?(relative?: ILeaf): IPointData;
|
|
1358
|
+
getInnerTotal?(relative?: ILeaf): IPointData;
|
|
1359
|
+
getLocalTotal?(relative?: ILeaf): IPointData;
|
|
1358
1360
|
}
|
|
1359
1361
|
interface IDropEvent extends IPointerEvent {
|
|
1360
1362
|
list: ILeafList;
|
|
@@ -1408,6 +1410,7 @@ interface IInteraction extends IControl {
|
|
|
1408
1410
|
keyDown(data: IKeyEvent): void;
|
|
1409
1411
|
keyUp(data: IKeyEvent): void;
|
|
1410
1412
|
findPath(data: IPointerEvent, options?: ISelectPathOptions): ILeafList;
|
|
1413
|
+
isDrag(leaf: ILeaf): boolean;
|
|
1411
1414
|
updateDownData(data?: IPointerEvent): void;
|
|
1412
1415
|
updateHoverData(data: IPointerEvent): void;
|
|
1413
1416
|
updateCursor(hoverData?: IPointerEvent): void;
|
|
@@ -1434,7 +1437,7 @@ interface IMoveConfig {
|
|
|
1434
1437
|
autoDistance?: number;
|
|
1435
1438
|
}
|
|
1436
1439
|
interface IWheelConfig {
|
|
1437
|
-
zoomMode?: boolean;
|
|
1440
|
+
zoomMode?: boolean | 'mouse';
|
|
1438
1441
|
zoomSpeed?: number;
|
|
1439
1442
|
moveSpeed?: number;
|
|
1440
1443
|
rotateSpeed?: number;
|
|
@@ -1474,9 +1477,7 @@ interface IBranch extends ILeaf {
|
|
|
1474
1477
|
|
|
1475
1478
|
interface IZoomView extends IBranch {
|
|
1476
1479
|
zoomLayer?: ILeaf;
|
|
1477
|
-
|
|
1478
|
-
transformData?: ITransformEventData;
|
|
1479
|
-
setZoomLayer(zoomLayer: ILeaf, moveLayer?: ILeaf): void;
|
|
1480
|
+
setZoomLayer(zoomLayer: ILeaf): void;
|
|
1480
1481
|
}
|
|
1481
1482
|
|
|
1482
1483
|
type ILeaferType = 'draw' | 'design' | 'board' | 'document' | 'user';
|
|
@@ -1506,10 +1507,12 @@ interface ILeafer extends IZoomView, IControl {
|
|
|
1506
1507
|
hitCanvasManager?: IHitCanvasManager;
|
|
1507
1508
|
autoLayout?: IAutoBounds;
|
|
1508
1509
|
config: ILeaferConfig;
|
|
1510
|
+
readonly cursorPoint: IPointData;
|
|
1511
|
+
leafs: number;
|
|
1509
1512
|
__eventIds: IEventListenerId[];
|
|
1510
1513
|
__nextRenderWait: IFunction[];
|
|
1511
1514
|
init(userConfig?: ILeaferConfig, parentApp?: IApp): void;
|
|
1512
|
-
setZoomLayer(zoomLayer: ILeaf
|
|
1515
|
+
setZoomLayer(zoomLayer: ILeaf): void;
|
|
1513
1516
|
forceFullRender(): void;
|
|
1514
1517
|
updateCursor(): void;
|
|
1515
1518
|
resize(size: IScreenSizeData): void;
|
|
@@ -1605,14 +1608,46 @@ interface IImageManager {
|
|
|
1605
1608
|
get(config: ILeaferImageConfig): ILeaferImage;
|
|
1606
1609
|
recycle(image: ILeaferImage): void;
|
|
1607
1610
|
clearRecycled(): void;
|
|
1611
|
+
isPixel(config: ILeaferImageConfig): boolean;
|
|
1612
|
+
isFormat(format: IExportFileType, config: ILeaferImageConfig): boolean;
|
|
1608
1613
|
destroy(): void;
|
|
1609
1614
|
}
|
|
1610
1615
|
|
|
1616
|
+
type ICanvasType = 'skia' | 'napi' | 'canvas' | 'wx';
|
|
1617
|
+
interface ISkiaCanvas {
|
|
1618
|
+
toBuffer(format: IExportFileType, config: ISkiaCanvasExportConfig): Promise<any>;
|
|
1619
|
+
toBufferSync(format: IExportFileType, config: ISkiaCanvasExportConfig): any;
|
|
1620
|
+
toDataURL(format: IExportImageType, config: ISkiaCanvasExportConfig): Promise<string>;
|
|
1621
|
+
toDataURLSync(format: IExportImageType, config: ISkiaCanvasExportConfig): string;
|
|
1622
|
+
saveAs(filename: string, config: ISkiaCanvasExportConfig): Promise<void>;
|
|
1623
|
+
saveAsSync(filename: string, config: ISkiaCanvasExportConfig): void;
|
|
1624
|
+
}
|
|
1625
|
+
interface ISkiaCanvasExportConfig {
|
|
1626
|
+
page?: number;
|
|
1627
|
+
matte?: string;
|
|
1628
|
+
density?: number;
|
|
1629
|
+
quality?: number;
|
|
1630
|
+
outline?: boolean;
|
|
1631
|
+
}
|
|
1632
|
+
interface ISkiaNAPICanvas {
|
|
1633
|
+
encodeSync(format: 'webp' | 'jpeg', quality?: number): any;
|
|
1634
|
+
encodeSync(format: 'png'): any;
|
|
1635
|
+
encode(format: 'webp' | 'jpeg' | string, quality?: number): Promise<any>;
|
|
1636
|
+
encode(format: 'png'): Promise<any>;
|
|
1637
|
+
toBuffer(mime: 'image/png'): any;
|
|
1638
|
+
toBuffer(mime: 'image/jpeg' | 'image/webp' | string, quality?: number): any;
|
|
1639
|
+
toDataURL(mime?: 'image/png'): string;
|
|
1640
|
+
toDataURL(mime: 'image/jpeg' | 'image/webp' | string, quality?: number): string;
|
|
1641
|
+
toDataURLAsync(mime?: 'image/png'): Promise<string>;
|
|
1642
|
+
toDataURLAsync(mime: 'image/jpeg' | 'image/webp' | string, quality?: number): Promise<string>;
|
|
1643
|
+
}
|
|
1644
|
+
|
|
1611
1645
|
interface IPlatform {
|
|
1612
1646
|
name?: 'web' | 'node' | 'miniapp';
|
|
1613
1647
|
os?: 'Mac' | 'Windows' | 'Linux';
|
|
1614
1648
|
requestRender?(render: IFunction): void;
|
|
1615
1649
|
canvas?: ILeaferCanvas;
|
|
1650
|
+
canvasType?: ICanvasType;
|
|
1616
1651
|
isWorker?: boolean;
|
|
1617
1652
|
isMobile?: boolean;
|
|
1618
1653
|
devicePixelRatio?: number;
|
|
@@ -1631,6 +1666,13 @@ interface IPlatform {
|
|
|
1631
1666
|
loadImage(url: string): Promise<any>;
|
|
1632
1667
|
noRepeat?: string;
|
|
1633
1668
|
};
|
|
1669
|
+
roundRectPatch?: boolean;
|
|
1670
|
+
ellipseToCurve?: boolean;
|
|
1671
|
+
event?: {
|
|
1672
|
+
stopDefault(origin: IObject): void;
|
|
1673
|
+
stopNow(origin: IObject): void;
|
|
1674
|
+
stop(origin: IObject): void;
|
|
1675
|
+
};
|
|
1634
1676
|
miniapp?: IMiniapp;
|
|
1635
1677
|
imageSuffix?: string;
|
|
1636
1678
|
}
|
|
@@ -1656,21 +1698,4 @@ interface IPlugin extends IObject {
|
|
|
1656
1698
|
onLeafer?(leafer: ILeafer): void;
|
|
1657
1699
|
}
|
|
1658
1700
|
|
|
1659
|
-
type ICanvasType
|
|
1660
|
-
interface ISkiaCanvas {
|
|
1661
|
-
toBuffer(format: IExportFileType, config: ISkiaCanvasExportConfig): Promise<any>;
|
|
1662
|
-
toBufferSync(format: IExportFileType, config: ISkiaCanvasExportConfig): any;
|
|
1663
|
-
toDataURL(format: IExportImageType, config: ISkiaCanvasExportConfig): Promise<string>;
|
|
1664
|
-
toDataURLSync(format: IExportImageType, config: ISkiaCanvasExportConfig): string;
|
|
1665
|
-
saveAs(filename: string, config: ISkiaCanvasExportConfig): Promise<void>;
|
|
1666
|
-
saveAsSync(filename: string, config: ISkiaCanvasExportConfig): void;
|
|
1667
|
-
}
|
|
1668
|
-
interface ISkiaCanvasExportConfig {
|
|
1669
|
-
page?: number;
|
|
1670
|
-
matte?: string;
|
|
1671
|
-
density?: number;
|
|
1672
|
-
quality?: number;
|
|
1673
|
-
outline?: boolean;
|
|
1674
|
-
}
|
|
1675
|
-
|
|
1676
|
-
export type { ACommandData, ArcCommandData, ArcToCommandData, CCommandData, CanvasPathCommand, EllipseCommandData, HCommandData, IAnimateEvent, IApp, IAround, IAutoBounds, IAutoBoundsData, IBlendMode, IBlob, IBlobFunction, IBooleanMap, IBounds, IBoundsData, IBoundsDataHandle, IBranch, IBranchRender, IBranchRenderModule, ICachedLeaf, ICanvasAttr, ICanvasContext2D, ICanvasManager, ICanvasStrokeOptions, ICanvasType, IChildEvent, IControl, ICreator, ICursorType, ICursorTypeMap, IDataProcessor, IDataTypeHandle, IDragEvent, IDropEvent, IEvent, IEventListener, IEventListenerId, IEventListenerItem, IEventListenerMap, IEventListenerOptions, IEventTarget, IEventer, IExportFileType, IExportImageType, IFunction, IHitCanvas, IHitCanvasConfig, IHitCanvasManager, IHitType, IImageEvent, IImageManager, IInteraction, IInteractionCanvas, IInteractionConfig, IKeepTouchData, IKeyEvent, ILayoutBlockData, ILayoutBoundsType, ILayoutChangedData, ILayoutEvent, ILayoutLocationType, ILayouter, ILayouterConfig, ILeaf, ILeafArrayMap, ILeafAttrData, ILeafBounds, ILeafBoundsModule, ILeafComputedData, ILeafData, ILeafDataProxy, ILeafDataProxyModule, ILeafEventer, ILeafEventerModule, ILeafHit, ILeafHitModule, ILeafInputData, ILeafLayout, ILeafLevelList, ILeafList, ILeafListItemCallback, ILeafMap, ILeafMask, ILeafMaskModule, ILeafMatrix, ILeafMatrixModule, ILeafRender, ILeafRenderModule, ILeafer, ILeaferCanvas, ILeaferCanvasConfig, ILeaferConfig, ILeaferEvent, ILeaferImage, ILeaferImageConfig, ILeaferImageOnError, ILeaferImageOnLoaded, ILeaferType, ILeaferTypeCreator, ILeaferTypeFunction, ILeaferTypeList, IMatrix, IMatrixData, IMatrixDecompositionAttr, IMatrixDecompositionData, IMatrixWithBoundsData, IMatrixWithLayoutData, IMiniapp, IMiniappSelect, IMiniappSizeView, IMoveEvent, IMultiTouchData, INumberMap, IObject, IOffsetBoundsData, IPartLayoutConfig, IPath2D, IPathCommandData, IPathCreator, IPathDrawer, IPathString, IPlatform, IPlugin, IPoint, IPointData, IPointerConfig, IPointerEvent, IPropertyEvent, IRadiusPointData, IRenderEvent, IRenderOptions, IRenderer, IRendererConfig, IResizeEvent, IResizeEventListener, IResizeType, IRotateEvent, IScreenSizeData, ISelectPathOptions, ISelectPathResult, ISelector, ISelectorConfig, ISize, ISizeData, ISkiaCanvas, ISkiaCanvasExportConfig, IStringMap, ISwipeEvent, ITaskItem, ITaskOptions, ITaskProcessor, ITaskProcessorConfig, ITextMetrics, ITimer, ITransformEvent, ITransformEventData, ITwoPointBounds, ITwoPointBoundsData, IUICreator, IUIEvent, IUpdateEvent, IWatchEvent, IWatchEventData, IWatcher, IWatcherConfig, IWheelConfig, IWindingRule, IZoomEvent, IZoomView, InnerId, LCommandData, MCommandData, PointerType, QCommandData, RectCommandData, RoundRectCommandData, SCommandData, TCommandData, TransformMode, VCommandData, ZCommandData, __Boolean, __Number, __Object, __String, __Value };
|
|
1701
|
+
export type { ACommandData, ArcCommandData, ArcToCommandData, CCommandData, CanvasPathCommand, EllipseCommandData, HCommandData, IAnimateEvent, IApp, IAround, IAutoBounds, IAutoBoundsData, IBlendMode, IBlob, IBlobFunction, IBooleanMap, IBounds, IBoundsData, IBoundsDataHandle, IBranch, IBranchRender, IBranchRenderModule, ICachedLeaf, ICanvasAttr, ICanvasContext2D, ICanvasManager, ICanvasStrokeOptions, ICanvasType, IChildEvent, IControl, ICreator, ICursorType, ICursorTypeMap, IDataProcessor, IDataTypeHandle, IDragEvent, IDropEvent, IEvent, IEventListener, IEventListenerId, IEventListenerItem, IEventListenerMap, IEventListenerOptions, IEventTarget, IEventer, IExportFileType, IExportImageType, IFindMethod, IFunction, IHitCanvas, IHitCanvasConfig, IHitCanvasManager, IHitType, IImageEvent, IImageManager, IInteraction, IInteractionCanvas, IInteractionConfig, IKeepTouchData, IKeyEvent, ILayoutBlockData, ILayoutBoundsType, ILayoutChangedData, ILayoutEvent, ILayoutLocationType, ILayouter, ILayouterConfig, ILeaf, ILeafArrayMap, ILeafAttrData, ILeafBounds, ILeafBoundsModule, ILeafComputedData, ILeafData, ILeafDataOptions, ILeafDataProxy, ILeafDataProxyModule, ILeafEventer, ILeafEventerModule, ILeafHit, ILeafHitModule, ILeafInputData, ILeafLayout, ILeafLevelList, ILeafList, ILeafListItemCallback, ILeafMap, ILeafMask, ILeafMaskModule, ILeafMatrix, ILeafMatrixModule, ILeafRender, ILeafRenderModule, ILeafer, ILeaferCanvas, ILeaferCanvasConfig, ILeaferConfig, ILeaferEvent, ILeaferImage, ILeaferImageConfig, ILeaferImageOnError, ILeaferImageOnLoaded, ILeaferType, ILeaferTypeCreator, ILeaferTypeFunction, ILeaferTypeList, IMatrix, IMatrixData, IMatrixDecompositionAttr, IMatrixDecompositionData, IMatrixWithBoundsData, IMatrixWithLayoutData, IMiniapp, IMiniappSelect, IMiniappSizeView, IMoveEvent, IMultiTouchData, INumberMap, IObject, IOffsetBoundsData, IPartLayoutConfig, IPath2D, IPathCommandData, IPathCreator, IPathDrawer, IPathString, IPlatform, IPlugin, IPoint, IPointData, IPointerConfig, IPointerEvent, IPropertyEvent, IRadiusPointData, IRenderEvent, IRenderOptions, IRenderer, IRendererConfig, IResizeEvent, IResizeEventListener, IResizeType, IRotateEvent, IScreenSizeData, ISelectPathOptions, ISelectPathResult, ISelector, ISelectorConfig, ISize, ISizeData, ISkiaCanvas, ISkiaCanvasExportConfig, ISkiaNAPICanvas, IStringMap, ISwipeEvent, ITaskItem, ITaskOptions, ITaskProcessor, ITaskProcessorConfig, ITextMetrics, ITimer, ITwoPointBounds, ITwoPointBoundsData, IUICreator, IUIEvent, IUpdateEvent, IWatchEvent, IWatchEventData, IWatcher, IWatcherConfig, IWheelConfig, IWindingRule, IZoomEvent, IZoomView, InnerId, LCommandData, MCommandData, PointerType, QCommandData, RectCommandData, RoundRectCommandData, SCommandData, TCommandData, VCommandData, ZCommandData, __Boolean, __Number, __Object, __String, __Value };
|