Skip to content

Commit

Permalink
Merge pull request #136 from nice-min/master
Browse files Browse the repository at this point in the history
Fixed #135
  • Loading branch information
perliedman committed Apr 19, 2017
2 parents 41d14b5 + b87c393 commit c2423cf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/proj4leaflet.js
Expand Up @@ -137,6 +137,9 @@
if (scale === downScale) {
return downZoom;
}
if (downScale === undefined) {
return -Infinity;
}
// Interpolate
nextZoom = downZoom + 1;
nextScale = this._scales[nextZoom];
Expand Down
16 changes: 13 additions & 3 deletions test/specs.js
Expand Up @@ -127,9 +127,9 @@ describe('L.Proj.CRS', function() {
resolutions: resolutions,
origin: [0, 5000]
}),
worldSize = 256,
i,
bounds;
worldSize = 256,
i,
bounds;

for (i = 0; i < resolutions.length; i++) {
bounds = crs.getProjectedBounds(i);
Expand Down Expand Up @@ -165,6 +165,15 @@ describe('L.Proj.CRS', function() {
expect(crs.zoom(Infinity)).to.be(Infinity);
});

it('converts scale to zoom and returns -Infinity if the scale passed in is smaller than minimum scale', function () {
var crs = new L.Proj.CRS('EPSG:3006', '', {
scales: [1, 2, 3]
});

expect(crs.zoom(0.9)).to.be(-Infinity);
expect(crs.zoom(-Infinity)).to.be(-Infinity);
});

it('tests that distance works (L.CRS.Earth.Distance)', function testDistance() {
var crs = new L.Proj.CRS('EPSG:3006', '+proj=utm +zone=33 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs', {
scales: [1, 2, 3]
Expand All @@ -181,4 +190,5 @@ describe('L.Proj.CRS', function() {
.to.be.within(111.194, 111.195);

});

});

0 comments on commit c2423cf

Please sign in to comment.