When you have a polygon feature over a point feature in the same layer, and you
attempt to drag the point feature, you get errors about this.feature.geometry being undefined. Fix this by not unsetting this.feature inside the doneDragging. (Closes #971) git-svn-id: http://svn.openlayers.org/trunk/openlayers@4341 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -253,7 +253,6 @@ OpenLayers.Control.DragFeature = OpenLayers.Class(OpenLayers.Control, {
|
|||||||
*/
|
*/
|
||||||
doneDragging: function(pixel) {
|
doneDragging: function(pixel) {
|
||||||
this.onComplete(this.feature, pixel);
|
this.onComplete(this.feature, pixel);
|
||||||
this.feature = null;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -163,6 +163,30 @@
|
|||||||
map.events.triggerEvent("mousemove", {xy: move, which: 1});
|
map.events.triggerEvent("mousemove", {xy: move, which: 1});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function test_Control_DragFeature_done(t) {
|
||||||
|
t.plan(2);
|
||||||
|
var map = new OpenLayers.Map("map");
|
||||||
|
var layer = new OpenLayers.Layer.Vector();
|
||||||
|
map.addLayer(layer);
|
||||||
|
var control = new OpenLayers.Control.DragFeature(layer);
|
||||||
|
map.addControl(control);
|
||||||
|
|
||||||
|
control.activate();
|
||||||
|
|
||||||
|
|
||||||
|
// simulate a mouseover on a feature
|
||||||
|
layer.getFeatureFromEvent = function() {
|
||||||
|
return "foo";
|
||||||
|
};
|
||||||
|
map.events.triggerEvent("mousemove");
|
||||||
|
t.eq(control.feature, "foo",
|
||||||
|
"feature is set on mouse over");
|
||||||
|
control.doneDragging();
|
||||||
|
t.eq(control.feature, "foo",
|
||||||
|
"feature sticks around after doneDragging is called.");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
function test_Control_DragFeature_out(t) {
|
function test_Control_DragFeature_out(t) {
|
||||||
t.plan(2);
|
t.plan(2);
|
||||||
|
|||||||
Reference in New Issue
Block a user