|
|
|
@ -5,12 +5,17 @@
|
|
|
|
|
/* jshint bitwise: false */ |
|
|
|
|
/* global GLOBAL: true */ |
|
|
|
|
|
|
|
|
|
function FingerBlast(element) { |
|
|
|
|
(function () { |
|
|
|
|
|
|
|
|
|
'use strict'; |
|
|
|
|
|
|
|
|
|
function FingerBlast(element) { |
|
|
|
|
this.element = typeof element === 'string' ? document.querySelector(element) : element; |
|
|
|
|
|
|
|
|
|
if (this.element) { |
|
|
|
|
this.listen(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
FingerBlast.prototype = { |
|
|
|
|
x: NaN, |
|
|
|
@ -22,8 +27,6 @@ FingerBlast.prototype = {
|
|
|
|
|
mouseIsDown: false, |
|
|
|
|
|
|
|
|
|
listen: function () { |
|
|
|
|
'use strict'; |
|
|
|
|
|
|
|
|
|
var activate = this.activate.bind(this); |
|
|
|
|
var deactivate = this.deactivate.bind(this); |
|
|
|
|
|
|
|
|
@ -59,8 +62,6 @@ FingerBlast.prototype = {
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
activate: function () { |
|
|
|
|
'use strict'; |
|
|
|
|
|
|
|
|
|
if (this.active) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
@ -72,8 +73,6 @@ FingerBlast.prototype = {
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
deactivate: function (e) { |
|
|
|
|
'use strict'; |
|
|
|
|
|
|
|
|
|
this.active = false; |
|
|
|
|
if (this.mouseIsDown) { |
|
|
|
|
this.touchEnd(e); |
|
|
|
@ -85,8 +84,6 @@ FingerBlast.prototype = {
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
click: function (e) { |
|
|
|
|
'use strict'; |
|
|
|
|
|
|
|
|
|
if (e.synthetic) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
@ -95,8 +92,6 @@ FingerBlast.prototype = {
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
touchStart: function (e) { |
|
|
|
|
'use strict'; |
|
|
|
|
|
|
|
|
|
if (e.synthetic || /input|textarea/.test(e.target.tagName.toLowerCase())) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
@ -110,8 +105,6 @@ FingerBlast.prototype = {
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
touchMove: function (e) { |
|
|
|
|
'use strict'; |
|
|
|
|
|
|
|
|
|
if (e.synthetic) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
@ -127,8 +120,6 @@ FingerBlast.prototype = {
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
touchEnd: function (e) { |
|
|
|
|
'use strict'; |
|
|
|
|
|
|
|
|
|
if (e.synthetic) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
@ -151,8 +142,6 @@ FingerBlast.prototype = {
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
fireTouchEvents: function (eventName, originalEvent) { |
|
|
|
|
'use strict'; |
|
|
|
|
|
|
|
|
|
var events = []; |
|
|
|
|
var gestures = []; |
|
|
|
|
|
|
|
|
@ -235,8 +224,6 @@ FingerBlast.prototype = {
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
createMouseEvent: function (eventName, originalEvent) { |
|
|
|
|
'use strict'; |
|
|
|
|
|
|
|
|
|
var e = document.createEvent('MouseEvent'); |
|
|
|
|
|
|
|
|
|
e.initMouseEvent(eventName, true, true, |
|
|
|
@ -255,8 +242,6 @@ FingerBlast.prototype = {
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
move: function (x, y) { |
|
|
|
|
'use strict'; |
|
|
|
|
|
|
|
|
|
if (isNaN(x) || isNaN(y)) { |
|
|
|
|
this.target = null; |
|
|
|
|
} else { |
|
|
|
@ -269,3 +254,7 @@ FingerBlast.prototype = {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
window.FingerBlast = FingerBlast; |
|
|
|
|
|
|
|
|
|
}()); |
|
|
|
|