From 872f7dc109fbd5b6d2f3aa156b22f82cc4dedf2b Mon Sep 17 00:00:00 2001 From: portree_kid Date: Sun, 19 Jan 2020 19:25:26 +0100 Subject: [PATCH] Load all Airports within 5km in high zooms --- src/renderer/components/FlightgearMap.vue | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/renderer/components/FlightgearMap.vue b/src/renderer/components/FlightgearMap.vue index 23a3a26..b3cb14e 100644 --- a/src/renderer/components/FlightgearMap.vue +++ b/src/renderer/components/FlightgearMap.vue @@ -86,6 +86,14 @@ if (!bounds.hasOwnProperty('getNorthEast')) { 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 ret = bounds.getNorthEast().lat > Number(coordinates[1]) && bounds.getNorthEast().lng > Number(coordinates[0])