Fix problem in touchable device

When 'ontouchstart' is in document.documentElement, the code just add touch pattern event, which lead to users can't use mouse.
So we should remove the 'else' block to add mouse event for all device.
This commit is contained in:
hejiantao5 2014-07-29 20:51:53 +08:00
parent 9b731d3a58
commit 71f11b9b91
1 changed files with 4 additions and 4 deletions

View File

@ -355,14 +355,14 @@ that.grab = function() {
Util.addEvent(window, 'touchend', onMouseUp); Util.addEvent(window, 'touchend', onMouseUp);
Util.addEvent(c, 'touchend', onMouseUp); Util.addEvent(c, 'touchend', onMouseUp);
Util.addEvent(c, 'touchmove', onMouseMove); Util.addEvent(c, 'touchmove', onMouseMove);
} else { }
Util.addEvent(c, 'mousedown', onMouseDown); Util.addEvent(c, 'mousedown', onMouseDown);
Util.addEvent(window, 'mouseup', onMouseUp); Util.addEvent(window, 'mouseup', onMouseUp);
Util.addEvent(c, 'mouseup', onMouseUp); Util.addEvent(c, 'mouseup', onMouseUp);
Util.addEvent(c, 'mousemove', onMouseMove); Util.addEvent(c, 'mousemove', onMouseMove);
Util.addEvent(c, (Util.Engine.gecko) ? 'DOMMouseScroll' : 'mousewheel', Util.addEvent(c, (Util.Engine.gecko) ? 'DOMMouseScroll' : 'mousewheel',
onMouseWheel); onMouseWheel);
}
/* Work around right and middle click browser behaviors */ /* Work around right and middle click browser behaviors */
Util.addEvent(document, 'click', onMouseDisable); Util.addEvent(document, 'click', onMouseDisable);
@ -380,14 +380,14 @@ that.ungrab = function() {
Util.removeEvent(window, 'touchend', onMouseUp); Util.removeEvent(window, 'touchend', onMouseUp);
Util.removeEvent(c, 'touchend', onMouseUp); Util.removeEvent(c, 'touchend', onMouseUp);
Util.removeEvent(c, 'touchmove', onMouseMove); Util.removeEvent(c, 'touchmove', onMouseMove);
} else { }
Util.removeEvent(c, 'mousedown', onMouseDown); Util.removeEvent(c, 'mousedown', onMouseDown);
Util.removeEvent(window, 'mouseup', onMouseUp); Util.removeEvent(window, 'mouseup', onMouseUp);
Util.removeEvent(c, 'mouseup', onMouseUp); Util.removeEvent(c, 'mouseup', onMouseUp);
Util.removeEvent(c, 'mousemove', onMouseMove); Util.removeEvent(c, 'mousemove', onMouseMove);
Util.removeEvent(c, (Util.Engine.gecko) ? 'DOMMouseScroll' : 'mousewheel', Util.removeEvent(c, (Util.Engine.gecko) ? 'DOMMouseScroll' : 'mousewheel',
onMouseWheel); onMouseWheel);
}
/* Work around right and middle click browser behaviors */ /* Work around right and middle click browser behaviors */
Util.removeEvent(document, 'click', onMouseDisable); Util.removeEvent(document, 'click', onMouseDisable);