mirror of
https://github.com/Leaflet/Leaflet.git
synced 2025-08-16 16:45:22 +00:00
TileLayer rounds fractional zoom in url to integer {z} (#8613)
Co-authored-by: Florian Bischof <design.falke@gmail.com>
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
import {expect} from 'chai';
|
||||
import {Browser, CRS, DomUtil, Map, TileLayer, Util} from 'leaflet';
|
||||
import {Browser, CRS, DomUtil, Map, TileLayer, Util, LatLng} from 'leaflet';
|
||||
import sinon from 'sinon';
|
||||
import {createContainer, removeMapContainer} from '../../SpecHelper.js';
|
||||
|
||||
@ -418,6 +418,26 @@ describe('TileLayer', () => {
|
||||
expect(layer.options.attribution).to.eql('');
|
||||
});
|
||||
|
||||
it('requests tiles with an integer {z} when the map\'s zoom level is fractional', () => {
|
||||
const layer = new TileLayer('http://example.com/{z}/{y}/{x}.png').addTo(map);
|
||||
map.options.zoomSnap = 0;
|
||||
map._resetView(new LatLng(0, 0), 2.3);
|
||||
|
||||
layer.redraw();
|
||||
|
||||
const urls = [
|
||||
'http://example.com/2/1/1.png',
|
||||
'http://example.com/2/1/2.png',
|
||||
'http://example.com/2/2/1.png',
|
||||
'http://example.com/2/2/2.png',
|
||||
];
|
||||
|
||||
let i = 0;
|
||||
eachImg(layer, (img) => {
|
||||
expect(img.src).to.eql(urls[i]);
|
||||
i++;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
const _describe = 'crossOrigin' in DomUtil.create('img') ? describe : describe.skip; // skip in IE<11
|
||||
|
Reference in New Issue
Block a user