Hey all,

So I'm trying to implement a way to drag-n-drop <img>'s on to a map.
It's generally working fine, but, if I zoom or pan the map then the
coordinates (for the dropped <img>) are offset by however much I
zoomed or panned. I uploaded a demo of the code in action here:
http://mattpowell.name/google-maps-example.html

But the gist is, I'm creating a fake overlay proto like this:

            google.maps._overlay=function (map) {this.setMap(map);}
            google.maps._overlay.prototype = new
google.maps.OverlayView();
            google.maps._overlay.prototype.onAdd = function(){}
            google.maps._overlay.prototype.onRemove = function(){}
            google.maps._overlay.prototype.draw = function() {}

Instantiating my fake overlay whenever I create my map:

            var map=new google.maps.Map($("map"),{})
            var overlay=new google.maps._overlay(map);

And in a dragend event getting the latlong like this:

            var projection = overlay.getProjection();
            var latlong = projection.fromDivPixelToLatLng(new
google.maps.Point(event.clientx, event.clienty))

Then adding a marker to the map the usual way.

It seems like I just need to tell my overlay to update whenever the
main map moves, but nothing I've tried has worked.

Anyways, I appreciate the help and let me know you need more info,
etc...

Matt

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" 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-js-api-v3?hl=en.

Reply via email to