mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 01:02:58 +00:00
Add minzoom check to map.zoom() (closes #2499)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user