forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhammerjs.d.ts
142 lines (122 loc) · 3.86 KB
/
hammerjs.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
// Type definitions for Hammer.js 1.1.3
// Project: http://eightmedia.github.com/hammer.js/
// Definitions by: Boris Yankov <https://github.com/borisyankov/>, Drew Noakes <https://drewnoakes.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts"/>
declare var Hammer: HammerStatic;
interface HammerStatic {
(element: any, options?: HammerOptions): HammerInstance;
VERSION: number;
HAS_POINTEREVENTS: boolean;
HAS_TOUCHEVENTS: boolean;
UPDATE_VELOCITY_INTERVAL: number;
POINTER_MOUSE: HammerPointerType;
POINTER_TOUCH: HammerPointerType;
POINTER_PEN: HammerPointerType;
DIRECTION_UP: HammerDirectionType;
DIRECTION_DOWN: HammerDirectionType;
DIRECTION_LEFT: HammerDirectionType;
DIRECTION_RIGH: HammerDirectionType;
EVENT_START: HammerTouchEventState;
EVENT_MOVE: HammerTouchEventState;
EVENT_END: HammerTouchEventState;
plugins: any;
gestures: any;
READY: boolean;
}
declare class HammerInstance {
constructor(element: any, options?: HammerOptions);
on(gesture: string, handler: (event: HammerEvent) => void): HammerInstance;
off(gesture: string, handler: (event: HammerEvent) => void): HammerInstance;
enable(toggle: boolean): HammerInstance;
// You shouldn't normally use this internal method. Only use it when you know what you're doing! You can read the sourcecode for information about how to use this.
trigger(gesture: string, eventData: HammerGestureEventData): HammerInstance;
}
// Gesture Options : https://github.com/EightMedia/hammer.js/wiki/Getting-Started#gesture-options
interface HammerOptions {
behavior?: {
contentZooming?: string;
tapHighlightColor?: string;
touchAction?: string;
touchCallout?: string;
userDrag?: string;
userSelect?: string;
};
doubleTapDistance?: number;
doubleTapInterval?: number;
drag?: boolean;
dragBlockHorizontal?: boolean;
dragBlockVertical?: boolean;
dragDistanceCorrection?: boolean;
dragLockMinDistance?: number;
dragLockToAxis?: boolean;
dragMaxTouches?: number;
dragMinDistance?: number;
gesture?: boolean;
hold?: boolean;
holdThreshold?: number;
holdTimeout?: number;
preventDefault?: boolean;
preventMouse?: boolean;
release?: boolean;
showTouches?: boolean;
swipe?: boolean;
swipeMaxTouches?: number;
swipeMinTouches?: number;
swipeVelocityX?: number;
swipeVelocityY?: number;
tap?: boolean;
tapAlways?: boolean;
tapMaxDistance?: number;
tapMaxTime?: number;
touch?: boolean;
transform?: boolean;
transformMinRotation?: number;
transformMinScale?: number;
}
interface HammerGestureEventData {
timestamp: number;
target: HTMLElement;
touches: HammerPoint[];
pointerType: HammerPointerType;
center: HammerPoint;
deltaTime: number;
deltaX: number;
deltaY: number;
velocityX: number;
velocityY: number;
angle: number;
interimAngle: number;
direction: HammerDirectionType;
interimDirection: HammerDirectionType;
distance: number;
scale: number;
rotation: number;
eventType: HammerTouchEventState;
srcEvent: any;
startEvent: any;
stopPropagation(): void;
preventDefault(): void;
stopDetect(): void;
}
interface HammerPoint {
clientX: number;
clientY: number;
pageX: number;
pageY: number;
}
interface HammerEvent {
type: string;
gesture: HammerGestureEventData;
stopPropagation(): void;
preventDefault(): void;
}
declare enum HammerPointerType {
}
declare enum HammerDirectionType {
}
declare enum HammerTouchEventState {
}
interface JQuery {
hammer(options?: HammerOptions): JQuery;
}