-
Notifications
You must be signed in to change notification settings - Fork 0
/
gestureRecognizer.js
48 lines (36 loc) · 1.09 KB
/
gestureRecognizer.js
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
// gestureRecognizer
(function(host/*host-object*/, onUserInteractionMove/*onUserInteractionMove-object*/, undefined) {
"use strict";
var r = function(sel, func) {
if (!sel)
return;
var self = this;
this.callback = func;
this._attached = true;
onUserInteractionMove(sel, function(obj) {
// callback function must be overwritten by a derived class
if (self._attached === true) {
console.log("asdasda asdads");
self.userInteractionMoveCallback(obj);
}
});
};
var proto = r.prototype;
proto.threshold = {
tolerance : { x : 10, y : 10 },
value : { x : 50, y : 50 }
};
proto.cache = {
total : { x : 0, y : 0 },
element: null
};
proto.detach = function() {
this._attached = false;
};
proto.attach = function() {
this._attached = true;
};
host.gestureRecognizer = function(selector, callback) {
return new r(selector, callback);
}
})(this, this.onUserInteractionMove);