forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
scroller.d.ts
50 lines (43 loc) · 1.93 KB
/
scroller.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 Zynga Scroller
// Project: https://github.com/zynga/scroller
// Definitions by: Boris Yankov <https://github.com/borisyankov>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
interface ScrollerOptions {
scrollingX?: boolean;
scrollingY?: boolean;
animating?: boolean;
animationDuration?: number;
bouncing?: boolean;
locking?: boolean;
paging?: boolean;
snapping?: boolean;
zooming?: boolean;
minZoom?: number;
maxZoom?: number;
speedMultiplier?: number;
}
interface ScrollValues {
left: number;
top: number;
}
interface ScrollValuesWithZoom extends ScrollValues {
zoom: number;
}
declare class Scroller {
constructor (callback: (left: number, top: number, zoom: number) => void , options: ScrollerOptions);
setDimensions(clientWidth: number, clientHeight: number, contentWidth: number, contentHeight: number): void;
setPosition(left: number, top: number): void;
setSnapSize(width: number, height: number): void;
activatePullToRefresh(height: number, activateCallback: Function, deactivateCallback: Function, startCallback: Function): void;
finishPullToRefresh(): void;
getValues(): ScrollValuesWithZoom;
getScrollMax(): ScrollValues;
zoomTo(level: number, animate?: boolean, originLeft?: number, originTop?: number, callback?: Function): void;
zoomBy(factor: number, animate?: boolean, originLeft?: number, originTop?: number, callback?: Function): void;
scrollTo(left?: number, top?: number, animate?: boolean, zoom?: number): void;
scrollBy(left?: number, top?: number, animate?: boolean): void;
doMouseZoom(wheelDelta: number, timeStamp: number, pageX: number, pageY: number): void;
doTouchStart(touches: any[], timeStamp: number): void;
doTouchMove(touches: any[], timeStamp: number, scale?: number): void;
doTouchEnd(timeStamp: number): void;
}