diff --git a/js/id/renderer/map.js b/js/id/renderer/map.js index 1dcd59fb1..84531e16a 100644 --- a/js/id/renderer/map.js +++ b/js/id/renderer/map.js @@ -326,6 +326,13 @@ iD.Map = function(context) { return Math.max(Math.log(projection.scale() * 2 * Math.PI) / Math.LN2 - 8, 0); } + if (z < minzoom) { + iD.ui.flash(context.container()) + .select('.content') + .text(t('cannot_zoom')); + z = context.minEditableZoom(); + } + if (setZoom(z)) { dispatch.move(map); } diff --git a/test/spec/renderer/map.js b/test/spec/renderer/map.js index 43e9c59f1..42d10b110 100644 --- a/test/spec/renderer/map.js +++ b/test/spec/renderer/map.js @@ -30,6 +30,12 @@ describe('iD.Map', function() { map.zoom(4); expect(spy).not.to.have.been.called; }); + + it('respects minzoom', function() { + map.minzoom(16); + map.zoom(15); + expect(map.zoom()).to.equal(16); + }); }); describe('#zoomIn', function() {