make the drag handler and drag feature control tidy up after themselves - as a bonus, give the drag feature control an onStart method. Thanks for the review crschmidt (closes #950).
git-svn-id: http://svn.openlayers.org/trunk/openlayers@4147 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -109,14 +109,13 @@
|
||||
}
|
||||
map.events.triggerEvent("mousemove");
|
||||
|
||||
t.ok(!control.dragHandler.dragging,
|
||||
"control is not dragging before the mousedown");
|
||||
|
||||
// simulate a mousedown on a feature
|
||||
control.onStart = function(feature, pixel) {
|
||||
t.eq(feature, "foo", "onStart called with the correct feature");
|
||||
t.eq(pixel, "bar", "onStart called with the correct pixel");
|
||||
}
|
||||
map.events.triggerEvent("mousedown", {xy: "bar", which: 1});
|
||||
|
||||
t.ok(control.dragHandler.dragging,
|
||||
"drag is dragging after the mousedown");
|
||||
t.eq(control.lastPixel, "bar",
|
||||
"mousedown sets the lastPixel correctly");
|
||||
}
|
||||
|
||||
@@ -306,7 +306,7 @@
|
||||
}
|
||||
|
||||
function test_Handler_Drag_deactivate(t) {
|
||||
t.plan(3);
|
||||
t.plan(6);
|
||||
var map = new OpenLayers.Map('map');
|
||||
var control = new OpenLayers.Control();
|
||||
map.addControl(control);
|
||||
@@ -320,8 +320,14 @@
|
||||
deactivated = handler.deactivate();
|
||||
t.ok(deactivated,
|
||||
"deactivate returns true if the handler was active already");
|
||||
t.ok(!handler.started,
|
||||
"deactivate sets started to false");
|
||||
t.ok(!handler.dragging,
|
||||
"deactivate sets dragging to false");
|
||||
t.ok(handler.start == null,
|
||||
"deactivate sets start to null");
|
||||
t.ok(handler.last == null,
|
||||
"deactivate sets start to null");
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user