[OpenLayers-Users] Drag cancellation ?

Eric Lemoine eric.c2c at gmail.com
Mon Jan 7 06:39:30 EST 2008


On Jan 7, 2008 11:25 AM, Attila Csipa <plists at prometheus.org.yu> wrote:
> 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);

The line I gave you does just the same in this case I guess.

--
Eric



More information about the Users mailing list