@leafer/interface 1.11.2 → 1.12.1
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/display/ILeaf.ts +2 -2
- package/src/image/IImageManager.ts +6 -1
- package/src/image/ILeaferImage.ts +6 -2
- package/src/layouter/ILayouter.ts +1 -0
- package/src/path/IPathCommand.ts +0 -1
- package/src/platform/IPlatform.ts +5 -1
- package/src/renderer/IRenderer.ts +4 -0
- package/src/watcher/IWatcher.ts +2 -1
- package/types/index.d.ts +35 -24
package/package.json
CHANGED
package/src/display/ILeaf.ts
CHANGED
|
@@ -679,8 +679,8 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
|
|
|
679
679
|
|
|
680
680
|
// ILeafHit ->
|
|
681
681
|
hit(world: IPointData, hitRadius?: number): boolean
|
|
682
|
-
__hitWorld(point: IRadiusPointData): boolean
|
|
683
|
-
__hit(local: IRadiusPointData): boolean
|
|
682
|
+
__hitWorld(point: IRadiusPointData, forceHitFill?: boolean): boolean
|
|
683
|
+
__hit(local: IRadiusPointData, forceHitFill?: boolean): boolean
|
|
684
684
|
__hitFill(inner: IRadiusPointData): boolean
|
|
685
685
|
__hitStroke(inner: IRadiusPointData, strokeWidth: number): boolean
|
|
686
686
|
__hitPixel(inner: IRadiusPointData): boolean
|
|
@@ -12,7 +12,12 @@ export interface IImageManager {
|
|
|
12
12
|
|
|
13
13
|
get(config: ILeaferImageConfig): ILeaferImage
|
|
14
14
|
recycle(image: ILeaferImage): void
|
|
15
|
-
|
|
15
|
+
|
|
16
|
+
recyclePaint(paint: any): void
|
|
17
|
+
|
|
18
|
+
clearRecycled(force?: boolean): void
|
|
19
|
+
clearLevels(): void
|
|
20
|
+
|
|
16
21
|
hasAlphaPixel(config: ILeaferImageConfig): boolean // png / svg / webp
|
|
17
22
|
isFormat(format: IExportFileType, config: ILeaferImageConfig): boolean
|
|
18
23
|
|
|
@@ -2,7 +2,7 @@ import { ICanvasPattern } from '../canvas/ICanvas'
|
|
|
2
2
|
import { IObject } from '../data/IData'
|
|
3
3
|
import { InnerId } from '../event/IEventer'
|
|
4
4
|
import { IExportFileType } from '../file/IFileType'
|
|
5
|
-
import { IMatrixData, IPointData } from '../math/IMath'
|
|
5
|
+
import { IBoundsData, IMatrixData, IPointData } from '../math/IMath'
|
|
6
6
|
import { ILeaferCanvas } from '../canvas/ILeaferCanvas'
|
|
7
7
|
import { IProgressData } from '../event/IProgress'
|
|
8
8
|
import { IImageCrossOrigin } from '../platform/IPlatform'
|
|
@@ -44,6 +44,7 @@ export interface ILeaferImageSliceData {
|
|
|
44
44
|
|
|
45
45
|
export interface ILeaferImageSlice {
|
|
46
46
|
view?: any
|
|
47
|
+
bounds?: IBoundsData
|
|
47
48
|
task?: ITaskItem
|
|
48
49
|
}
|
|
49
50
|
|
|
@@ -53,6 +54,7 @@ export interface ILeaferImageLevel {
|
|
|
53
54
|
view?: any
|
|
54
55
|
url?: string
|
|
55
56
|
slice?: ILeaferImageSliceData
|
|
57
|
+
use?: number // 引用次数
|
|
56
58
|
}
|
|
57
59
|
|
|
58
60
|
export interface ILeaferImage {
|
|
@@ -80,7 +82,7 @@ export interface ILeaferImage {
|
|
|
80
82
|
|
|
81
83
|
progress?: IProgressData // 加载进度
|
|
82
84
|
|
|
83
|
-
use: number
|
|
85
|
+
use: number // 引用次数
|
|
84
86
|
config: ILeaferImageConfig
|
|
85
87
|
|
|
86
88
|
load(onSuccess?: ILeaferImageOnLoaded, onError?: ILeaferImageOnError): number
|
|
@@ -88,6 +90,8 @@ export interface ILeaferImage {
|
|
|
88
90
|
getFull(filters?: IObject): any
|
|
89
91
|
getCanvas(width: number, height: number, opacity?: number, filters?: IObject, xGap?: number, yGap?: number, smooth?: boolean): any
|
|
90
92
|
getPattern(canvas: any, repeat: string | null, transform?: IMatrixData, paint?: IObject): ICanvasPattern
|
|
93
|
+
|
|
94
|
+
clearLevels(checkUse?: boolean): void
|
|
91
95
|
destroy(): void
|
|
92
96
|
}
|
|
93
97
|
|
package/src/path/IPathCommand.ts
CHANGED
|
@@ -118,7 +118,6 @@ export interface ClosePathCommandNode {
|
|
|
118
118
|
a?: IPointData
|
|
119
119
|
b?: IPointData
|
|
120
120
|
ab?: PathNodeHandleType
|
|
121
|
-
|
|
122
121
|
}
|
|
123
122
|
|
|
124
123
|
export type IPathCommandNode = MoveToCommandNode | LineToCommandNode | BezierCurveToCommandNode | ClosePathCommandNode // M | L | C | Z 路径节点命令(适合可视化编辑)
|
|
@@ -39,6 +39,7 @@ export interface IPlatform {
|
|
|
39
39
|
|
|
40
40
|
origin?: {
|
|
41
41
|
createCanvas(width: number, height: number, format?: 'svg' | 'pdf'): any
|
|
42
|
+
createOffscreenCanvas?(width: number, height: number, format?: 'svg' | 'pdf'): any
|
|
42
43
|
canvasToDataURL(canvas: any, type?: IExportImageType, quality?: number): string | Promise<string>
|
|
43
44
|
canvasToBolb(canvas: any, type?: IExportFileType, quality?: number): Promise<any>
|
|
44
45
|
canvasSaveAs(canvas: any, filename: string, quality?: number): Promise<void>
|
|
@@ -74,7 +75,10 @@ export interface IPlatform {
|
|
|
74
75
|
getRealURL: IStringFunction // 处理前缀、后缀
|
|
75
76
|
resize(image: any, width: number, height: number, xGap?: number, yGap?: number, clip?: IBoundsData, smooth?: boolean, opacity?: number, filters?: IObject): any
|
|
76
77
|
setPatternTransform(pattern: ICanvasPattern, transform?: IMatrixData, paint?: IObject): void
|
|
77
|
-
}
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
canCreateImageBitmap?: boolean // 是否能使用 createImageBitmap
|
|
81
|
+
canClipImageBitmap?: boolean // 是否能使用 createImageBitmap 裁剪图片
|
|
78
82
|
}
|
|
79
83
|
|
|
80
84
|
export type IImageCrossOrigin = 'anonymous' | 'use-credentials' // 图片跨域设置
|
|
@@ -4,6 +4,7 @@ import { IBounds, IMatrixWithScaleData } from '../math/IMath'
|
|
|
4
4
|
import { IFunction } from '../function/IFunction'
|
|
5
5
|
import { IControl } from '../control/IControl'
|
|
6
6
|
import { ILeafList } from '../data/IList'
|
|
7
|
+
import { IObject } from '../data/IData'
|
|
7
8
|
|
|
8
9
|
export interface IRenderOptions {
|
|
9
10
|
includes?: boolean,
|
|
@@ -21,10 +22,13 @@ export interface IRenderOptions {
|
|
|
21
22
|
shape?: boolean
|
|
22
23
|
ignoreFill?: boolean, // 绘制外形时忽略fill
|
|
23
24
|
ignoreStroke?: boolean // 绘制外形时忽略stroke
|
|
25
|
+
|
|
26
|
+
cellList?: ILeafList
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
export interface IRendererConfig {
|
|
27
30
|
usePartRender?: boolean
|
|
31
|
+
useCellRender?: boolean | IObject
|
|
28
32
|
maxFPS?: number
|
|
29
33
|
fill?: string
|
|
30
34
|
}
|
package/src/watcher/IWatcher.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { ILeaf } from '../display/ILeaf'
|
|
2
2
|
import { ILeafList } from '../data/IList'
|
|
3
3
|
import { IControl } from '../control/IControl'
|
|
4
|
+
import { ILayouterConfig } from '../layouter/ILayouter'
|
|
4
5
|
|
|
5
6
|
export interface IWatchEventData {
|
|
6
7
|
updatedList: ILeafList
|
|
7
8
|
}
|
|
8
9
|
|
|
9
|
-
export interface IWatcherConfig {
|
|
10
|
+
export interface IWatcherConfig extends ILayouterConfig {
|
|
10
11
|
|
|
11
12
|
}
|
|
12
13
|
|
package/types/index.d.ts
CHANGED
|
@@ -296,27 +296,6 @@ interface IControl {
|
|
|
296
296
|
destroy(): void;
|
|
297
297
|
}
|
|
298
298
|
|
|
299
|
-
interface IWatchEventData {
|
|
300
|
-
updatedList: ILeafList;
|
|
301
|
-
}
|
|
302
|
-
interface IWatcherConfig {
|
|
303
|
-
}
|
|
304
|
-
interface IWatcher extends IControl {
|
|
305
|
-
target: ILeaf;
|
|
306
|
-
totalTimes: number;
|
|
307
|
-
disabled: boolean;
|
|
308
|
-
running: boolean;
|
|
309
|
-
changed: boolean;
|
|
310
|
-
hasVisible: boolean;
|
|
311
|
-
hasAdd: boolean;
|
|
312
|
-
hasRemove: boolean;
|
|
313
|
-
readonly childrenChanged: boolean;
|
|
314
|
-
config: IWatcherConfig;
|
|
315
|
-
updatedList: ILeafList;
|
|
316
|
-
disable(): void;
|
|
317
|
-
update(): void;
|
|
318
|
-
}
|
|
319
|
-
|
|
320
299
|
interface ILayoutChangedData {
|
|
321
300
|
matrixList: ILeaf[];
|
|
322
301
|
boundsList: ILeaf[];
|
|
@@ -337,6 +316,7 @@ interface IPartLayoutConfig {
|
|
|
337
316
|
maxTimes?: number;
|
|
338
317
|
}
|
|
339
318
|
interface ILayouterConfig {
|
|
319
|
+
usePartLayout?: boolean;
|
|
340
320
|
partLayout?: IPartLayoutConfig;
|
|
341
321
|
}
|
|
342
322
|
interface ILayouter extends IControl {
|
|
@@ -362,6 +342,27 @@ interface ILayouter extends IControl {
|
|
|
362
342
|
addBlocks(current: ILayoutBlockData[]): void;
|
|
363
343
|
}
|
|
364
344
|
|
|
345
|
+
interface IWatchEventData {
|
|
346
|
+
updatedList: ILeafList;
|
|
347
|
+
}
|
|
348
|
+
interface IWatcherConfig extends ILayouterConfig {
|
|
349
|
+
}
|
|
350
|
+
interface IWatcher extends IControl {
|
|
351
|
+
target: ILeaf;
|
|
352
|
+
totalTimes: number;
|
|
353
|
+
disabled: boolean;
|
|
354
|
+
running: boolean;
|
|
355
|
+
changed: boolean;
|
|
356
|
+
hasVisible: boolean;
|
|
357
|
+
hasAdd: boolean;
|
|
358
|
+
hasRemove: boolean;
|
|
359
|
+
readonly childrenChanged: boolean;
|
|
360
|
+
config: IWatcherConfig;
|
|
361
|
+
updatedList: ILeafList;
|
|
362
|
+
disable(): void;
|
|
363
|
+
update(): void;
|
|
364
|
+
}
|
|
365
|
+
|
|
365
366
|
interface IEvent {
|
|
366
367
|
origin?: IObject;
|
|
367
368
|
type?: string;
|
|
@@ -1192,9 +1193,11 @@ interface IRenderOptions {
|
|
|
1192
1193
|
shape?: boolean;
|
|
1193
1194
|
ignoreFill?: boolean;
|
|
1194
1195
|
ignoreStroke?: boolean;
|
|
1196
|
+
cellList?: ILeafList;
|
|
1195
1197
|
}
|
|
1196
1198
|
interface IRendererConfig {
|
|
1197
1199
|
usePartRender?: boolean;
|
|
1200
|
+
useCellRender?: boolean | IObject;
|
|
1198
1201
|
maxFPS?: number;
|
|
1199
1202
|
fill?: string;
|
|
1200
1203
|
}
|
|
@@ -1820,8 +1823,8 @@ interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDa
|
|
|
1820
1823
|
resizeWidth(width: number): void;
|
|
1821
1824
|
resizeHeight(height: number): void;
|
|
1822
1825
|
hit(world: IPointData, hitRadius?: number): boolean;
|
|
1823
|
-
__hitWorld(point: IRadiusPointData): boolean;
|
|
1824
|
-
__hit(local: IRadiusPointData): boolean;
|
|
1826
|
+
__hitWorld(point: IRadiusPointData, forceHitFill?: boolean): boolean;
|
|
1827
|
+
__hit(local: IRadiusPointData, forceHitFill?: boolean): boolean;
|
|
1825
1828
|
__hitFill(inner: IRadiusPointData): boolean;
|
|
1826
1829
|
__hitStroke(inner: IRadiusPointData, strokeWidth: number): boolean;
|
|
1827
1830
|
__hitPixel(inner: IRadiusPointData): boolean;
|
|
@@ -1917,6 +1920,7 @@ interface IPlatform {
|
|
|
1917
1920
|
render?(target: ILeaf, canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
1918
1921
|
origin?: {
|
|
1919
1922
|
createCanvas(width: number, height: number, format?: 'svg' | 'pdf'): any;
|
|
1923
|
+
createOffscreenCanvas?(width: number, height: number, format?: 'svg' | 'pdf'): any;
|
|
1920
1924
|
canvasToDataURL(canvas: any, type?: IExportImageType, quality?: number): string | Promise<string>;
|
|
1921
1925
|
canvasToBolb(canvas: any, type?: IExportFileType, quality?: number): Promise<any>;
|
|
1922
1926
|
canvasSaveAs(canvas: any, filename: string, quality?: number): Promise<void>;
|
|
@@ -1949,6 +1953,8 @@ interface IPlatform {
|
|
|
1949
1953
|
resize(image: any, width: number, height: number, xGap?: number, yGap?: number, clip?: IBoundsData, smooth?: boolean, opacity?: number, filters?: IObject): any;
|
|
1950
1954
|
setPatternTransform(pattern: ICanvasPattern, transform?: IMatrixData, paint?: IObject): void;
|
|
1951
1955
|
};
|
|
1956
|
+
canCreateImageBitmap?: boolean;
|
|
1957
|
+
canClipImageBitmap?: boolean;
|
|
1952
1958
|
}
|
|
1953
1959
|
type IImageCrossOrigin = 'anonymous' | 'use-credentials';
|
|
1954
1960
|
interface IMiniappSelect extends IObject {
|
|
@@ -2036,6 +2042,7 @@ interface ILeaferImageSliceData {
|
|
|
2036
2042
|
}
|
|
2037
2043
|
interface ILeaferImageSlice {
|
|
2038
2044
|
view?: any;
|
|
2045
|
+
bounds?: IBoundsData;
|
|
2039
2046
|
task?: ITaskItem;
|
|
2040
2047
|
}
|
|
2041
2048
|
interface ILeaferImageLevel {
|
|
@@ -2044,6 +2051,7 @@ interface ILeaferImageLevel {
|
|
|
2044
2051
|
view?: any;
|
|
2045
2052
|
url?: string;
|
|
2046
2053
|
slice?: ILeaferImageSliceData;
|
|
2054
|
+
use?: number;
|
|
2047
2055
|
}
|
|
2048
2056
|
interface ILeaferImage {
|
|
2049
2057
|
readonly innerId: InnerId;
|
|
@@ -2070,6 +2078,7 @@ interface ILeaferImage {
|
|
|
2070
2078
|
getFull(filters?: IObject): any;
|
|
2071
2079
|
getCanvas(width: number, height: number, opacity?: number, filters?: IObject, xGap?: number, yGap?: number, smooth?: boolean): any;
|
|
2072
2080
|
getPattern(canvas: any, repeat: string | null, transform?: IMatrixData, paint?: IObject): ICanvasPattern;
|
|
2081
|
+
clearLevels(checkUse?: boolean): void;
|
|
2073
2082
|
destroy(): void;
|
|
2074
2083
|
}
|
|
2075
2084
|
|
|
@@ -2427,7 +2436,9 @@ interface IImageManager {
|
|
|
2427
2436
|
patternLocked?: boolean;
|
|
2428
2437
|
get(config: ILeaferImageConfig): ILeaferImage;
|
|
2429
2438
|
recycle(image: ILeaferImage): void;
|
|
2430
|
-
|
|
2439
|
+
recyclePaint(paint: any): void;
|
|
2440
|
+
clearRecycled(force?: boolean): void;
|
|
2441
|
+
clearLevels(): void;
|
|
2431
2442
|
hasAlphaPixel(config: ILeaferImageConfig): boolean;
|
|
2432
2443
|
isFormat(format: IExportFileType, config: ILeaferImageConfig): boolean;
|
|
2433
2444
|
destroy(): void;
|