]> git.openstreetmap.org Git - rails.git/blobdiff - app/views/site/index.rhtml
Began code for feature lookup: implemented code to respond to mouse click and latlon...
[rails.git] / app / views / site / index.rhtml
index 27bcd618e34a1b173add177bc00cc469748f4341..878720efc7888b62abfe9654c21f490778f399f3 100644 (file)
@@ -51,7 +51,7 @@ by the OpenStreetMap project and it's contributors.
 <% zoom =  h(params['zoom'] || '12') %>
 <% layers = h(params['layers']) %>
 <% elsif cookies.key?("location") %>
-<% lon,lat,zoom,layers = cookies["location"].value.first.split(",") %>
+<% lon,lat,zoom,layers = cookies["location"].split(",") %>
 <% elsif @user and !@user.home_lon.nil? and !@user.home_lat.nil? %> 
 <% lon =  @user.home_lon %>
 <% lat =  @user.home_lat %>
@@ -115,11 +115,20 @@ by the OpenStreetMap project and it's contributors.
 
     map.events.register("moveend", map, updateLocation);
     map.events.register("changelayer", map, updateLocation);
+    map.events.register("click", map, mapClick);
     updateLocation();
 
     handleResize();
   }
 
+  // Map click results in feature lookup
+  function mapClick(e) {
+      var pos = lonLatToNonSphericalMercator
+                (mercatorToLonLat
+                    (map.getLonLatFromViewPortPx 
+                        ( map.events.getMousePosition(e))));
+  }
+
   function getPosition() {
     return mercatorToLonLat(map.getCenter());
   }