Merge pull request #224 from jorix/3402-touch_logic_to_superclass

Move some touch logic to the `handler` base class
This commit is contained in:
Bart van den Eijnden
2013-04-25 07:42:39 -07:00
9 changed files with 124 additions and 111 deletions

View File

@@ -90,13 +90,6 @@ OpenLayers.Handler.Click = OpenLayers.Class(OpenLayers.Handler, {
* {Number} The id of the timeout waiting to clear the <delayedCall>.
*/
timerId: null,
/**
* Property: touch
* {Boolean} When a touchstart event is fired, touch will be true and all
* mouse related listeners will do nothing.
*/
touch: false,
/**
* Property: down
@@ -155,10 +148,7 @@ OpenLayers.Handler.Click = OpenLayers.Class(OpenLayers.Handler, {
* {Boolean} Continue propagating this event.
*/
touchstart: function(evt) {
if (!this.touch) {
this.unregisterMouseListeners();
this.touch = true;
}
this.startTouch();
this.down = this.getEventInfo(evt);
this.last = this.getEventInfo(evt);
return true;
@@ -195,20 +185,6 @@ OpenLayers.Handler.Click = OpenLayers.Class(OpenLayers.Handler, {
}
return true;
},
/**
* Method: unregisterMouseListeners
* In a touch environment, we don't want to handle mouse events.
*/
unregisterMouseListeners: function() {
this.map.events.un({
mousedown: this.mousedown,
mouseup: this.mouseup,
click: this.click,
dblclick: this.dblclick,
scope: this
});
},
/**
* Method: mousedown
@@ -520,7 +496,6 @@ OpenLayers.Handler.Click = OpenLayers.Class(OpenLayers.Handler, {
this.down = null;
this.first = null;
this.last = null;
this.touch = false;
deactivated = true;
}
return deactivated;