Here is a simplified example of the question:
http://www.pinksy.co.uk/newsquare/overlaytest.html
The map is 600px wide, 300px high. An overlay is created as suggested
above. A click event is added. On click, it adds a marker at the LatLng at
300px,150px (i.e., what I expect to be the center of the map), using the
code:
var pixelLatLang = overlay.getProjection().fromDivPixelToLatLng(new
google.maps.Point(300,150));
var marker = new google.maps.Marker({
position: pixelLatLng,
map: map
});
The first time you click, it puts the marker at 300px,150px. But if you pan
the map about a bit and click again, it doesn't put the marker
at 300px,150px anymore. Why not?
Thanks again for your help!
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-maps-js-api-v3/-/R_GOoxT9j1EJ.
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-js-api-v3?hl=en.