Definitely helps a bit, but "nePixel.x+210" seems to be interpreted not as pixels... With a value of 2, the extensions is about 200%.
On Apr 28, 3:45 pm, marcelo <[email protected]> wrote: > Extend the bounds of the markers by 210 x-pixels from the NorthEast: > > UNTESTED! > ----------------------------- > var proj = map.getCurrentMapType().getProjection(); > var nePixel = proj.fromLatLngToPixel(bounds().getNorthEast(), > map.getZoom()); > var extendedPixel = new GPoint(nePixel.x+210, nePixel.y); > var newNE = proj.fromPixelToLatLng(extendedPixel, map.getZoom()); > bounds.extend(newNE); > > map.setCenter(bounds.getCenter(),map.getBoundsZoomLevel(bounds)); > > -- > Marcelo -http://maps.forum.nu > -- > > On Apr 28, 11:01 pm, René <[email protected]> wrote: > > > > > That's one way, but I'm sure there must be someway to add/subtract a > > pixel value to the bounds value, as if assuming a smaller viewport. > > > On Apr 28, 2:28 pm, Rossko <[email protected]> wrote: > > > > > ...my question is, how should I compensate for the sidebar div, so > > > > that when the map is zoomed and re-centered, the sidebar doesn't cover > > > > the markers? > > > > You could get the API to do most of the work by having a second map, > > > invisible but created with a proper size - same height but 200px > > > narrower than the visible one. > > > Do your bounds, centre and zoom work on the invisible version. > > > Work out a primary map centre by - get LatLngtoPixel from the > > > invisible centre, add on a 200px displacement (so the target centre is > > > right-shifted from the bounds centre), and reconvert Pixel to LatLng. > > > > cheers, Ross K --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
