diff --git a/js/id/id.js b/js/id/id.js index 60c7a37bf..4e13a3cfc 100644 --- a/js/id/id.js +++ b/js/id/id.js @@ -40,13 +40,13 @@ window.iD = function(container) { .on('click.editor', function (mode) { controller.enter(mode); }); function disableTooHigh() { - if (map.zoom() < 16) { + if (map.editable()) { + notice.message(''); + buttons.attr('disabled', null); + } else { buttons.attr('disabled', 'disabled'); notice.message('Zoom in to edit the map'); controller.enter(iD.modes.Browse()); - } else { - notice.message(''); - buttons.attr('disabled', null); } } @@ -209,9 +209,9 @@ window.iD = function(container) { }); var keybinding = d3.keybinding('main') - .on('P', function() { controller.enter(iD.modes.AddPoint()); }) - .on('L', function() { controller.enter(iD.modes.AddLine()); }) - .on('A', function() { controller.enter(iD.modes.AddArea()); }) + .on('P', function() { if (map.editable()) controller.enter(iD.modes.AddPoint()); }) + .on('L', function() { if (map.editable()) controller.enter(iD.modes.AddLine()); }) + .on('A', function() { if (map.editable()) controller.enter(iD.modes.AddArea()); }) .on('⌘+Z', function() { history.undo(); }) .on('⌃+Z', function() { history.undo(); }) .on('⌘+⇧+Z', function() { history.redo(); }) diff --git a/js/id/renderer/map.js b/js/id/renderer/map.js index f5f2a2dd5..28b60c385 100644 --- a/js/id/renderer/map.js +++ b/js/id/renderer/map.js @@ -161,7 +161,7 @@ iD.Map = function() { dispatch.move(map); surface.attr('data-zoom', ~~map.zoom()); tilegroup.call(background); - if (map.zoom() >= 16) { + if (map.editable()) { connection.loadTiles(projection); drawVector(difference); } else { @@ -331,6 +331,10 @@ iD.Map = function() { } }; + map.editable = function() { + return map.zoom() >= 16; + }; + map.minzoom = function(_) { if (!arguments.length) return minzoom; minzoom = _;