Skip to content

Commit 6f44e51

Browse files
committed
Improve pilot animation behavior
1 parent a78e2ea commit 6f44e51

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

apps/web/components/Map/utils/dataLayers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,5 +107,5 @@ export function initDataLayers(): (WebGLVectorLayer | VectorLayer)[] {
107107

108108
export function setFeatures(extent: Extent, zoom: number): void {
109109
setAirportFeatures(extent, zoom);
110-
setPilotFeatures(extent);
110+
setPilotFeatures(extent, zoom);
111111
}

apps/web/components/Map/utils/pilotFeatures.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,11 @@ export function clearHighlightedPilot(): void {
134134
highlightedPilot = null;
135135
}
136136

137-
export function setPilotFeatures(extent: Extent): void {
137+
export function setPilotFeatures(extent: Extent, zoom: number): void {
138+
if (zoom > 10) {
139+
return;
140+
}
141+
138142
const [minX, minY, maxX, maxY] = transformExtent(extent, "EPSG:3857", "EPSG:4326");
139143
const pilotsByExtent = pilotRBush.search({ minX, minY, maxX, maxY });
140144
const pilotsByAltitude = pilotsByExtent.sort((a, b) => (b.feature.get("altitude_agl") || 0) - (a.feature.get("altitude_agl") || 0)).slice(0, 300);
@@ -188,7 +192,7 @@ export function animatePilotFeatures(map: OlMap) {
188192
const resolution = map.getView().getResolution() || 0;
189193
let interval = 1000;
190194
if (resolution > 1) {
191-
interval = Math.max(resolution * 10, 50);
195+
interval = Math.min(Math.max(resolution * 5, 40), 1000);
192196
}
193197

194198
const now = Date.now();

0 commit comments

Comments
 (0)