Permalink
Browse files

Watching map movements

  • Loading branch information...
1 parent acf4a5c commit 0d9d40417b723bf4100bd673a3ae7988fb901192 @pat pat committed Sep 29, 2008
Showing with 7 additions and 0 deletions.
  1. +7 −0 public/javascripts/application.js
@@ -15,4 +15,11 @@ if (map_element) {
// Add basic map controls
map.addControl(new GMapTypeControl());
map.addControl(new GLargeMapControl());
+
+ // Catch any map movements and store the new centre position
+ GEvent.addListener(map, "moveend", function() {
+ var centre = map.getCenter();
+ document.getElementById("lat").value = centre.lat();
+ document.getElementById("lon").value = centre.lng();
+ });
}

0 comments on commit 0d9d404

Please sign in to comment.