[OpenLayers-Users] Drag cancellation ?

Attila Csipa plists at prometheus.org.yu
Mon Jan 7 05:25:14 EST 2008


On Monday 07 January 2008 06:59:01 Eric Lemoine wrote:
> Off the top of my head: you could try to erase the feature before
> calling layer.redraw() in the onComplete() callback. To erase the
> feature use feature.layer.eraseFeatures([feature]).

Thanks for the tip, after taking a look at the source of 
Layer.Vector.removeFeatures, I found what I needed (and also figured out why 
i didn't work in the first place). Just changing the geometry of an already 
drawn feature leaves the old geometry in the renderer, that's why I ended up 
with both old and new geometries even though there was only one feature with 
one geometry. The magic line in onComplete (before restoring the original 
geometry) thus is:

feature.layer.renderer.eraseGeometry(feature.geometry);



More information about the Users mailing list