]> git.openstreetmap.org Git - rails.git/commitdiff
Add "Query features" to context menu
authorDan Stowell <danstowell@users.sourceforge.net>
Fri, 7 Aug 2015 20:15:05 +0000 (21:15 +0100)
committerDan Stowell <danstowell@users.sourceforge.net>
Fri, 7 Aug 2015 20:15:05 +0000 (21:15 +0100)
app/assets/javascripts/index.js

index 8964cef1dd78138410b3477d9dc7aa7985f10829..dbc4b8c338e0723154e6f70e90e4062f25c112bc 100644 (file)
@@ -108,6 +108,15 @@ $(document).ready(function () {
     map.panTo(e.latlng);
   }
 
     map.panTo(e.latlng);
   }
 
+  var context_queryhere = function(e) {
+    var precision = OSM.zoomPrecision(map.getZoom()),
+      latlng = e.latlng.wrap(),
+      lat = latlng.lat.toFixed(precision),
+      lng = latlng.lng.toFixed(precision);
+
+    OSM.router.route("/query?lat=" + lat + "&lon=" + lng);
+  }
+
   // TODO internationalisation of the context menu strings
   var map = new L.OSM.Map("map", {
     zoomControl: false,
   // TODO internationalisation of the context menu strings
   var map = new L.OSM.Map("map", {
     zoomControl: false,
@@ -126,6 +135,9 @@ $(document).ready(function () {
     }, {
         text: 'Show address',
         callback: context_describe
     }, {
         text: 'Show address',
         callback: context_describe
+    }, {
+        text: 'Query features',
+        callback: context_queryhere
     }, {
         text: 'Centre map here',
         callback: context_centrehere
     }, {
         text: 'Centre map here',
         callback: context_centrehere