mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-25 06:55:46 +00:00
Disable edit modes when zoomed out (fixes #473)
This commit is contained in:
14
js/id/id.js
14
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(); })
|
||||
|
||||
@@ -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 = _;
|
||||
|
||||
Reference in New Issue
Block a user