-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathindex.d.ts
50 lines (41 loc) · 1.39 KB
/
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Type definitions for sketch-lite
// Project: Sketch-lite
// Definitions by: qiqiboy
declare const SketchLite: SketchLite.SketchLiteConstructor;
export = SketchLite;
export as namespace SketchLite;
declare namespace SketchLite {
interface SketchLiteConfig {
color?: string;
bgcolor?: string;
lineWidth?: number;
width?: number;
height?: number;
multi?: boolean;
}
interface SketchLite {
color: string;
bgcolor: string;
lineWidth: number;
width: number;
height: number;
multi: boolean;
erase: boolean;
steps: number;
canvas: HTMLCanvasElement;
ctx: CanvasRenderingContext2D;
clear(): SketchLite;
cancel(step?: number): SketchLite;
reDraw(): SketchLite;
toBlob: HTMLCanvasElement['toBlob'];
toDataUrl: HTMLCanvasElement['toDataURL'];
toDataURL: HTMLCanvasElement['toDataURL'];
destroy(): void;
on(action: 'start' | 'move', callback: (x: number, y: number, pointerId: number) => void): SketchLite;
on(action: 'end', callback: (pointerId: number) => void): SketchLite;
}
interface SketchLiteConstructor {
new (idOrElement: string | HTMLElement, config?: SketchLiteConfig): SketchLite;
(idOrElement: string | HTMLElement, config?: SketchLiteConfig): SketchLite;
}
}