Move some touch logic to the handler base class.

This commit is contained in:
Xavier Mamano
2012-02-15 17:55:37 +01:00
parent cd41548c01
commit ee8e892bb4
9 changed files with 130 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.
@@ -344,17 +337,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);
},
@@ -508,7 +491,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;