Problem with map._forceRedraw and map.setCenter

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem with map._forceRedraw and map.setCenter

Jordan Anderson
Hey all,

I had asked a question about automatically redrawing the map when an
overlay is added/removed. Vladimir had kindly provided two lines that
would help with this:

map._forceRedraw = true;
map.setCenter(map.getCenter(), map.getZoom());

In some cases, this causes a problem with my other overlays: markers
and polylines. To reproduce, go here:
http://missoula.ridethecity.com/nyc?rid=578603 and wait until it
finishes loading and generating a route.

Now pan the map slightly to the left or right by dragging it.

Then click the show/hide overlay link the box in the upper-right-hand
side of the map (under the stop sign). What will happen is the overlay
is toggled correctly (you should see that), but the bike shop markers
and route polylines get shifted over about the same amount as I just
panned. If you click the overlay on and off without panning, it seems
to work fine... And if I zoom in or zoom out, it seems to refresh the
map back to the correct state.

Any help would be appreciated.

Thanks,
Jordan
_______________________________________________
Dev site list
[hidden email]
http://lists.cloudmade.com/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: Problem with map._forceRedraw and map.setCenter

Vladimir Agafonkin
Hi Jordan,

Thanks for reporting. Not sure about the cause of the problem, investigating this at the moment...

On Thu, Apr 15, 2010 at 8:51 PM, Jordan Anderson <[hidden email]> wrote:
Hey all,

I had asked a question about automatically redrawing the map when an
overlay is added/removed. Vladimir had kindly provided two lines that
would help with this:

map._forceRedraw = true;
map.setCenter(map.getCenter(), map.getZoom());

In some cases, this causes a problem with my other overlays: markers
and polylines. To reproduce, go here:
http://missoula.ridethecity.com/nyc?rid=578603 and wait until it
finishes loading and generating a route.

Now pan the map slightly to the left or right by dragging it.

Then click the show/hide overlay link the box in the upper-right-hand
side of the map (under the stop sign). What will happen is the overlay
is toggled correctly (you should see that), but the bike shop markers
and route polylines get shifted over about the same amount as I just
panned. If you click the overlay on and off without panning, it seems
to work fine... And if I zoom in or zoom out, it seems to refresh the
map back to the correct state.

Any help would be appreciated.

Thanks,
Jordan
_______________________________________________
Dev site list
[hidden email]
http://lists.cloudmade.com/listinfo/dev



--
Vladimir Agafonkin
Front-End Architect, CloudMade
+380 93 745 44 61

_______________________________________________
Dev site list
[hidden email]
http://lists.cloudmade.com/listinfo/dev