fix(earth): prevent cable hover/click interaction when cables are hidden

This commit is contained in:
rayd1o
2026-03-21 04:41:20 +08:00
parent d9a64f7768
commit af29e90cb0

View File

@@ -13,7 +13,7 @@ import {
hideTooltip
} from './ui.js';
import { createEarth, createClouds, createTerrain, createStars, createGridLines, toggleTerrain, getEarth } from './earth.js';
import { loadGeoJSONFromPath, loadLandingPoints, handleCableClick, clearCableSelection, getCableLines, getCablesById, lockedCable as cableLocked, getCableState, setCableState, clearAllCableStates, applyLandingPointVisualState, resetLandingPointVisualState, getAllLandingPoints } from './cables.js';
import { loadGeoJSONFromPath, loadLandingPoints, handleCableClick, clearCableSelection, getCableLines, getCablesById, lockedCable as cableLocked, getCableState, setCableState, clearAllCableStates, applyLandingPointVisualState, resetLandingPointVisualState, getAllLandingPoints, getShowCables } from './cables.js';
import { createSatellites, loadSatellites, updateSatellitePositions, toggleSatellites, toggleTrails, getShowSatellites, selectSatellite, getSatelliteData, getSatellitePoints, setSatelliteRingState, updateLockedRingPosition, updateHoverRingPosition, getSatellitePositions } from './satellites.js';
import { setupControls, getAutoRotate, getShowTerrain, zoomLevel, setAutoRotate, toggleAutoRotate, resetView } from './controls.js';
import { initInfoCard, showInfoCard, hideInfoCard, getCurrentType, setInfoCardNoBorder } from './info-card.js';
@@ -306,7 +306,7 @@ function onMouseMove(event, camera) {
hoveredSatelliteIndex = null;
}
if (hasHoveredCable) {
if (hasHoveredCable && getShowCables()) {
const cable = intersects[0].object;
if (!isSameCable(cable, lockedObject)) {
hoveredCable = cable;
@@ -402,7 +402,7 @@ function onClick(event, camera, renderer) {
const intersects = raycaster.intersectObjects(frontCables);
const satIntersects = getShowSatellites() ? raycaster.intersectObject(getSatellitePoints()) : [];
if (intersects.length > 0) {
if (intersects.length > 0 && getShowCables()) {
clearLockedObject();
const clickedCable = intersects[0].object;