-
Notifications
You must be signed in to change notification settings - Fork 9
/
index.d.ts
33 lines (29 loc) · 891 Bytes
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
declare class Eve {
on(ev: string, fn: Function): void;
off(ev: string, fn?: Function): void;
trigger(ev: string, payload: any): void;
}
interface ToDataURLOptions {
type?: string;
quality?: number;
}
interface FillImageOptions {
isOverlay?: boolean;
}
declare class SimpleDrawingBoard {
get observer(): Eve;
get canvas(): HTMLCanvasElement;
get mode(): "draw" | "erase"
setLineSize(size: number): void;
setLineColor(color: string): void;
fill(color: string): void;
clear(): void;
toggleMode(): void;
toDataURL(options?: ToDataURLOptions): string;
fillImageByElement($el: CanvasImageSource, options?: FillImageOptions): void;
fillImageByDataURL(src: string, options?: FillImageOptions): Promise<void>;
undo(): Promise<void>;
redo(): Promise<void>;
destroy(): void;
}
export declare function create($canvas: HTMLCanvasElement): SimpleDrawingBoard;