mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-27 02:12:24 +02:00
Restrict zoom while drawing
This commit is contained in:
@@ -23,6 +23,8 @@ iD.modes.DrawLine = function(wayId, direction) {
|
||||
'Click on other lines to connect to them, and double-click to ' +
|
||||
'end the line.');
|
||||
|
||||
map.minzoom(16);
|
||||
|
||||
history.perform(
|
||||
iD.actions.AddNode(node),
|
||||
iD.actions.AddWayNode(wayId, node.id, index));
|
||||
@@ -147,6 +149,7 @@ iD.modes.DrawLine = function(wayId, direction) {
|
||||
|
||||
mode.map.hint(false);
|
||||
mode.map.fastEnable(true);
|
||||
mode.map.minzoom(0);
|
||||
|
||||
surface
|
||||
.on('mousemove.drawline', null)
|
||||
|
||||
+13
-1
@@ -12,6 +12,7 @@ iD.Map = function() {
|
||||
.on('zoom', zoomPan),
|
||||
dblclickEnabled = true,
|
||||
fastEnabled = true,
|
||||
minzoom = 0,
|
||||
background = iD.Background()
|
||||
.projection(projection),
|
||||
transformProp = iD.util.prefixCSSProperty('Transform'),
|
||||
@@ -114,6 +115,12 @@ iD.Map = function() {
|
||||
return d3.event.sourceEvent.preventDefault();
|
||||
}
|
||||
}
|
||||
if (Math.log(d3.event.scale / Math.LN2 - 8) < minzoom + 1) {
|
||||
iD.flash()
|
||||
.select('.content')
|
||||
.text('Cannot zoom out further in current mode.')
|
||||
return map.zoom(16);
|
||||
}
|
||||
var fast = (d3.event.scale === projection.scale() && fastEnabled);
|
||||
projection
|
||||
.translate(d3.event.translate)
|
||||
@@ -144,7 +151,7 @@ iD.Map = function() {
|
||||
dispatch.move(map);
|
||||
surface.attr('data-zoom', ~~map.zoom());
|
||||
tilegroup.call(background);
|
||||
if (map.zoom() > 16) {
|
||||
if (map.zoom() >= 16) {
|
||||
connection.loadTiles(projection);
|
||||
drawVector(difference);
|
||||
} else {
|
||||
@@ -276,6 +283,11 @@ iD.Map = function() {
|
||||
}
|
||||
};
|
||||
|
||||
map.minzoom = function(_) {
|
||||
if (!arguments.length) return minzoom;
|
||||
minzoom = _;
|
||||
};
|
||||
|
||||
map.history = function (_) {
|
||||
if (!arguments.length) return history;
|
||||
history = _;
|
||||
|
||||
Reference in New Issue
Block a user