Zn2O / gwt-google-apis

Automatically exported from code.google.com/p/gwt-google-apis
0 stars 0 forks source link

Maps: getLatLng() returns null whan clicked on overlay #115

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Found in Release:

0.0.290 the current milestone build

Detailed description:

When grabbing the coordinates of a click like this:

map.addMapClickHandler(new MapClickHandler() {
      public void onClick(MapClickEvent e) 
      {
         Window.alert("LatLng: "+e.getLatLng()); 
      }
  });

getLatLng() returns null when an overlay like a polyline is clicked instead
of returning the LatLng.

Workaround if you have one:

Links to the relevant GWT Developer Forum posts:

Original issue reported on code.google.com by sore...@gmail.com on 30 Apr 2008 at 7:45

GoogleCodeExporter commented 9 years ago
Thanks for trying out the milestone and filing this report.

I believe this is expected behavior for the MAPS api. You get either the  
Overlay or
LatLng populated in the event.

from http://code.google.com/apis/maps/documentation/reference.html#GMap2

" click  overlay,latlng     This event is fired when the map is clicked with the 
mouse.
If the click was on a clickable overlay (like a GMarker, GPolygon, GPolyline, or
GInfoWindow), then that overlay is passed to the event handler in the overlay
argument, and a click event is also fired on the overlay. Otherwise, the 
geographical
coordinates of the point that was clicked are passed in the latlng argument."

This behavior is also documented in the javadoc for MapClickEvent.

Original comment by galgwt.reviews@gmail.com on 30 Apr 2008 at 7:59

GoogleCodeExporter commented 9 years ago
Thank you. I didn't realise this, and i still think it would be nice to get the
relevant LatLng, but then it is the MAPS api guys i will have to talk to.

I have been playing a bit with the new release, and it seems more stable than 
the r42.

Original comment by sore...@gmail.com on 30 Apr 2008 at 8:09

GoogleCodeExporter commented 9 years ago

Original comment by zundel@google.com on 21 Dec 2009 at 1:57