-
Notifications
You must be signed in to change notification settings - Fork 293
/
index.d.ts
96 lines (89 loc) · 2.69 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
declare module "panzoom" {
interface Bounds {
left: number;
top: number;
right: number;
bottom: number;
}
export interface TransformOrigin {
x: number;
y: number;
}
export interface Transform {
x: number;
y: number;
scale: number;
}
export interface PanZoomController {
getOwner: () => Element;
applyTransform: (transform: Transform) => void;
}
export interface PanZoomOptions {
filterKey?: () => boolean;
bounds?: boolean | Bounds;
maxZoom?: number;
minZoom?: number;
boundsPadding?: number;
zoomDoubleClickSpeed?: number;
zoomSpeed?: number;
initialX?: number,
initialY?: number,
initialZoom?: number,
pinchSpeed?: number;
beforeWheel?: (e: WheelEvent) => void;
beforeMouseDown?: (e: MouseEvent) => void;
autocenter?: boolean;
onTouch?: (e: TouchEvent) => void;
onDoubleClick?: (e: Event) => void;
/**
* Called after user "clicks" with a single tap or mouse button.
* The event comes a bit later after a tap, to allow for double
* tap disambiguation.
*/
onClick?: (e: Event) => void;
smoothScroll?: boolean;
controller?: PanZoomController;
enableTextSelection?: boolean;
disableKeyboardInteraction?: boolean;
transformOrigin?: TransformOrigin;
}
export interface PanZoom {
dispose: () => void;
moveBy: (dx: number, dy: number, smooth: boolean) => void;
moveTo: (x: number, y: number) => void;
smoothMoveTo: (x: number, y: number) => void;
centerOn: (ui: any) => void;
zoomTo: (clientX: number, clientY: number, scaleMultiplier: number) => void;
zoomAbs: (clientX: number, clientY: number, zoomLevel: number) => void;
smoothZoom: (
clientX: number,
clientY: number,
scaleMultiplier: number
) => void;
smoothZoomAbs: (
clientX: number,
clientY: number,
toScaleValue: number
) => void;
getTransform: () => Transform;
showRectangle: (rect: ClientRect) => void;
pause: () => void;
resume: () => void;
isPaused: () => boolean;
on: <T>(eventName: string, handler: (e: T) => void) => void;
off: (eventName: string, handler: Function) => void;
fire: (eventName: string) => void;
getMinZoom: () => number;
setMinZoom: (newMinZoom: number) => number;
getMaxZoom: () => number;
setMaxZoom: (newMaxZoom: number) => number;
getTransformOrigin: () => TransformOrigin;
setTransformOrigin: (newTransformOrigin: TransformOrigin) => void;
getZoomSpeed: () => number;
setZoomSpeed: (zoomSpeed: number) => void;
}
export default function createPanZoom(
domElement: HTMLElement | SVGElement,
options?: PanZoomOptions
): PanZoom;
}