-
Notifications
You must be signed in to change notification settings - Fork 281
Expand file tree
/
Copy pathMotionEvent.js
More file actions
64 lines (60 loc) · 1.9 KB
/
MotionEvent.js
File metadata and controls
64 lines (60 loc) · 1.9 KB
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
class PointerCoords {
x = 0
y = 0
}
const MotionEvent = {
ACTION_DOWN: 0,
ACTION_UP: 1,
ACTION_MOVE: 2,
ACTION_CANCEL: 3,
ACTION_OUTSIDE: 4,
ACTION_POINTER_DOWN: 5,
ACTION_POINTER_UP: 6,
ACTION_HOVER_MOVE: 7,
ACTION_SCROLL: 8,
ACTION_HOVER_ENTER: 9,
ACTION_HOVER_EXIT: 10,
ACTION_BUTTON_PRESS: 11,
ACTION_BUTTON_RELEASE: 12,
ACTION_POINTER_INDEX_MASK: 0xff00,
ACTION_POINTER_INDEX_SHIFT: 8,
ACTION_MASK: 0xff,
actionToString: function (action) {
switch (action) {
case this.ACTION_DOWN:
return "ACTION_DOWN";
case this.ACTION_UP:
return "ACTION_UP";
case this.ACTION_CANCEL:
return "ACTION_CANCEL";
case this.ACTION_OUTSIDE:
return "ACTION_OUTSIDE";
case this.ACTION_MOVE:
return "ACTION_MOVE";
case this.ACTION_HOVER_MOVE:
return "ACTION_HOVER_MOVE";
case this.ACTION_SCROLL:
return "ACTION_SCROLL";
case this.ACTION_HOVER_ENTER:
return "ACTION_HOVER_ENTER";
case this.ACTION_HOVER_EXIT:
return "ACTION_HOVER_EXIT";
case this.ACTION_BUTTON_PRESS:
return "ACTION_BUTTON_PRESS";
case this.ACTION_BUTTON_RELEASE:
return "ACTION_BUTTON_RELEASE";
}
var index = (action & this.ACTION_POINTER_INDEX_MASK) >> this.ACTION_POINTER_INDEX_SHIFT;
switch (action & this.ACTION_MASK) {
case this.ACTION_POINTER_DOWN:
return "ACTION_POINTER_DOWN(" + index + ")";
case this.ACTION_POINTER_UP:
return "ACTION_POINTER_UP(" + index + ")";
default:
return String(action);
}
},
// obtain: function (obj) {
// return obj || {}
// }
}