fix setMinZoom/setMaxZoom

when view has resolutions property, setMinZoom/setMaxZoom doesn't work.
This commit is contained in:
cs09g
2017-11-28 16:20:26 +09:00
parent 841e79b0e8
commit 466d63ac41
3 changed files with 67 additions and 4 deletions

View File

@@ -1147,6 +1147,56 @@ describe('ol.View', function() {
});
describe('#setMaxZoom', function() {
describe('with resolutions property in view', function() {
it('changes the zoom level when the level is over max zoom', function() {
var view = new ol.View({
resolutions: [100000, 50000, 25000, 12500, 6250, 3125],
zoom: 4
});
view.setMaxZoom(2);
expect(view.getZoom()).to.be(2);
});
});
describe('with no resolutions property in view', function() {
it('changes the zoom level when the level is over max zoom', function() {
var view = new ol.View({
zoom: 4
});
view.setMaxZoom(2);
expect(view.getZoom()).to.be(2);
});
});
});
describe('#setMinZoom', function() {
describe('with resolutions property in view', function() {
it('changes the zoom level when the level is under min zoom', function() {
var view = new ol.View({
resolutions: [100000, 50000, 25000, 12500, 6250, 3125],
zoom: 4
});
view.setMinZoom(5);
expect(view.getZoom()).to.be(5);
});
});
describe('with no resolutions property in view', function() {
it('changes the zoom level when the level is under min zoom', function() {
var view = new ol.View({
zoom: 4
});
view.setMinZoom(5);
expect(view.getZoom()).to.be(5);
});
});
});
describe('#calculateExtent', function() {
it('returns the expected extent', function() {
var view = new ol.View({
@@ -1438,5 +1488,4 @@ describe('ol.View.isNoopAnimation()', function() {
expect(noop).to.equal(c.noop);
});
});
});