New way of detecting touch

Moves detection to Util and fixes so that touch is properly detected on
MS Surface and touch emulation in Chrome.
This commit is contained in:
samhed
2016-08-25 14:21:32 +02:00
committed by Samuel Mannehed
parent da346c3b21
commit bea2b3fdfc
4 changed files with 25 additions and 15 deletions
+2 -2
View File
@@ -346,7 +346,7 @@
grab: function () {
var c = this._target;
if ('ontouchstart' in document.documentElement) {
if (Util.isTouchDevice) {
c.addEventListener('touchstart', this._eventHandlers.mousedown);
window.addEventListener('touchend', this._eventHandlers.mouseup);
c.addEventListener('touchend', this._eventHandlers.mouseup);
@@ -368,7 +368,7 @@
ungrab: function () {
var c = this._target;
if ('ontouchstart' in document.documentElement) {
if (Util.isTouchDevice) {
c.removeEventListener('touchstart', this._eventHandlers.mousedown);
window.removeEventListener('touchend', this._eventHandlers.mouseup);
c.removeEventListener('touchend', this._eventHandlers.mouseup);