[fix](trx-frontend-http): fix map not loading on direct /map navigation
navigateToTab now calls loadPluginsForTab to ensure map-core.js is injected on initial page load from /map URL. map-core.js auto-inits the map if the map tab is already visible when the module loads. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
@@ -4373,6 +4373,7 @@ function navigateToTab(name, options = {}) {
|
|||||||
updateTabHistory(name, replaceHistory);
|
updateTabHistory(name, replaceHistory);
|
||||||
}
|
}
|
||||||
scheduleSpectrumLayout();
|
scheduleSpectrumLayout();
|
||||||
|
if (typeof window.loadPluginsForTab === "function") window.loadPluginsForTab(name);
|
||||||
if (name === "map") {
|
if (name === "map") {
|
||||||
window.trx.map?.initAprsMap();
|
window.trx.map?.initAprsMap();
|
||||||
window.trx.map?.sizeAprsMapToViewport();
|
window.trx.map?.sizeAprsMapToViewport();
|
||||||
|
|||||||
@@ -3424,6 +3424,16 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Auto-init map if the map tab is already visible (e.g. direct /map navigation)
|
||||||
|
function autoInitIfVisible() {
|
||||||
|
const panel = document.getElementById("tab-map");
|
||||||
|
if (panel && panel.style.display !== "none") {
|
||||||
|
initAprsMap();
|
||||||
|
sizeAprsMapToViewport();
|
||||||
|
if (aprsMap) setTimeout(() => aprsMap.invalidateSize(), 50);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Register module API for core to call
|
// Register module API for core to call
|
||||||
window.trx.map = {
|
window.trx.map = {
|
||||||
initAprsMap,
|
initAprsMap,
|
||||||
@@ -3472,4 +3482,7 @@
|
|||||||
flushDeferredDecodeMapSync,
|
flushDeferredDecodeMapSync,
|
||||||
bandForHz,
|
bandForHz,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// If the map tab is already visible (direct /map URL), init immediately.
|
||||||
|
autoInitIfVisible();
|
||||||
})();
|
})();
|
||||||
|
|||||||
Reference in New Issue
Block a user