On Jun 4, 11:44 pm, Chris Drackett <[email protected]> wrote:
>
> I can't seem to figure out how to pan the map in a way that the
> selected marker is on the left edge and not the center.

Say you want to move the map centre 300px to the east (so that the
marker moves left). The problem becomes one of how to work out how far
in degrees 300px is. Something like the following, perhaps, which is
untested. You'll need to recentre the map at each zoom change because
300px represents a different distance at each level.

var M = new GLatLng(x,y) // position of Marker
var Mp = map.fromLatLngToContainerPixel(M);
        // pixel-based coordinates as GPoint()
var Cp = new GPoint(Mp.x+300,Mp.y)
        // centre point of map 300px to the east
var C = map.fromContainerPixelToLatLng(Cp);
        // GLatLng of map centre
map.setCenter(C)

Andrew
--~--~---------~--~----~------------~-------~--~----~
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