You could solve the problem with where the inowindow opens by adding your sidebar to the map as a HtmlControl:
http://googlemapsapi.martinpearman.co.uk/htmlcontrol/ The map will pan to avoid opening an infowindow under the sidebar as the sidebar is now a GControl() type. If that's acceptable then surely you could take account of the sidebar (if it is currently visible) in your map bounds calculations? Martin. On 6 Mar, 07:42, ShaneB <[email protected]> wrote: > Hi Brian. Thanks for responding! I agree that the downsides to the > suggested method, having info windows pop up behind the sidebar and > having getBounds not behave as desired, are significant. However > putting the sidebar on the right is a reasonable suggestion. > > On Mar 5, 10:36 am, Brian P <[email protected]> wrote: > > > Here is an idea: > > > Keep the size of your map div large and put your sidebar div over top > > of the map. Then you just need to offset the setCenter command when > > the sidebar is open if you want the visible center to be at that > > point. Of course, you can just always assume that the map is full- > > width, and just have the sidebar/menu over top or not. Obviously, if > > the sidebar/menu div is on top of the map div, the API could open > > infowindows underneath the sidebar, not properly panning the map to > > show the whole infowindow. So that's a drawback to doing it this way. > > Also, you'd have problems with getBounds returning a larger area that > > what is actually visible which could affect your page. > > > Alternatively, put the menu on the right instead of the left and see > > how that works. > > > On Mar 5, 10:32 am, ShaneB <[email protected]> wrote: > > > > 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.
