Change padding method, add max bounds, fix zoomlevels on toerisme vlaanderen theme

This commit is contained in:
Pieter Vander Vennet 2021-10-11 21:23:14 +02:00
parent 7576f7069b
commit c010fb5271
5 changed files with 53 additions and 31 deletions

View file

@ -116,16 +116,15 @@ export class BBox {
return this.minLat
}
pad(factor: number): BBox {
const latDiff = this.maxLat - this.minLat
const lat = (this.maxLat + this.minLat) / 2
const lonDiff = this.maxLon - this.minLon
const lon = (this.maxLon + this.minLon) / 2
pad(factor: number, maxIncrease = 2): BBox {
const latDiff = Math.min(maxIncrease / 2, Math.abs(this.maxLat - this.minLat) * factor)
const lonDiff =Math.min(maxIncrease / 2, Math.abs(this.maxLon - this.minLon) * factor)
return new BBox([[
lon - lonDiff * factor,
lat - latDiff * factor
], [lon + lonDiff * factor,
lat + latDiff * factor]])
this.minLon - lonDiff,
this.minLat - latDiff
], [this.maxLon + lonDiff,
this.maxLat + latDiff]])
}
toLeaflet() {