diff --git a/assets/js/map.ts b/assets/js/map.ts index ce8569a..54f4e78 100644 --- a/assets/js/map.ts +++ b/assets/js/map.ts @@ -404,16 +404,6 @@ let MapAPRSMap = { } catch (error) { console.error("Error invalidating map size:", error); } - - // Track when map is ready - self.map!.whenReady(() => { - try { - self.lastZoom = self.map!.getZoom(); - self.sendMapReadyEvents(); - } catch (error) { - console.error("Error in map ready callback:", error); - } - }); // Helper function to send map ready events with retry self.sendMapReadyEvents = (retryCount = 0) => { @@ -437,6 +427,16 @@ let MapAPRSMap = { } }; + // Track when map is ready + self.map!.whenReady(() => { + try { + self.lastZoom = self.map!.getZoom(); + self.sendMapReadyEvents(); + } catch (error) { + console.error("Error in map ready callback:", error); + } + }); + // Start periodic cleanup of old trail positions (every 5 minutes) self.cleanupInterval = setInterval( () => {