How to add an event when googlemaps is dragged and calculate the distance from a previous point

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

0 comments.

Modx quick variable reference

Posted on November 30th, 2009 by thiswayup.
Categories: dev.

Just for my own personal reference. Here’s a quick list of the different types of variables in Modx.

  • [(varName)] = site setting, set site wide
  • [*varName*] = content or template var
  • [*#content*] = content var, like before sets in the document edit screen but the hash allows Quickedit
  • {{chunkName}} = chunk
  • [[snippetName]] = cachable code snippet
  • [!snippetName!] = uncached code snippet
  • [+placeholderName+] = place holder used inside snippet templates such as Ditto to show page id or Page title. Need to double chk what the specific snippet supports

0 comments.