On Sep 22, 8:33 pm, jbliesener <[EMAIL PROTECTED]> wrote: > Folks, > > I have a problem which I don't know how to resolve. I'm using Google > Maps API in my GWT application, however the question is related more > to the general API than to GWT. > > I have a map with n GMarkers and possibly a GInfoWindow. I would like > to calculate map bounds and zoom so that ALL markers AND the > infowindow are fully shown in the view. > > My first problem is to obtain the left/top/width/height coordinates of > the InfoWindow. Any idea how to do this without tampering with browser > specific code?
The infowindow is dynamically sized to fit its contents. I don't know of anyway to pre-calculate its size. If all your infoWindows are the same size, or if there size can be precalculated off-line, then you might be able to attempt this. However, you would have to make sure that user adjustments of the font size don't affect the size of the infoWindow... > > Next question: I would have to calculate the pixel bounds of the set > of markers in the new zoom scale without actually drawing them. Only > this would allow me to test whether it would be possible to show the > (fixed sized) infowindow and the (variable scale) markers on the same > screen. (I would calculate union of the marker set bounds and the > infowindow bounds and compare it with the screen size. If it were > beyond, I would reduce zoom and try again). The API provides methods for doing that: http://code.google.com/apis/maps/documentation/reference.html#GMap2.Methods.Map-State getBoundsZoomLevel(bounds) -- Larry --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
