I will try this out, thank you. It seems though that there will be a
jerky motion with this method, unless it can be timed such that the
map center is changed at the exact same rate as the sidebar is moved
to the left (or right). Due to the fact that I do not control the rate
at which the maps center responds to calls to the setCenter command,
being able to make these two animations line up smoothly seems
impossible.

I suspect that at maps.google.com the effect is achieved another way,
where the map center is not needed to be changed, and I am hoping for
a more elegant solution.

On Mar 5, 1:32 am, Marcelo <[email protected]> wrote:
> On Mar 5, 4:16 am, ShaneB <[email protected]> wrote:
>
> > What I want to do is change this behavior to more closely match what
> > is seen on maps.google.com. On that site, when you open/close the
> > menu, the right edge of the map stays fixed and instead the map
> > expands on the left.
>
> > The difference is, on my map the location of the markers on your
> > screen changes, and on maps.google.com they stay fixed.
>
> What you need to do is to change the center of the map by half the
> pixel width of the sidebar.
>
> Here we assume that the left column is 370 pixels wide.
> When the left column collapses (map gets bigger to the left):
> ----------
> var pt =
> map.getCurrentMapType().getProjection().fromLatLngToPixel(map.getCenter(),map.getZoom());
> var newpt = new GPoint(pt.x - Math.floor(370/2),pt.y);
> var newCenter =
> map.getCurrentMapType().getProjection().fromPixelToLatLng(newpt,map.getZoom());
> map.checkResize();
> map.setCenter(newCenter);
> ----------
> and when the left column gets expanded you need to move the center in
> the opposite direction.
>
> --
> Marcelo -http://maps.forum.nu
> --

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-api?hl=en.

Reply via email to