@leafer/interface 1.9.12 → 1.10.0
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 -0
- package/src/event/IUIEvent.ts +4 -0
- package/src/image/ILeaferImage.ts +33 -2
- package/src/index.ts +3 -3
- package/src/math/IMath.ts +1 -0
- package/src/platform/IPlatform.ts +11 -5
- package/src/task/ITaskProcessor.ts +3 -1
- package/types/index.d.ts +169 -137
package/package.json
CHANGED
package/src/display/ILeaf.ts
CHANGED
|
@@ -449,6 +449,8 @@ export interface ILeafComputedData {
|
|
|
449
449
|
__path2DForRender?: IPath2D
|
|
450
450
|
__pathForArrow?: IPathCommandData
|
|
451
451
|
__pathForMotion?: IMotionPathData
|
|
452
|
+
|
|
453
|
+
__clipAfterFill?: boolean // 一般用于判断是否裁剪 Box
|
|
452
454
|
}
|
|
453
455
|
|
|
454
456
|
export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDataProxy, ILeafInputData, IEventer {
|
package/src/event/IUIEvent.ts
CHANGED
|
@@ -51,6 +51,10 @@ export interface IPointerEvent extends IUIEvent {
|
|
|
51
51
|
}
|
|
52
52
|
export type PointerType = 'mouse' | 'pen' | 'touch'
|
|
53
53
|
|
|
54
|
+
export interface ITouchEvent extends IUIEvent {
|
|
55
|
+
|
|
56
|
+
}
|
|
57
|
+
|
|
54
58
|
export interface IDragEvent extends IPointerEvent {
|
|
55
59
|
moveX: number
|
|
56
60
|
moveY: number
|
|
@@ -2,14 +2,18 @@ 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 } from '../math/IMath'
|
|
5
|
+
import { IMatrixData, IPointData } from '../math/IMath'
|
|
6
6
|
import { ILeaferCanvas } from '../canvas/ILeaferCanvas'
|
|
7
7
|
import { IProgressData } from '../event/IProgress'
|
|
8
|
+
import { IImageCrossOrigin } from '../platform/IPlatform'
|
|
9
|
+
import { ITaskItem } from '../task/ITaskProcessor'
|
|
10
|
+
import { IRangeSize } from '../display/ILeaf'
|
|
8
11
|
|
|
9
12
|
export interface ILeaferImageConfig {
|
|
10
13
|
url: string
|
|
11
14
|
thumb?: string
|
|
12
15
|
format?: IExportFileType
|
|
16
|
+
crossOrigin?: IImageCrossOrigin
|
|
13
17
|
showProgress?: boolean // 是否显示进度
|
|
14
18
|
view?: IObject | ILeaferImage | ILeaferCanvas
|
|
15
19
|
}
|
|
@@ -31,6 +35,26 @@ export interface ILeaferImagePatternPaint {
|
|
|
31
35
|
transform: IMatrixData
|
|
32
36
|
}
|
|
33
37
|
|
|
38
|
+
export interface ILeaferImageSliceData {
|
|
39
|
+
size: number
|
|
40
|
+
columns: number,
|
|
41
|
+
total: number,
|
|
42
|
+
list?: ILeaferImageSlice[]
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface ILeaferImageSlice {
|
|
46
|
+
view?: any
|
|
47
|
+
task?: ITaskItem
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface ILeaferImageLevel {
|
|
51
|
+
level: number
|
|
52
|
+
scale: number | IPointData
|
|
53
|
+
view?: any
|
|
54
|
+
url?: string
|
|
55
|
+
slice?: ILeaferImageSliceData
|
|
56
|
+
}
|
|
57
|
+
|
|
34
58
|
export interface ILeaferImage {
|
|
35
59
|
readonly innerId: InnerId
|
|
36
60
|
readonly url: string
|
|
@@ -46,8 +70,15 @@ export interface ILeaferImage {
|
|
|
46
70
|
ready: boolean
|
|
47
71
|
error: IObject
|
|
48
72
|
loading: boolean
|
|
73
|
+
|
|
49
74
|
isPlacehold?: boolean // 是否显示占位符,一般在加载100ms后自动判断
|
|
50
|
-
|
|
75
|
+
|
|
76
|
+
largeThumb?: ILeaferImageLevel
|
|
77
|
+
levels?: ILeaferImageLevel[]
|
|
78
|
+
levelsRange?: IRangeSize
|
|
79
|
+
minLevel?: number
|
|
80
|
+
|
|
81
|
+
progress?: IProgressData // 加载进度
|
|
51
82
|
|
|
52
83
|
use: number
|
|
53
84
|
config: ILeaferImageConfig
|
package/src/index.ts
CHANGED
|
@@ -29,7 +29,7 @@ export { ITaskProcessor, ITaskProcessorConfig, ITaskItem, ITaskOptions } from '.
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
export { IControl } from './control/IControl'
|
|
32
|
-
export { IPlatform, IMiniapp, IMiniappSelect, IMiniappSizeView } from './platform/IPlatform'
|
|
32
|
+
export { IPlatform, IImageCrossOrigin, IMiniapp, IMiniappSelect, IMiniappSizeView } from './platform/IPlatform'
|
|
33
33
|
export { IPlugin } from './plugin/IPlugin'
|
|
34
34
|
|
|
35
35
|
|
|
@@ -40,14 +40,14 @@ export { IMotionPathData } from './path/IPathData'
|
|
|
40
40
|
export { IWindingRule, ICanvasContext2D, ICanvasContext2DSettings, ITextMetrics, IPath2D, ICanvasPattern } from './canvas/ICanvas'
|
|
41
41
|
export { CanvasPathCommand, IPathCommandData, MCommandData, HCommandData, VCommandData, LCommandData, CCommandData, SCommandData, QCommandData, TCommandData, ZCommandData, ACommandData, RectCommandData, RoundRectCommandData, EllipseCommandData, ArcCommandData, ArcToCommandData, MoveToCommandObject, LineToCommandObject, BezierCurveToCommandObject, QuadraticCurveToCommandObject, IPathCommandObject } from './path/IPathCommand'
|
|
42
42
|
|
|
43
|
-
export { ILeaferImage, ILeaferImageConfig, ILeaferImageOnLoaded, ILeaferImageOnError, ILeaferImageCacheCanvas, ILeaferImagePatternPaint } from './image/ILeaferImage'
|
|
43
|
+
export { ILeaferImage, ILeaferImageConfig, ILeaferImageSliceData, ILeaferImageSlice, ILeaferImageLevel, ILeaferImageOnLoaded, ILeaferImageOnError, ILeaferImageCacheCanvas, ILeaferImagePatternPaint } from './image/ILeaferImage'
|
|
44
44
|
export { IResource } from './file/IResource'
|
|
45
45
|
export { IExportFileType, IExportImageType } from './file/IFileType'
|
|
46
46
|
export { IExportOptions, IJSONOptions, IExportResult, IExportResultFunction, IExportOnCanvasFunction } from './file/IExport'
|
|
47
47
|
|
|
48
48
|
export { InnerId, IEventer, IEventParamsMap, IEventParams, IEventListener, IEventOption, IEventListenerOptions, IEventListenerMap, IEventListenerItem, IEventListenerId } from './event/IEventer'
|
|
49
49
|
export { IEventTarget, IEvent, ILeaferEvent, IPropertyEvent, ILayoutEvent, IRenderEvent, IAnimateEvent, IChildEvent, IBoundsEvent, IResizeEvent, IResizeEventListener, IUpdateEvent, IWatchEvent, IMultiTouchData, IGestureType, IKeepTouchData } from './event/IEvent'
|
|
50
|
-
export { IUIEvent, IPointerEvent, PointerType, IDragEvent, IDropEvent, ISwipeEvent, IMoveEvent, IZoomEvent, IRotateEvent, IWheelEvent, IKeyEvent, IShortcutKeys, IShortcutKeysCheck, IShortcutKeyCodes, IKeyCodes, IImageEvent } from './event/IUIEvent'
|
|
50
|
+
export { IUIEvent, IPointerEvent, ITouchEvent, PointerType, IDragEvent, IDropEvent, ISwipeEvent, IMoveEvent, IZoomEvent, IRotateEvent, IWheelEvent, IKeyEvent, IShortcutKeys, IShortcutKeysCheck, IShortcutKeyCodes, IKeyCodes, IImageEvent } from './event/IUIEvent'
|
|
51
51
|
export { IProgressData, IProgressFunction } from './event/IProgress'
|
|
52
52
|
|
|
53
53
|
export { ICursorTypeMap, ICursorRotate, ICursorRotateMap } from './interaction/ICursor'
|
package/src/math/IMath.ts
CHANGED
|
@@ -2,12 +2,13 @@ import { IFunction, IStringFunction } from '../function/IFunction'
|
|
|
2
2
|
import { ILeaferCanvas } from '../canvas/ILeaferCanvas'
|
|
3
3
|
import { ILeaf } from '../display/ILeaf'
|
|
4
4
|
import { IExportFileType, IExportImageType } from '../file/IFileType'
|
|
5
|
-
import { IBoundsData, ISizeData } from '../math/IMath'
|
|
5
|
+
import { IBoundsData, ISizeData, IMatrixData } from '../math/IMath'
|
|
6
6
|
import { IObject } from '../data/IData'
|
|
7
7
|
import { ICanvasType } from '../canvas/ISkiaCanvas'
|
|
8
8
|
import { ISelector } from '../selector/ISelector'
|
|
9
|
-
import { IProgressFunction } from '../event/IProgress'
|
|
10
9
|
import { IRenderOptions } from '../renderer/IRenderer'
|
|
10
|
+
import { ILeaferImage } from '../image/ILeaferImage'
|
|
11
|
+
import { ICanvasPattern } from '../canvas/ICanvas'
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
export interface IPlatform {
|
|
@@ -42,8 +43,7 @@ export interface IPlatform {
|
|
|
42
43
|
canvasToBolb(canvas: any, type?: IExportFileType, quality?: number): Promise<any>
|
|
43
44
|
canvasSaveAs(canvas: any, filename: string, quality?: number): Promise<void>
|
|
44
45
|
download(url: string, filename: string): Promise<void>
|
|
45
|
-
loadImage(url: string,
|
|
46
|
-
loadImageWithProgress?(url: string, progressFn?: IProgressFunction): Promise<any>
|
|
46
|
+
loadImage(url: string, crossOrigin?: IImageCrossOrigin, leaferImage?: ILeaferImage): Promise<any>
|
|
47
47
|
noRepeat?: string // fix: 微信小程序 createPattern 直接使用 no-repeat 有bug,导致无法显示
|
|
48
48
|
Image?: any
|
|
49
49
|
PointerEvent?: any
|
|
@@ -68,11 +68,17 @@ export interface IPlatform {
|
|
|
68
68
|
maxPatternSize: number // 最大repeat pattern缓存, 默认4k: 4096 * 2160
|
|
69
69
|
prefix?: string // url加前缀
|
|
70
70
|
suffix?: string // 需要带上后缀区分dom中image标签的缓存,否则会导致浏览器缓存跨域问题
|
|
71
|
-
crossOrigin:
|
|
71
|
+
crossOrigin: IImageCrossOrigin // 图片跨域设置
|
|
72
|
+
isLarge(size: ISizeData, scaleX?: number, scaleY?: number, largeSize?: number): boolean // 比 maxCacheSize 尺寸更大
|
|
73
|
+
isSuperLarge(size: ISizeData, scaleX?: number, scaleY?: number): boolean // 比 maxPatternSize 尺寸更大
|
|
72
74
|
getRealURL: IStringFunction // 处理前缀、后缀
|
|
75
|
+
resize(image: any, width: number, height: number, xGap?: number, yGap?: number, clip?: IBoundsData, smooth?: boolean, opacity?: number, filters?: IObject): any
|
|
76
|
+
setPatternTransform(pattern: ICanvasPattern, transform?: IMatrixData, paint?: IObject): void
|
|
73
77
|
}
|
|
74
78
|
}
|
|
75
79
|
|
|
80
|
+
export type IImageCrossOrigin = 'anonymous' | 'use-credentials' // 图片跨域设置
|
|
81
|
+
|
|
76
82
|
|
|
77
83
|
export interface IMiniappSelect extends IObject { }
|
|
78
84
|
|
|
@@ -21,7 +21,7 @@ export interface ITaskProcessor {
|
|
|
21
21
|
resume(): void
|
|
22
22
|
skip(): void
|
|
23
23
|
stop(): void
|
|
24
|
-
add(taskCallback: IFunction, options?: ITaskOptions | number): ITaskItem
|
|
24
|
+
add(taskCallback: IFunction, options?: ITaskOptions | number, canUse?: IFunction): ITaskItem
|
|
25
25
|
destroy(): void
|
|
26
26
|
}
|
|
27
27
|
|
|
@@ -31,6 +31,7 @@ export interface ITaskItem {
|
|
|
31
31
|
isComplete: boolean
|
|
32
32
|
isCancel: boolean
|
|
33
33
|
time: number
|
|
34
|
+
canUse?: IFunction
|
|
34
35
|
run(): Promise<void>
|
|
35
36
|
complete(): void
|
|
36
37
|
cancel(): void
|
|
@@ -41,4 +42,5 @@ export interface ITaskOptions {
|
|
|
41
42
|
time?: number // default 1
|
|
42
43
|
parallel?: boolean // default true
|
|
43
44
|
delay?: number // default 0
|
|
45
|
+
canUse?: IFunction
|
|
44
46
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -130,6 +130,7 @@ interface IMatrixData {
|
|
|
130
130
|
d: number;
|
|
131
131
|
e: number;
|
|
132
132
|
f: number;
|
|
133
|
+
onlyScale?: boolean;
|
|
133
134
|
}
|
|
134
135
|
interface IScaleData {
|
|
135
136
|
scaleX: number;
|
|
@@ -1622,6 +1623,7 @@ interface ILeafComputedData {
|
|
|
1622
1623
|
__path2DForRender?: IPath2D;
|
|
1623
1624
|
__pathForArrow?: IPathCommandData;
|
|
1624
1625
|
__pathForMotion?: IMotionPathData;
|
|
1626
|
+
__clipAfterFill?: boolean;
|
|
1625
1627
|
}
|
|
1626
1628
|
interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDataProxy, ILeafInputData, IEventer {
|
|
1627
1629
|
tag: string;
|
|
@@ -1828,10 +1830,152 @@ interface IProgressFunction {
|
|
|
1828
1830
|
(progress: IProgressData): void;
|
|
1829
1831
|
}
|
|
1830
1832
|
|
|
1833
|
+
type ICanvasType = 'skia' | 'napi' | 'canvas' | 'miniapp';
|
|
1834
|
+
interface ISkiaCanvas {
|
|
1835
|
+
toBuffer(format: IExportFileType, config: ISkiaCanvasExportConfig): Promise<any>;
|
|
1836
|
+
toBufferSync(format: IExportFileType, config: ISkiaCanvasExportConfig): any;
|
|
1837
|
+
toDataURL(format: IExportImageType, config: ISkiaCanvasExportConfig): Promise<string>;
|
|
1838
|
+
toDataURLSync(format: IExportImageType, config: ISkiaCanvasExportConfig): string;
|
|
1839
|
+
saveAs(filename: string, config: ISkiaCanvasExportConfig): Promise<void>;
|
|
1840
|
+
saveAsSync(filename: string, config: ISkiaCanvasExportConfig): void;
|
|
1841
|
+
}
|
|
1842
|
+
interface ISkiaCanvasExportConfig {
|
|
1843
|
+
page?: number;
|
|
1844
|
+
matte?: string;
|
|
1845
|
+
density?: number;
|
|
1846
|
+
quality?: number;
|
|
1847
|
+
outline?: boolean;
|
|
1848
|
+
}
|
|
1849
|
+
interface ISkiaNAPICanvas {
|
|
1850
|
+
encodeSync(format: 'webp' | 'jpeg', quality?: number): any;
|
|
1851
|
+
encodeSync(format: 'png'): any;
|
|
1852
|
+
encode(format: 'webp' | 'jpeg' | string, quality?: number): Promise<any>;
|
|
1853
|
+
encode(format: 'png'): Promise<any>;
|
|
1854
|
+
toBuffer(mime: 'image/png'): any;
|
|
1855
|
+
toBuffer(mime: 'image/jpeg' | 'image/webp' | string, quality?: number): any;
|
|
1856
|
+
toDataURL(mime?: 'image/png'): string;
|
|
1857
|
+
toDataURL(mime: 'image/jpeg' | 'image/webp' | string, quality?: number): string;
|
|
1858
|
+
toDataURLAsync(mime?: 'image/png'): Promise<string>;
|
|
1859
|
+
toDataURLAsync(mime: 'image/jpeg' | 'image/webp' | string, quality?: number): Promise<string>;
|
|
1860
|
+
}
|
|
1861
|
+
|
|
1862
|
+
interface IPlatform {
|
|
1863
|
+
name?: 'web' | 'node' | 'miniapp';
|
|
1864
|
+
os?: 'Mac' | 'Windows' | 'Linux';
|
|
1865
|
+
toURL(text: string, fileType?: 'text' | 'svg'): string;
|
|
1866
|
+
requestRender?(render: IFunction): void;
|
|
1867
|
+
canvas?: ILeaferCanvas;
|
|
1868
|
+
renderCanvas?: ILeaferCanvas;
|
|
1869
|
+
canvasType?: ICanvasType;
|
|
1870
|
+
isWorker?: boolean;
|
|
1871
|
+
isMobile?: boolean;
|
|
1872
|
+
readonly devicePixelRatio?: number;
|
|
1873
|
+
intWheelDeltaY?: boolean;
|
|
1874
|
+
conicGradientSupport?: boolean;
|
|
1875
|
+
conicGradientRotate90?: boolean;
|
|
1876
|
+
fullImageShadow?: boolean;
|
|
1877
|
+
syncDomFont?: boolean;
|
|
1878
|
+
selector?: ISelector;
|
|
1879
|
+
getSelector?(leaf: ILeaf): ISelector;
|
|
1880
|
+
layout?(target: ILeaf): void;
|
|
1881
|
+
render?(target: ILeaf, canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
1882
|
+
origin?: {
|
|
1883
|
+
createCanvas(width: number, height: number, format?: 'svg' | 'pdf'): any;
|
|
1884
|
+
canvasToDataURL(canvas: any, type?: IExportImageType, quality?: number): string | Promise<string>;
|
|
1885
|
+
canvasToBolb(canvas: any, type?: IExportFileType, quality?: number): Promise<any>;
|
|
1886
|
+
canvasSaveAs(canvas: any, filename: string, quality?: number): Promise<void>;
|
|
1887
|
+
download(url: string, filename: string): Promise<void>;
|
|
1888
|
+
loadImage(url: string, crossOrigin?: IImageCrossOrigin, leaferImage?: ILeaferImage): Promise<any>;
|
|
1889
|
+
noRepeat?: string;
|
|
1890
|
+
Image?: any;
|
|
1891
|
+
PointerEvent?: any;
|
|
1892
|
+
DragEvent?: any;
|
|
1893
|
+
};
|
|
1894
|
+
roundRectPatch?: boolean;
|
|
1895
|
+
ellipseToCurve?: boolean;
|
|
1896
|
+
backgrounder?: boolean;
|
|
1897
|
+
event?: {
|
|
1898
|
+
stopDefault(origin: IObject): void;
|
|
1899
|
+
stopNow(origin: IObject): void;
|
|
1900
|
+
stop(origin: IObject): void;
|
|
1901
|
+
};
|
|
1902
|
+
miniapp?: IMiniapp;
|
|
1903
|
+
image: {
|
|
1904
|
+
hitCanvasSize: number;
|
|
1905
|
+
maxCacheSize: number;
|
|
1906
|
+
maxPatternSize: number;
|
|
1907
|
+
prefix?: string;
|
|
1908
|
+
suffix?: string;
|
|
1909
|
+
crossOrigin: IImageCrossOrigin;
|
|
1910
|
+
isLarge(size: ISizeData, scaleX?: number, scaleY?: number, largeSize?: number): boolean;
|
|
1911
|
+
isSuperLarge(size: ISizeData, scaleX?: number, scaleY?: number): boolean;
|
|
1912
|
+
getRealURL: IStringFunction;
|
|
1913
|
+
resize(image: any, width: number, height: number, xGap?: number, yGap?: number, clip?: IBoundsData, smooth?: boolean, opacity?: number, filters?: IObject): any;
|
|
1914
|
+
setPatternTransform(pattern: ICanvasPattern, transform?: IMatrixData, paint?: IObject): void;
|
|
1915
|
+
};
|
|
1916
|
+
}
|
|
1917
|
+
type IImageCrossOrigin = 'anonymous' | 'use-credentials';
|
|
1918
|
+
interface IMiniappSelect extends IObject {
|
|
1919
|
+
}
|
|
1920
|
+
interface IMiniappSizeView extends ISizeData {
|
|
1921
|
+
view: any;
|
|
1922
|
+
}
|
|
1923
|
+
interface IMiniapp {
|
|
1924
|
+
select(name: string): IMiniappSelect;
|
|
1925
|
+
getBounds(select: IMiniappSelect): Promise<IBoundsData>;
|
|
1926
|
+
getSizeView(select: IMiniappSelect): Promise<IMiniappSizeView>;
|
|
1927
|
+
onWindowResize(fun: IFunction): void;
|
|
1928
|
+
offWindowResize(fun: IFunction): void;
|
|
1929
|
+
saveToAlbum(path: string): Promise<any>;
|
|
1930
|
+
}
|
|
1931
|
+
|
|
1932
|
+
interface ITaskProcessorConfig {
|
|
1933
|
+
onComplete?: IFunction;
|
|
1934
|
+
onTask?: IFunction;
|
|
1935
|
+
onError?: IFunction;
|
|
1936
|
+
parallel?: number;
|
|
1937
|
+
}
|
|
1938
|
+
interface ITaskProcessor {
|
|
1939
|
+
config: ITaskProcessorConfig;
|
|
1940
|
+
running: boolean;
|
|
1941
|
+
isComplete: boolean;
|
|
1942
|
+
percent: number;
|
|
1943
|
+
total: number;
|
|
1944
|
+
index: number;
|
|
1945
|
+
finishedIndex: number;
|
|
1946
|
+
remain: number;
|
|
1947
|
+
start(): void;
|
|
1948
|
+
pause(): void;
|
|
1949
|
+
resume(): void;
|
|
1950
|
+
skip(): void;
|
|
1951
|
+
stop(): void;
|
|
1952
|
+
add(taskCallback: IFunction, options?: ITaskOptions | number, canUse?: IFunction): ITaskItem;
|
|
1953
|
+
destroy(): void;
|
|
1954
|
+
}
|
|
1955
|
+
interface ITaskItem {
|
|
1956
|
+
parent: ITaskProcessor;
|
|
1957
|
+
parallel: boolean;
|
|
1958
|
+
isComplete: boolean;
|
|
1959
|
+
isCancel: boolean;
|
|
1960
|
+
time: number;
|
|
1961
|
+
canUse?: IFunction;
|
|
1962
|
+
run(): Promise<void>;
|
|
1963
|
+
complete(): void;
|
|
1964
|
+
cancel(): void;
|
|
1965
|
+
}
|
|
1966
|
+
interface ITaskOptions {
|
|
1967
|
+
start?: boolean;
|
|
1968
|
+
time?: number;
|
|
1969
|
+
parallel?: boolean;
|
|
1970
|
+
delay?: number;
|
|
1971
|
+
canUse?: IFunction;
|
|
1972
|
+
}
|
|
1973
|
+
|
|
1831
1974
|
interface ILeaferImageConfig {
|
|
1832
1975
|
url: string;
|
|
1833
1976
|
thumb?: string;
|
|
1834
1977
|
format?: IExportFileType;
|
|
1978
|
+
crossOrigin?: IImageCrossOrigin;
|
|
1835
1979
|
showProgress?: boolean;
|
|
1836
1980
|
view?: IObject | ILeaferImage | ILeaferCanvas;
|
|
1837
1981
|
}
|
|
@@ -1848,6 +1992,23 @@ interface ILeaferImageCacheCanvas {
|
|
|
1848
1992
|
interface ILeaferImagePatternPaint {
|
|
1849
1993
|
transform: IMatrixData;
|
|
1850
1994
|
}
|
|
1995
|
+
interface ILeaferImageSliceData {
|
|
1996
|
+
size: number;
|
|
1997
|
+
columns: number;
|
|
1998
|
+
total: number;
|
|
1999
|
+
list?: ILeaferImageSlice[];
|
|
2000
|
+
}
|
|
2001
|
+
interface ILeaferImageSlice {
|
|
2002
|
+
view?: any;
|
|
2003
|
+
task?: ITaskItem;
|
|
2004
|
+
}
|
|
2005
|
+
interface ILeaferImageLevel {
|
|
2006
|
+
level: number;
|
|
2007
|
+
scale: number | IPointData;
|
|
2008
|
+
view?: any;
|
|
2009
|
+
url?: string;
|
|
2010
|
+
slice?: ILeaferImageSliceData;
|
|
2011
|
+
}
|
|
1851
2012
|
interface ILeaferImage {
|
|
1852
2013
|
readonly innerId: InnerId;
|
|
1853
2014
|
readonly url: string;
|
|
@@ -1861,7 +2022,11 @@ interface ILeaferImage {
|
|
|
1861
2022
|
error: IObject;
|
|
1862
2023
|
loading: boolean;
|
|
1863
2024
|
isPlacehold?: boolean;
|
|
1864
|
-
|
|
2025
|
+
largeThumb?: ILeaferImageLevel;
|
|
2026
|
+
levels?: ILeaferImageLevel[];
|
|
2027
|
+
levelsRange?: IRangeSize;
|
|
2028
|
+
minLevel?: number;
|
|
2029
|
+
progress?: IProgressData;
|
|
1865
2030
|
use: number;
|
|
1866
2031
|
config: ILeaferImageConfig;
|
|
1867
2032
|
load(onSuccess?: ILeaferImageOnLoaded, onError?: ILeaferImageOnError): number;
|
|
@@ -1908,6 +2073,8 @@ interface IPointerEvent extends IUIEvent {
|
|
|
1908
2073
|
isCancel?: boolean;
|
|
1909
2074
|
}
|
|
1910
2075
|
type PointerType = 'mouse' | 'pen' | 'touch';
|
|
2076
|
+
interface ITouchEvent extends IUIEvent {
|
|
2077
|
+
}
|
|
1911
2078
|
interface IDragEvent extends IPointerEvent {
|
|
1912
2079
|
moveX: number;
|
|
1913
2080
|
moveY: number;
|
|
@@ -2215,46 +2382,6 @@ interface IBranchRender extends ILeafRender {
|
|
|
2215
2382
|
__renderBranch?(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
2216
2383
|
}
|
|
2217
2384
|
|
|
2218
|
-
interface ITaskProcessorConfig {
|
|
2219
|
-
onComplete?: IFunction;
|
|
2220
|
-
onTask?: IFunction;
|
|
2221
|
-
onError?: IFunction;
|
|
2222
|
-
parallel?: number;
|
|
2223
|
-
}
|
|
2224
|
-
interface ITaskProcessor {
|
|
2225
|
-
config: ITaskProcessorConfig;
|
|
2226
|
-
running: boolean;
|
|
2227
|
-
isComplete: boolean;
|
|
2228
|
-
percent: number;
|
|
2229
|
-
total: number;
|
|
2230
|
-
index: number;
|
|
2231
|
-
finishedIndex: number;
|
|
2232
|
-
remain: number;
|
|
2233
|
-
start(): void;
|
|
2234
|
-
pause(): void;
|
|
2235
|
-
resume(): void;
|
|
2236
|
-
skip(): void;
|
|
2237
|
-
stop(): void;
|
|
2238
|
-
add(taskCallback: IFunction, options?: ITaskOptions | number): ITaskItem;
|
|
2239
|
-
destroy(): void;
|
|
2240
|
-
}
|
|
2241
|
-
interface ITaskItem {
|
|
2242
|
-
parent: ITaskProcessor;
|
|
2243
|
-
parallel: boolean;
|
|
2244
|
-
isComplete: boolean;
|
|
2245
|
-
isCancel: boolean;
|
|
2246
|
-
time: number;
|
|
2247
|
-
run(): Promise<void>;
|
|
2248
|
-
complete(): void;
|
|
2249
|
-
cancel(): void;
|
|
2250
|
-
}
|
|
2251
|
-
interface ITaskOptions {
|
|
2252
|
-
start?: boolean;
|
|
2253
|
-
time?: number;
|
|
2254
|
-
parallel?: boolean;
|
|
2255
|
-
delay?: number;
|
|
2256
|
-
}
|
|
2257
|
-
|
|
2258
2385
|
interface IImageManager {
|
|
2259
2386
|
maxRecycled: number;
|
|
2260
2387
|
recycledList: ILeaferImage[];
|
|
@@ -2268,101 +2395,6 @@ interface IImageManager {
|
|
|
2268
2395
|
destroy(): void;
|
|
2269
2396
|
}
|
|
2270
2397
|
|
|
2271
|
-
type ICanvasType = 'skia' | 'napi' | 'canvas' | 'miniapp';
|
|
2272
|
-
interface ISkiaCanvas {
|
|
2273
|
-
toBuffer(format: IExportFileType, config: ISkiaCanvasExportConfig): Promise<any>;
|
|
2274
|
-
toBufferSync(format: IExportFileType, config: ISkiaCanvasExportConfig): any;
|
|
2275
|
-
toDataURL(format: IExportImageType, config: ISkiaCanvasExportConfig): Promise<string>;
|
|
2276
|
-
toDataURLSync(format: IExportImageType, config: ISkiaCanvasExportConfig): string;
|
|
2277
|
-
saveAs(filename: string, config: ISkiaCanvasExportConfig): Promise<void>;
|
|
2278
|
-
saveAsSync(filename: string, config: ISkiaCanvasExportConfig): void;
|
|
2279
|
-
}
|
|
2280
|
-
interface ISkiaCanvasExportConfig {
|
|
2281
|
-
page?: number;
|
|
2282
|
-
matte?: string;
|
|
2283
|
-
density?: number;
|
|
2284
|
-
quality?: number;
|
|
2285
|
-
outline?: boolean;
|
|
2286
|
-
}
|
|
2287
|
-
interface ISkiaNAPICanvas {
|
|
2288
|
-
encodeSync(format: 'webp' | 'jpeg', quality?: number): any;
|
|
2289
|
-
encodeSync(format: 'png'): any;
|
|
2290
|
-
encode(format: 'webp' | 'jpeg' | string, quality?: number): Promise<any>;
|
|
2291
|
-
encode(format: 'png'): Promise<any>;
|
|
2292
|
-
toBuffer(mime: 'image/png'): any;
|
|
2293
|
-
toBuffer(mime: 'image/jpeg' | 'image/webp' | string, quality?: number): any;
|
|
2294
|
-
toDataURL(mime?: 'image/png'): string;
|
|
2295
|
-
toDataURL(mime: 'image/jpeg' | 'image/webp' | string, quality?: number): string;
|
|
2296
|
-
toDataURLAsync(mime?: 'image/png'): Promise<string>;
|
|
2297
|
-
toDataURLAsync(mime: 'image/jpeg' | 'image/webp' | string, quality?: number): Promise<string>;
|
|
2298
|
-
}
|
|
2299
|
-
|
|
2300
|
-
interface IPlatform {
|
|
2301
|
-
name?: 'web' | 'node' | 'miniapp';
|
|
2302
|
-
os?: 'Mac' | 'Windows' | 'Linux';
|
|
2303
|
-
toURL(text: string, fileType?: 'text' | 'svg'): string;
|
|
2304
|
-
requestRender?(render: IFunction): void;
|
|
2305
|
-
canvas?: ILeaferCanvas;
|
|
2306
|
-
renderCanvas?: ILeaferCanvas;
|
|
2307
|
-
canvasType?: ICanvasType;
|
|
2308
|
-
isWorker?: boolean;
|
|
2309
|
-
isMobile?: boolean;
|
|
2310
|
-
readonly devicePixelRatio?: number;
|
|
2311
|
-
intWheelDeltaY?: boolean;
|
|
2312
|
-
conicGradientSupport?: boolean;
|
|
2313
|
-
conicGradientRotate90?: boolean;
|
|
2314
|
-
fullImageShadow?: boolean;
|
|
2315
|
-
syncDomFont?: boolean;
|
|
2316
|
-
selector?: ISelector;
|
|
2317
|
-
getSelector?(leaf: ILeaf): ISelector;
|
|
2318
|
-
layout?(target: ILeaf): void;
|
|
2319
|
-
render?(target: ILeaf, canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
2320
|
-
origin?: {
|
|
2321
|
-
createCanvas(width: number, height: number, format?: 'svg' | 'pdf'): any;
|
|
2322
|
-
canvasToDataURL(canvas: any, type?: IExportImageType, quality?: number): string | Promise<string>;
|
|
2323
|
-
canvasToBolb(canvas: any, type?: IExportFileType, quality?: number): Promise<any>;
|
|
2324
|
-
canvasSaveAs(canvas: any, filename: string, quality?: number): Promise<void>;
|
|
2325
|
-
download(url: string, filename: string): Promise<void>;
|
|
2326
|
-
loadImage(url: string, progressFn?: IProgressFunction): Promise<any>;
|
|
2327
|
-
loadImageWithProgress?(url: string, progressFn?: IProgressFunction): Promise<any>;
|
|
2328
|
-
noRepeat?: string;
|
|
2329
|
-
Image?: any;
|
|
2330
|
-
PointerEvent?: any;
|
|
2331
|
-
DragEvent?: any;
|
|
2332
|
-
};
|
|
2333
|
-
roundRectPatch?: boolean;
|
|
2334
|
-
ellipseToCurve?: boolean;
|
|
2335
|
-
backgrounder?: boolean;
|
|
2336
|
-
event?: {
|
|
2337
|
-
stopDefault(origin: IObject): void;
|
|
2338
|
-
stopNow(origin: IObject): void;
|
|
2339
|
-
stop(origin: IObject): void;
|
|
2340
|
-
};
|
|
2341
|
-
miniapp?: IMiniapp;
|
|
2342
|
-
image: {
|
|
2343
|
-
hitCanvasSize: number;
|
|
2344
|
-
maxCacheSize: number;
|
|
2345
|
-
maxPatternSize: number;
|
|
2346
|
-
prefix?: string;
|
|
2347
|
-
suffix?: string;
|
|
2348
|
-
crossOrigin: string | false;
|
|
2349
|
-
getRealURL: IStringFunction;
|
|
2350
|
-
};
|
|
2351
|
-
}
|
|
2352
|
-
interface IMiniappSelect extends IObject {
|
|
2353
|
-
}
|
|
2354
|
-
interface IMiniappSizeView extends ISizeData {
|
|
2355
|
-
view: any;
|
|
2356
|
-
}
|
|
2357
|
-
interface IMiniapp {
|
|
2358
|
-
select(name: string): IMiniappSelect;
|
|
2359
|
-
getBounds(select: IMiniappSelect): Promise<IBoundsData>;
|
|
2360
|
-
getSizeView(select: IMiniappSelect): Promise<IMiniappSizeView>;
|
|
2361
|
-
onWindowResize(fun: IFunction): void;
|
|
2362
|
-
offWindowResize(fun: IFunction): void;
|
|
2363
|
-
saveToAlbum(path: string): Promise<any>;
|
|
2364
|
-
}
|
|
2365
|
-
|
|
2366
2398
|
interface IPlugin extends IObject {
|
|
2367
2399
|
name?: string;
|
|
2368
2400
|
importVersion: string;
|
|
@@ -2406,4 +2438,4 @@ interface ITransformer {
|
|
|
2406
2438
|
destroy(): void;
|
|
2407
2439
|
}
|
|
2408
2440
|
|
|
2409
|
-
export type { ACommandData, ArcCommandData, ArcToCommandData, BezierCurveToCommandObject, CCommandData, CanvasPathCommand, EllipseCommandData, HCommandData, IAlign, IAnimateEasing, IAnimateEasingFunction, IAnimateEasingName, IAnimateEnding, IAnimateEvent, IAnimateEventFunction, IAnimateEvents, IAnimateOptions, IAnswer, IAppBase, IAround, IAttrDecorator, IAutoBounds, IAutoBoundsData, IAutoBoxData, IAutoSize, IAxis, IAxisAlign, IAxisReverse, IBaseLineAlign, IBlendMode, IBlob, IBlobFunction, IBoolean, IBooleanMap, IBounds, IBoundsData, IBoundsDataFn, IBoundsEvent, IBoundsType, IBranch, IBranchRender, IBranchRenderModule, ICachedLeaf, ICanvasAttr, ICanvasCacheOptions, ICanvasContext2D, ICanvasContext2DSettings, ICanvasManager, ICanvasPattern, ICanvasSizeAttr, ICanvasStrokeOptions, ICanvasType, IChildEvent, IClientPointData, IConstraint, IConstraintType, IControl, ICreator, ICubicBezierEasing, ICursorConfig, ICursorRotate, ICursorRotateMap, ICursorType, ICursorTypeMap, ICustomEasingFunction, IDataProcessor, IDataTypeHandle, IDirection, IDirection4, IDragBoundsType, IDragEvent, IDropEvent, IEditSize, IEraserType, IEvent, IEventListener, IEventListenerId, IEventListenerItem, IEventListenerMap, IEventListenerOptions, IEventOption, IEventParams, IEventParamsMap, IEventTarget, IEventer, IExportFileType, IExportImageType, IExportOnCanvasFunction, IExportOptions, IExportResult, IExportResultFunction, IFilter, IFindCondition, IFindMethod, IFinder, IFlowAlign, IFlowAxisAlign, IFlowBoxType, IFlowType, IFlowWrap, IFourNumber, IFromToData, IFunction, IFunctionMap, IGap, IGestureType, IHitCanvas, IHitCanvasConfig, IHitCanvasManager, IHitType, IImageCursor, IImageEvent, IImageManager, IInteraction, IInteractionCanvas, IInteractionConfig, IJSONOptions, IKeepTouchData, IKeyCodes, IKeyEvent, ILayoutAttr, ILayoutBlockData, ILayoutBoundsData, ILayoutChangedData, ILayoutData, ILayoutEvent, ILayouter, ILayouterConfig, ILeaf, ILeafArrayMap, ILeafAttrData, ILeafAttrDescriptor, ILeafAttrDescriptorFn, ILeafBounds, ILeafBoundsModule, ILeafComputedData, ILeafData, ILeafDataOptions, ILeafDataProxy, ILeafDataProxyModule, ILeafEventer, ILeafEventerModule, ILeafHit, ILeafHitModule, ILeafInputData, ILeafLayout, ILeafLevelList, ILeafList, ILeafListItemCallback, ILeafMap, ILeafMatrix, ILeafMatrixModule, ILeafRender, ILeafRenderModule, ILeaferAttrData, ILeaferBase, ILeaferCanvas, ILeaferCanvasConfig, ILeaferCanvasView, ILeaferConfig, ILeaferEvent, ILeaferImage, ILeaferImageCacheCanvas, ILeaferImageConfig, ILeaferImageOnError, ILeaferImageOnLoaded, ILeaferImagePatternPaint, ILeaferMode, ILeaferType, ILeaferTypeCreator, ILeaferTypeFunction, ILeaferTypeList, ILocationType, IMaskType, IMatrix, IMatrixData, IMatrixWithBoundsData, IMatrixWithBoundsScaleData, IMatrixWithLayoutData, IMatrixWithOptionHalfData, IMatrixWithOptionScaleData, IMatrixWithScaleData, IMiniapp, IMiniappSelect, IMiniappSizeView, IMotionPathData, IMoveConfig, IMoveEvent, IMultiTouchConfig, IMultiTouchData, INumber, INumberFunction, INumberMap, IObject, IObjectFunction, IOffsetBoundsData, IOptionSizeData, IPartLayoutConfig, IPath2D, IPathCommandData, IPathCommandObject, IPathCreator, IPathDrawer, IPathString, IPercentData, IPickBottom, IPickOptions, IPickResult, IPicker, IPlatform, IPlugin, IPoint, IPointData, IPointDataFunction, IPointDataMap, IPointGap, IPointerConfig, IPointerEvent, IProgressData, IProgressFunction, IPropertyEvent, IRadiusPointData, IRangeSize, IRenderEvent, IRenderOptions, IRenderer, IRendererConfig, IResizeEvent, IResizeEventListener, IResource, IRotateEvent, IRotationPointData, IScaleData, IScaleFixed, IScaleRotationData, IScreenSizeData, IScrollPointData, ISelector, ISelectorConfig, ISelectorProxy, IShortcutKeyCodes, IShortcutKeys, IShortcutKeysCheck, ISide, ISingleGestureConfig, ISize, ISizeData, ISkewData, ISkiaCanvas, ISkiaCanvasExportConfig, ISkiaNAPICanvas, IStateStyleType, IStepsEasing, IString, IStringFunction, IStringMap, ISwipeEvent, ITaskItem, ITaskOptions, ITaskProcessor, ITaskProcessorConfig, ITextMetrics, ITimer, ITouchConfig, ITransformer, ITransition, ITwoPointBoundsData, IUICreator, IUIEvent, IUnitData, IUnitPointData, IUpdateEvent, IValue, IValueFunction, IWatchEvent, IWatchEventData, IWatcher, IWatcherConfig, IWheelConfig, IWheelEvent, IWindingRule, IWindingRuleData, IZoomConfig, IZoomEvent, IZoomOptions, IZoomType, IZoomView, InnerId, LCommandData, LineToCommandObject, MCommandData, MoveToCommandObject, PointerType, QCommandData, QuadraticCurveToCommandObject, RectCommandData, RoundRectCommandData, SCommandData, TCommandData, VCommandData, ZCommandData };
|
|
2441
|
+
export type { ACommandData, ArcCommandData, ArcToCommandData, BezierCurveToCommandObject, CCommandData, CanvasPathCommand, EllipseCommandData, HCommandData, IAlign, IAnimateEasing, IAnimateEasingFunction, IAnimateEasingName, IAnimateEnding, IAnimateEvent, IAnimateEventFunction, IAnimateEvents, IAnimateOptions, IAnswer, IAppBase, IAround, IAttrDecorator, IAutoBounds, IAutoBoundsData, IAutoBoxData, IAutoSize, IAxis, IAxisAlign, IAxisReverse, IBaseLineAlign, IBlendMode, IBlob, IBlobFunction, IBoolean, IBooleanMap, IBounds, IBoundsData, IBoundsDataFn, IBoundsEvent, IBoundsType, IBranch, IBranchRender, IBranchRenderModule, ICachedLeaf, ICanvasAttr, ICanvasCacheOptions, ICanvasContext2D, ICanvasContext2DSettings, ICanvasManager, ICanvasPattern, ICanvasSizeAttr, ICanvasStrokeOptions, ICanvasType, IChildEvent, IClientPointData, IConstraint, IConstraintType, IControl, ICreator, ICubicBezierEasing, ICursorConfig, ICursorRotate, ICursorRotateMap, ICursorType, ICursorTypeMap, ICustomEasingFunction, IDataProcessor, IDataTypeHandle, IDirection, IDirection4, IDragBoundsType, IDragEvent, IDropEvent, IEditSize, IEraserType, IEvent, IEventListener, IEventListenerId, IEventListenerItem, IEventListenerMap, IEventListenerOptions, IEventOption, IEventParams, IEventParamsMap, IEventTarget, IEventer, IExportFileType, IExportImageType, IExportOnCanvasFunction, IExportOptions, IExportResult, IExportResultFunction, IFilter, IFindCondition, IFindMethod, IFinder, IFlowAlign, IFlowAxisAlign, IFlowBoxType, IFlowType, IFlowWrap, IFourNumber, IFromToData, IFunction, IFunctionMap, IGap, IGestureType, IHitCanvas, IHitCanvasConfig, IHitCanvasManager, IHitType, IImageCrossOrigin, IImageCursor, IImageEvent, IImageManager, IInteraction, IInteractionCanvas, IInteractionConfig, IJSONOptions, IKeepTouchData, IKeyCodes, IKeyEvent, ILayoutAttr, ILayoutBlockData, ILayoutBoundsData, ILayoutChangedData, ILayoutData, ILayoutEvent, ILayouter, ILayouterConfig, ILeaf, ILeafArrayMap, ILeafAttrData, ILeafAttrDescriptor, ILeafAttrDescriptorFn, ILeafBounds, ILeafBoundsModule, ILeafComputedData, ILeafData, ILeafDataOptions, ILeafDataProxy, ILeafDataProxyModule, ILeafEventer, ILeafEventerModule, ILeafHit, ILeafHitModule, ILeafInputData, ILeafLayout, ILeafLevelList, ILeafList, ILeafListItemCallback, ILeafMap, ILeafMatrix, ILeafMatrixModule, ILeafRender, ILeafRenderModule, ILeaferAttrData, ILeaferBase, ILeaferCanvas, ILeaferCanvasConfig, ILeaferCanvasView, ILeaferConfig, ILeaferEvent, ILeaferImage, ILeaferImageCacheCanvas, ILeaferImageConfig, ILeaferImageLevel, ILeaferImageOnError, ILeaferImageOnLoaded, ILeaferImagePatternPaint, ILeaferImageSlice, ILeaferImageSliceData, ILeaferMode, ILeaferType, ILeaferTypeCreator, ILeaferTypeFunction, ILeaferTypeList, ILocationType, IMaskType, IMatrix, IMatrixData, IMatrixWithBoundsData, IMatrixWithBoundsScaleData, IMatrixWithLayoutData, IMatrixWithOptionHalfData, IMatrixWithOptionScaleData, IMatrixWithScaleData, IMiniapp, IMiniappSelect, IMiniappSizeView, IMotionPathData, IMoveConfig, IMoveEvent, IMultiTouchConfig, IMultiTouchData, INumber, INumberFunction, INumberMap, IObject, IObjectFunction, IOffsetBoundsData, IOptionSizeData, IPartLayoutConfig, IPath2D, IPathCommandData, IPathCommandObject, IPathCreator, IPathDrawer, IPathString, IPercentData, IPickBottom, IPickOptions, IPickResult, IPicker, IPlatform, IPlugin, IPoint, IPointData, IPointDataFunction, IPointDataMap, IPointGap, IPointerConfig, IPointerEvent, IProgressData, IProgressFunction, IPropertyEvent, IRadiusPointData, IRangeSize, IRenderEvent, IRenderOptions, IRenderer, IRendererConfig, IResizeEvent, IResizeEventListener, IResource, IRotateEvent, IRotationPointData, IScaleData, IScaleFixed, IScaleRotationData, IScreenSizeData, IScrollPointData, ISelector, ISelectorConfig, ISelectorProxy, IShortcutKeyCodes, IShortcutKeys, IShortcutKeysCheck, ISide, ISingleGestureConfig, ISize, ISizeData, ISkewData, ISkiaCanvas, ISkiaCanvasExportConfig, ISkiaNAPICanvas, IStateStyleType, IStepsEasing, IString, IStringFunction, IStringMap, ISwipeEvent, ITaskItem, ITaskOptions, ITaskProcessor, ITaskProcessorConfig, ITextMetrics, ITimer, ITouchConfig, ITouchEvent, ITransformer, ITransition, ITwoPointBoundsData, IUICreator, IUIEvent, IUnitData, IUnitPointData, IUpdateEvent, IValue, IValueFunction, IWatchEvent, IWatchEventData, IWatcher, IWatcherConfig, IWheelConfig, IWheelEvent, IWindingRule, IWindingRuleData, IZoomConfig, IZoomEvent, IZoomOptions, IZoomType, IZoomView, InnerId, LCommandData, LineToCommandObject, MCommandData, MoveToCommandObject, PointerType, QCommandData, QuadraticCurveToCommandObject, RectCommandData, RoundRectCommandData, SCommandData, TCommandData, VCommandData, ZCommandData };
|