| Issue 2148: | event.latLng Missing! | |
| 9 people starred this issue and may be notified of changes. | Back to list |
Recently the event.latLng changed name to event.Hk, this messes up alot och code!
Feb 3, 2010
#1
[email protected]
Feb 10, 2010
is it permanent ?
Feb 10, 2010
Well its a permanent error for me.
Feb 10, 2010
Bit of a annoyance this one, definitely seems to affect click events generated by polygons, markers and map are unaffected as far as I can tell, be nice to know why it's changed if it's going to be permanent as it's not in the changelog or if it's just a simple mistake.
Feb 15, 2010
it works for markers but not for infowindows etc. I mean you can put a marker on event.latLng but you can't put a infowindow on event.latLng...
Feb 19, 2010
(No comment was entered for this change.)
Status:
FixedNotReleased
Labels: Internal-2420976
Feb 24, 2010
Seems to be "event.Qi" for markers right now...
Feb 26, 2010
(No comment was entered for this change.)
Labels:
Fixed-29
Feb 26, 2010
(No comment was entered for this change.)
Status:
Fixed
Apr 22, 2010
It still doesn't work for me. My code is simple:
var listener = google.maps.event.addListener(marker,'click',function(event)
{
var theHtml = $('markerOptions').innerHTML;
var infowindow = new google.maps.InfoWindow({ content:theHtml });
alert(event.latLng)
theHtml = theHtml.replace('%LAT%', event.latLng.lat() );
theHtml = theHtml.replace('%LNG%', event.latLng.lng() );
map.setCenter(event.latLng);
infowindow.setContent(theHtml);
infowindow.setPosition(event.latLng);
infowindow.open(map,marker);
});
the event.latLng is undefined.
Sep 6, 2010
me too, event.latLng im using this api http://maps.google.com/maps/api/js?sensor=false maybe a specific version will work?
Sep 6, 2010
Instead of accessing event you will want to access this.getPosition() so:
var listener = google.maps.event.addListener(marker,'click',function() {
var theHtml = $('markerOptions').innerHTML;
var infowindow = new google.maps.InfoWindow({ content:theHtml });
var position = this.getPosition();
theHtml = theHtml.replace('%LAT%', position.lat() );
theHtml = theHtml.replace('%LNG%', positon.lng() );
map.setCenter(positon);
infowindow.setContent(theHtml);
infowindow.setPosition(position); // You don't need this line because the one below overwrites it.
infowindow.open(map, this);
});
Sep 6, 2010
but, why api reference still saying that event.latLng is available?
Sep 6, 2010
The reference for the click event on a marker (https://code.google.com/apis/maps/documentation/javascript/reference.html#Marker) says the arguments are an Event, not a MouseEvent. Only drag, dragend and dragstart are MouseEvents. |
|
| ► Sign in to add a comment |