Load all Airports within 5km in high zooms

This commit is contained in:
portree_kid 2020-01-19 19:25:26 +01:00
parent 38c7486c30
commit 872f7dc109

View File

@ -86,6 +86,14 @@
if (!bounds.hasOwnProperty('getNorthEast')) { if (!bounds.hasOwnProperty('getNorthEast')) {
bounds = this.$refs.map.mapObject.getBounds() bounds = this.$refs.map.mapObject.getBounds()
} }
let width = bounds.getNorthWest().distanceTo(bounds.getSouthEast())
// Load all airports in a minimum 5 km box
if (width < 5000) {
let rest = 5000 - width
let padFactor = rest / width
bounds = bounds.pad(padFactor)
}
let coordinates = feature.geometry.coordinates let coordinates = feature.geometry.coordinates
let ret = bounds.getNorthEast().lat > Number(coordinates[1]) && let ret = bounds.getNorthEast().lat > Number(coordinates[1]) &&
bounds.getNorthEast().lng > Number(coordinates[0]) bounds.getNorthEast().lng > Number(coordinates[0])