Enable/disable some context-menu options conditional on zoom
This commit is contained in:
parent
8d0472f2ca
commit
a2cf9b5b9f
1 changed files with 4 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue