Restore drag handler state in deactivate. r=erilem (closes #3218)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@11808 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Tim Schaub
2011-03-30 20:54:41 +00:00
parent a25f506f20
commit 587b2320ab
2 changed files with 7 additions and 2 deletions
+2
View File
@@ -146,6 +146,7 @@ OpenLayers.Handler.Drag = OpenLayers.Class(OpenLayers.Handler, {
} }
}, },
/** /**
* Method: dragstart * Method: dragstart
* This private method is factorized from mousedown and touchstart methods * This private method is factorized from mousedown and touchstart methods
@@ -507,6 +508,7 @@ OpenLayers.Handler.Drag = OpenLayers.Class(OpenLayers.Handler, {
deactivate: function() { deactivate: function() {
var deactivated = false; var deactivated = false;
if(OpenLayers.Handler.prototype.deactivate.apply(this, arguments)) { if(OpenLayers.Handler.prototype.deactivate.apply(this, arguments)) {
this.touch = false;
this.started = false; this.started = false;
this.dragging = false; this.dragging = false;
this.start = null; this.start = null;
+5 -2
View File
@@ -416,7 +416,7 @@
} }
function test_Handler_Drag_deactivate(t) { function test_Handler_Drag_deactivate(t) {
t.plan(6); t.plan(7);
var map = new OpenLayers.Map('map'); var map = new OpenLayers.Map('map');
var control = new OpenLayers.Control(); var control = new OpenLayers.Control();
map.addControl(control); map.addControl(control);
@@ -427,6 +427,7 @@
"deactivate returns false if the handler was not already active"); "deactivate returns false if the handler was not already active");
handler.active = true; handler.active = true;
handler.dragging = true; handler.dragging = true;
handler.touch = true;
deactivated = handler.deactivate(); deactivated = handler.deactivate();
t.ok(deactivated, t.ok(deactivated,
"deactivate returns true if the handler was active already"); "deactivate returns true if the handler was active already");
@@ -437,7 +438,9 @@
t.ok(handler.start == null, t.ok(handler.start == null,
"deactivate sets start to null"); "deactivate sets start to null");
t.ok(handler.last == null, t.ok(handler.last == null,
"deactivate sets start to null"); "deactivate sets last to null");
t.ok(!handler.touch,
"deactivate sets touch to false");
} }
function test_interval_timer_after_mouseup(t) { function test_interval_timer_after_mouseup(t) {