the map may jump on mouseup after dragging, p=me, r=crschmidt (closes #2936)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@11635 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Éric Lemoine
2011-03-07 08:21:51 +00:00
parent 1f58346772
commit 1b3404f1f9
2 changed files with 168 additions and 1 deletions

View File

@@ -62,6 +62,14 @@ OpenLayers.Handler.Drag = OpenLayers.Class(OpenLayers.Handler, {
*/
start: null,
/**
* Property: lastMoveEvt
* {Object} The last mousemove event that occurred. Used to
* position the map correctly when our "delay drag"
* timeout expired.
*/
lastMoveEvt: null,
/**
* Property: oldOnselectstart
* {Function}
@@ -209,7 +217,7 @@ OpenLayers.Handler.Drag = OpenLayers.Class(OpenLayers.Handler, {
this.oldOnselectstart = document.onselectstart;
document.onselectstart = OpenLayers.Function.False;
}
this.last = this.evt.xy;
this.last = evt.xy;
}
return true;
},
@@ -341,6 +349,7 @@ OpenLayers.Handler.Drag = OpenLayers.Class(OpenLayers.Handler, {
* {Boolean} Let the event propagate.
*/
mousemove: function(evt) {
this.lastMoveEvt = evt;
return this.dragmove(evt);
},
@@ -364,6 +373,12 @@ OpenLayers.Handler.Drag = OpenLayers.Class(OpenLayers.Handler, {
*/
removeTimeout: function() {
this.timeoutId = null;
// if timeout expires while we're still dragging (mouseup
// hasn't occurred) then call mousemove to move to the
// correct position
if(this.dragging) {
this.mousemove(this.lastMoveEvt);
}
},
/**