X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/e58a5c69d3e7cdedfcf6a056fdb74aa505c5e285..cf896fa0a7f92c3243d840ec57b820f7f1e9ad0c:/app/assets/javascripts/index/contextmenu.js diff --git a/app/assets/javascripts/index/contextmenu.js b/app/assets/javascripts/index/contextmenu.js index 8a4654b97..080a4de72 100644 --- a/app/assets/javascripts/index/contextmenu.js +++ b/app/assets/javascripts/index/contextmenu.js @@ -8,7 +8,8 @@ OSM.initializeContextMenu = function (map) { lng = latlng.lng.toFixed(precision); OSM.router.route("/directions?" + querystring.stringify({ - route: lat + "," + lng + ";" + $("#route_to").val() + from: lat + "," + lng, + to: $("#route_to").val() })); } }); @@ -22,7 +23,8 @@ OSM.initializeContextMenu = function (map) { lng = latlng.lng.toFixed(precision); OSM.router.route("/directions?" + querystring.stringify({ - route: $("#route_from").val() + ";" + lat + "," + lng + from: $("#route_from").val(), + to: lat + "," + lng })); } }); @@ -30,9 +32,12 @@ OSM.initializeContextMenu = function (map) { map.contextmenu.addItem({ text: I18n.t("javascripts.context.add_note"), callback: function addNoteHere(e) { - // I'd like this, instead of panning, to pass a query parameter about where to place the marker - map.panTo(e.latlng.wrap(), {animate: false}); - OSM.router.route("/note/new"); + var precision = OSM.zoomPrecision(map.getZoom()), + latlng = e.latlng.wrap(), + lat = latlng.lat.toFixed(precision), + lng = latlng.lng.toFixed(precision); + + OSM.router.route("/note/new?lat=" + lat + "&lon=" + lng); } }); @@ -44,7 +49,7 @@ OSM.initializeContextMenu = function (map) { lat = latlng.lat.toFixed(precision), lng = latlng.lng.toFixed(precision); - OSM.router.route("/search?query=" + encodeURIComponent(lat + "," + lng)); + OSM.router.route("/search?whereami=1&query=" + encodeURIComponent(lat + "," + lng)); } }); @@ -68,9 +73,8 @@ OSM.initializeContextMenu = function (map) { }); map.on("mousedown", function (e) { - if (e.shiftKey) map.contextmenu.disable(); - }).on("mouseup", function () { - map.contextmenu.enable(); + if (e.originalEvent.shiftKey) map.contextmenu.disable(); + else map.contextmenu.enable(); }); var updateMenu = function updateMenu () {