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

@@ -50,13 +50,6 @@ OpenLayers.Handler.Drag = OpenLayers.Class(OpenLayers.Handler, {
*/
dragging: false,
/**
* Property: touch
* {Boolean} When a touchstart event is fired, touch will be true and all
* mouse related listeners will do nothing.
*/
touch: false,
/**
* Property: last
* {<OpenLayers.Pixel>} The last pixel location of the drag.
@@ -345,17 +338,7 @@ OpenLayers.Handler.Drag = OpenLayers.Class(OpenLayers.Handler, {
* {Boolean} Let the event propagate.
*/
touchstart: function(evt) {
if (!this.touch) {
this.touch = true;
// unregister mouse listeners
this.map.events.un({
mousedown: this.mousedown,
mouseup: this.mouseup,
mousemove: this.mousemove,
click: this.click,
scope: this
});
}
this.startTouch();
return this.dragstart(evt);
},
@@ -509,7 +492,6 @@ OpenLayers.Handler.Drag = OpenLayers.Class(OpenLayers.Handler, {
deactivate: function() {
var deactivated = false;
if(OpenLayers.Handler.prototype.deactivate.apply(this, arguments)) {
this.touch = false;
this.started = false;
this.dragging = false;
this.start = null;