From 6e12650a453461d8c98c17c82f70d1a0f2df3940 Mon Sep 17 00:00:00 2001 From: Dan Stowell Date: Fri, 7 Aug 2015 21:15:05 +0100 Subject: [PATCH 1/1] Add "Query features" to context menu --- app/assets/javascripts/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/assets/javascripts/index.js b/app/assets/javascripts/index.js index 8964cef1d..dbc4b8c33 100644 --- a/app/assets/javascripts/index.js +++ b/app/assets/javascripts/index.js @@ -108,6 +108,15 @@ $(document).ready(function () { 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, @@ -126,6 +135,9 @@ $(document).ready(function () { }, { text: 'Show address', callback: context_describe + }, { + text: 'Query features', + callback: context_queryhere }, { text: 'Centre map here', callback: context_centrehere -- 2.43.2