fix(earth): clear lock state when hiding satellites or cables

This commit is contained in:
rayd1o
2026-03-21 04:50:05 +08:00
parent af29e90cb0
commit eabdbdc85a
2 changed files with 8 additions and 2 deletions

View File

@@ -3,7 +3,7 @@
import { CONFIG, EARTH_CONFIG } from './constants.js';
import { updateZoomDisplay, showStatusMessage } from './ui.js';
import { toggleTerrain } from './earth.js';
import { reloadData } from './main.js';
import { reloadData, clearLockedObject } from './main.js';
import { toggleSatellites, toggleTrails, getShowSatellites, getSatelliteCount } from './satellites.js';
import { toggleCables, getShowCables } from './cables.js';
@@ -228,6 +228,9 @@ function setupTerrainControls() {
document.getElementById('toggle-satellites').addEventListener('click', function() {
const showSats = !getShowSatellites();
if (!showSats) {
clearLockedObject();
}
toggleSatellites(showSats);
this.classList.toggle('active', showSats);
this.querySelector('.tooltip').textContent = showSats ? '隐藏卫星' : '显示卫星';
@@ -246,6 +249,9 @@ function setupTerrainControls() {
document.getElementById('toggle-cables').addEventListener('click', function() {
const showCables = !getShowCables();
if (!showCables) {
clearLockedObject();
}
toggleCables(showCables);
this.classList.toggle('active', showCables);
this.querySelector('.tooltip').textContent = showCables ? '隐藏线缆' : '显示线缆';