On Apr 17, 8:25 am, "[email protected]" <[email protected]> wrote: > On Apr 17, 8:16 am, Mugabe <[email protected]> wrote: > > > Thanks for the reply. > > I understand what you've said so I removed the overlay part and tried > > this: > > > GEvent.addListener(map, "click", function (point) { > > if (polygon.Contains(point)) { > > map.openInfoWindowHtml(point, "inside"); > > } else { > > map.openInfoWindowHtml(point, "outside"); > > } > > > }); > > > Nothing happens. Can you see where I am, going wrong? > > http://code.google.com/apis/maps/documentation/reference.html#GMap2.c... > > A click event passes different arguments based on the context of the > click, and whether or not the click occured on a clickable overlay. If > the click does not occur on a clickable overlay, the overlay argument > is null and the latlng argument contains the geographical coordinates > of the point that was clicked. If the user clicks on an overlay that > is clickable (such as a GMarker, GPolygon, GPolyline, or GInfoWindow), > the overlay argument contains the overlay object, while the > overlaylatlng argument contains the coordinates of the clicked > overlay. In addition, a click event is then also fired on the overlay > itself. > > The documentation isn't very clear (it used to be) [pamela can this be > clarified?], if you click on a polygon (which is an overlay, point is > null, overlay contains a reference to the overlay). To do what you > are trying to do, you may need to make sure the polygon is not > clickable.
Also, the first argument of the click event handler function is "overlay", not point. Calling it "point" doesn't change what it is. I contains a reference to the overlay if there was one, null otherwise. -- Larry > > http://www.robmaps.co.uk/Floor_plans/Chadwick/untitled.html > > > > > > > Thanks, > > Rob- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
