fix: polish earth legend and info panel interactions

This commit is contained in:
linkong
2026-03-27 16:01:12 +08:00
parent b448a1e560
commit 62f2d9f403
14 changed files with 466 additions and 30 deletions

View File

@@ -11,6 +11,7 @@ import {
getSatelliteCount,
} from "./satellites.js";
import { toggleCables, getShowCables } from "./cables.js";
import { toggleBGP, getShowBGP, getBGPCount } from "./bgp.js";
export let autoRotate = true;
export let zoomLevel = 1.0;
@@ -293,6 +294,7 @@ function setupTerrainControls() {
const infoTrigger = document.getElementById("info-trigger");
const terrainBtn = document.getElementById("toggle-terrain");
const satellitesBtn = document.getElementById("toggle-satellites");
const bgpBtn = document.getElementById("toggle-bgp");
const trailsBtn = document.getElementById("toggle-trails");
const cablesBtn = document.getElementById("toggle-cables");
const layoutBtn = document.getElementById("layout-toggle");
@@ -337,6 +339,22 @@ function setupTerrainControls() {
showStatusMessage(showSats ? "卫星已显示" : "卫星已隐藏", "info");
});
bindListener(bgpBtn, "click", function () {
const showNextBGP = !getShowBGP();
if (!showNextBGP) {
clearLockedObject();
}
toggleBGP(showNextBGP);
this.classList.toggle("active", showNextBGP);
const tooltip = this.querySelector(".tooltip");
if (tooltip) tooltip.textContent = showNextBGP ? "隐藏BGP观测" : "显示BGP观测";
const bgpCountEl = document.getElementById("bgp-anomaly-count");
if (bgpCountEl) {
bgpCountEl.textContent = `${getBGPCount()}`;
}
showStatusMessage(showNextBGP ? "BGP观测已显示" : "BGP观测已隐藏", "info");
});
bindListener(trailsBtn, "click", function () {
const isActive = this.classList.contains("active");
const nextShowTrails = !isActive;