Small bugfixes for NP theme

This commit is contained in:
Pieter Vander Vennet 2021-09-09 23:24:21 +02:00
parent 550a2030ad
commit abbd617ca2
2 changed files with 7 additions and 3 deletions

View file

@ -124,14 +124,18 @@ export default class GeoJsonSource implements FeatureSource {
}
// Yup, this is cheating to just get the bounds here
const bounds = State.state.leafletMap.data.getBounds()
const bounds = State.state.leafletMap.data?.getBounds()
if(bounds === undefined){
// We'll retry later
return undefined
}
const tileRange = Utils.TileRangeBetween(zoomLevel, bounds.getNorth(), bounds.getEast(), bounds.getSouth(), bounds.getWest())
const needed = Utils.MapRange(tileRange, (x, y) => {
return url.replace("{x}", "" + x).replace("{y}", "" + y);
})
return new Set<string>(needed);
}
, [flayer.isDisplayed]);
, [flayer.isDisplayed, State.state.leafletMap]);
neededTiles.stabilized(250).addCallback((needed: Set<string>) => {
if (needed === undefined) {
return;