[OpenLayers-Users] little bug by using NavigationHistory and setBaselayer

Eric Lemoine eric.lemoine at camptocamp.com
Thu Oct 29 04:04:41 EDT 2009


On Thursday, October 22, 2009, Max Weidemann <max.weidemann at freenet.de> wrote:
>
> Hi List,
>
> i found a bug by using the NavigationHistory control.
> If you change the baselayers of a map (for Example in the layerswitcher) the
> NavigationHistory registers an moveend Event and saves the same state of the
> map again.
> if you now try to use the NavigationHistory Control to switch to a previous
> state you have to click multiple times.
> I think this effekt is caused by calling the setCenter function in the
> setBaseLayer function.
>
> I have 2 ideas for solving this Problem and would like to know wich is the
> smartest or if there are smarter solutions.
>
> 1. unregister the moveend event before calling the setCenter function and
> after that register it again.

you mean having setCenter not triggering "moveend" in that specific case?

I think we shouldn't change this, as there maybe code relying on
"moveend" being triggered when switching base layer.

>
> 2. checking the first entry in the previousStack Array of the
> NavigationHistory-control and compare it with the current map state. if they
> are equal i would'nt save it in the Array.

such a check would make sense to me. We could either introduce a
tolerance option in there.

Thanks,

-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com



More information about the Users mailing list