From a2cf9b5b9f568c614ad8bbf8a477326b01cefb57 Mon Sep 17 00:00:00 2001 From: Dan Stowell Date: Sun, 9 Aug 2015 19:11:36 +0100 Subject: [PATCH] Enable/disable some context-menu options conditional on zoom --- app/assets/javascripts/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/index.js b/app/assets/javascripts/index.js index 69e223b22..6f081c617 100644 --- a/app/assets/javascripts/index.js +++ b/app/assets/javascripts/index.js @@ -98,9 +98,8 @@ $(document).ready(function () { })); } - // TODO only allow this if zoomed in enough var context_addnote = function(e){ - // TODO this currently doesn't work correctly - I think the "route" needs to be chained to ensure it comes once the pan has finished. + // I'd like this, instead of panning, to pass a query parameter about where to place the marker map.panTo(e.latlng, {animate: false}); OSM.router.route('/note/new'); } @@ -150,6 +149,9 @@ $(document).ready(function () { map.contextmenu.disable(); // on firefox, shift disables our contextmenu. we explicitly do this for all browsers. }else{ map.contextmenu.enable(); + // we also decide whether to disable some options that only like high zoom + map.contextmenu.setDisabled(3, map.getZoom() < 12); + map.contextmenu.setDisabled(5, map.getZoom() < 14); } }); -- 2.43.2