On 31.03.2011 21:35, David wrote:
> I'm trying to get the coordinates for a single click on the map.
>
> The code below is something I've cobbled together that gets the coords
> for the center of the map, upon double click. But I'd like to get the
> point under the mouse when I single click.
>
> (stuff in comments are attempts)
>
>
> google.maps.event.addListener(
> map, "dblclick", function(
> overlay, latlng, overlaylatlng
> ) {
> // var point = new GLatLng( latlng.y, latlng.x );
> //document.getElementById("log").innerHTML =
> map.getCenter().toString();
> document.getElementById("log").innerHTML = '|' +
> map.getCenter().lat().toFixed(6) + ' |' +
> map.getCenter().lng().toFixed(6);
> });
>
This is mixed V2 and V3 code. See the reference for the Map class
<https://code.google.com/apis/maps/documentation/javascript/reference.html#Map>,
the dblclick event callback only gets one argument (MouseEvent), which
contains the lat/lng of the click.
--
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.