From: Dan Stowell Date: Fri, 7 Aug 2015 20:15:05 +0000 (+0100) Subject: Add "Query features" to context menu X-Git-Tag: live~3596^2~4^2~6 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/6e12650a453461d8c98c17c82f70d1a0f2df3940?hp=cd61c8e0653b8edd5229e73f19aa89b54e5df74c Add "Query features" to context menu --- 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