hammerjs-rails 2.0.6 → 2.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +24 -3
- data/lib/hammerjs/rails/version.rb +1 -1
- data/vendor/assets/javascripts/angular.hammer.js +611 -0
- data/vendor/assets/javascripts/angular.hammer.min.js +8 -0
- data/vendor/assets/javascripts/angular.hammer.min.js.map +1 -0
- data/vendor/assets/javascripts/hammer-time.js +179 -0
- data/vendor/assets/javascripts/hammer-time.min.js +1 -0
- data/vendor/assets/javascripts/hammer.js +2701 -2029
- data/vendor/assets/javascripts/hammer.min.js +6 -5
- data/vendor/assets/javascripts/hammer.min.js.map +1 -0
- data/vendor/assets/javascripts/hammer.min.map +1 -1
- data/vendor/assets/javascripts/touch-emulator.js +362 -0
- metadata +8 -3
- data/vendor/assets/javascripts/hammer.fakemultitouch.js +0 -81
- data/vendor/assets/javascripts/hammer.showtouches.js +0 -70
@@ -1,70 +0,0 @@
|
|
1
|
-
(function(Hammer) {
|
2
|
-
/**
|
3
|
-
* ShowTouches gesture
|
4
|
-
* show all touch on the screen by placing elements at there pageX and pageY
|
5
|
-
* @param {Boolean} [force]
|
6
|
-
*/
|
7
|
-
Hammer.plugins.showTouches = function(force) {
|
8
|
-
// the circles under your fingers
|
9
|
-
var template_style = 'position:absolute;z-index:9999;left:0;top:0;height:14px;width:14px;border:solid 2px #777;' +
|
10
|
-
'background:rgba(255,255,255,.7);border-radius:20px;pointer-events:none;' +
|
11
|
-
'margin-top:-9px;margin-left:-9px;';
|
12
|
-
|
13
|
-
// elements by identifier
|
14
|
-
var touch_elements = {};
|
15
|
-
var touches_index = {};
|
16
|
-
|
17
|
-
/**
|
18
|
-
* remove unused touch elements
|
19
|
-
*/
|
20
|
-
function removeUnusedElements() {
|
21
|
-
// remove unused touch elements
|
22
|
-
for(var key in touch_elements) {
|
23
|
-
if(touch_elements.hasOwnProperty(key) && !touches_index[key]) {
|
24
|
-
document.body.removeChild(touch_elements[key]);
|
25
|
-
delete touch_elements[key];
|
26
|
-
}
|
27
|
-
}
|
28
|
-
}
|
29
|
-
|
30
|
-
Hammer.detection.register({
|
31
|
-
name : 'show_touches',
|
32
|
-
priority: 0,
|
33
|
-
handler : function(ev, inst) {
|
34
|
-
touches_index = {};
|
35
|
-
|
36
|
-
// clear old elements when not using a mouse
|
37
|
-
if(ev.pointerType != Hammer.POINTER_MOUSE && !force) {
|
38
|
-
removeUnusedElements();
|
39
|
-
return;
|
40
|
-
}
|
41
|
-
|
42
|
-
// place touches by index
|
43
|
-
for(var t = 0, total_touches = ev.touches.length; t < total_touches; t++) {
|
44
|
-
var touch = ev.touches[t];
|
45
|
-
|
46
|
-
var id = touch.identifier;
|
47
|
-
touches_index[id] = touch;
|
48
|
-
|
49
|
-
// new touch element
|
50
|
-
if(!touch_elements[id]) {
|
51
|
-
// create new element and attach base styles
|
52
|
-
var template = document.createElement('div');
|
53
|
-
template.setAttribute('style', template_style);
|
54
|
-
|
55
|
-
// append element to body
|
56
|
-
document.body.appendChild(template);
|
57
|
-
|
58
|
-
touch_elements[id] = template;
|
59
|
-
}
|
60
|
-
|
61
|
-
// Paul Irish says that translate is faster then left/top
|
62
|
-
touch_elements[id].style.left = touch.pageX + 'px';
|
63
|
-
touch_elements[id].style.top = touch.pageY + 'px';
|
64
|
-
}
|
65
|
-
|
66
|
-
removeUnusedElements();
|
67
|
-
}
|
68
|
-
});
|
69
|
-
};
|
70
|
-
})(window.Hammer);
|