Enable/disable some context-menu options conditional on zoom

This commit is contained in:
Dan Stowell 2015-08-09 19:11:36 +01:00
parent 8d0472f2ca
commit a2cf9b5b9f

View file

@ -98,9 +98,8 @@ $(document).ready(function () {
})); }));
} }
// TODO only allow this if zoomed in enough
var context_addnote = function(e){ 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}); map.panTo(e.latlng, {animate: false});
OSM.router.route('/note/new'); 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. map.contextmenu.disable(); // on firefox, shift disables our contextmenu. we explicitly do this for all browsers.
}else{ }else{
map.contextmenu.enable(); 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);
} }
}); });