You are looking at posts that were written on February 22nd, 2010.
| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
| « Jan | Mar » | |||||
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| 8 | 9 | 10 | 11 | 12 | 13 | 14 |
| 15 | 16 | 17 | 18 | 19 | 20 | 21 |
| 22 | 23 | 24 | 25 | 26 | 27 | 28 |
Posted on February 22nd, 2010 by thiswayup.
Categories: dev.
Just to remind myself how to capture the event when the map is dragged AND work out the distance to a previously recorded center point on the map
GEvent.addListener(gmapFn.mapObj,'dragend',function(){
var ctrLatLng = gmapFn.mapObj.getCenter();
alert(ctrLatLng.distanceFrom(gmapFn.lastRefLatLng));
});
Very handy! gmapFn.mapObj = the object of the instianted gmap object and gmapFn.lastRefLatLng is a GLatLng. You can quickly get the center of a google map by calling the function gmapObject.getCenter() which returns the center as a GLatLng.
Enjoy!
Update : handy refrence of all the events you can to a google maps listener http://econym.org.uk/gmap/gevent.htm