Merge pull request #10587 from jeremy-smith-maco/larger-resolution-constraint

Adds option to View for using larger resolution value when clamping #10586
This commit is contained in:
Andreas Hocevar
2020-02-05 11:10:43 +01:00
committed by GitHub
3 changed files with 57 additions and 12 deletions

View File

@@ -380,6 +380,32 @@ describe('ol.View', function() {
expect(constraint(1, 0, size)).to.be(5);
});
it('accepts extent and uses the smallest value', function() {
const constraint = getConstraint({
extent: [0, 0, 4000, 6000]
});
expect(constraint(1000, 0, size)).to.be(20);
expect(constraint(500, 0, size)).to.be(20);
expect(constraint(100, 0, size)).to.be(20);
expect(constraint(50, 0, size)).to.be(20);
expect(constraint(10, 0, size)).to.be(10);
expect(constraint(1, 0, size)).to.be(1);
});
it('accepts extent and showFullExtent and uses the larger value', function() {
const constraint = getConstraint({
extent: [0, 0, 4000, 6000],
showFullExtent: true
});
expect(constraint(1000, 0, size)).to.be(30);
expect(constraint(500, 0, size)).to.be(30);
expect(constraint(100, 0, size)).to.be(30);
expect(constraint(50, 0, size)).to.be(30);
expect(constraint(10, 0, size)).to.be(10);
expect(constraint(1, 0, size)).to.be(1);
});
});
describe('overspecified options (prefers resolution)', function() {