From de669ae18d136ebd5edec9ec7200b1509ebead1f Mon Sep 17 00:00:00 2001 From: Matthias Wirth Date: Fri, 19 Aug 2022 10:11:56 +0200 Subject: [PATCH] reduce scaling further when more than 500 aircraft are on the screen --- html/script.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/html/script.js b/html/script.js index 058c0f2..ee778de 100644 --- a/html/script.js +++ b/html/script.js @@ -148,6 +148,7 @@ let TrackedAircraft = 0; let globeTrackedAircraft = 0; let TrackedAircraftPositions = 0; let TrackedHistorySize = 0; +let aircraftShown = 0; let SitePosition = null; @@ -3776,6 +3777,7 @@ function refreshFeatures() { } } } + ctime && console.timeEnd("inView"); ctime && console.time("resortTable"); @@ -5100,10 +5102,14 @@ function changeZoom(init) { } function checkScale() { - if (zoomLvl > markerZoomDivide) + if (zoomLvl > markerZoomDivide) { iconSize = markerBig; - else + } else { iconSize = markerSmall; + if (aircraftShown > 700) { + iconSize *= 0.85; + } + } // scale markers according to global scaling iconSize *= Math.pow(1.3, globalScale) * globalScale * iconScale; @@ -5280,9 +5286,13 @@ function updateVisible() { if (mapIsVisible || !lastRenderExtent) { lastRenderExtent = getRenderExtent(); } + aircraftShown = 0; for (let i in g.planesOrdered) { - g.planesOrdered[i].updateVisible(); + const plane = g.planesOrdered[i]; + plane.updateVisible(); + aircraftShown += (plane.visible && plane.inView); } + checkScale(); } function mapRefresh(redraw) {