From af29e90cb06c3e5f8b5068b8c6b473009bd37fb1 Mon Sep 17 00:00:00 2001 From: rayd1o Date: Sat, 21 Mar 2026 04:41:20 +0800 Subject: [PATCH] fix(earth): prevent cable hover/click interaction when cables are hidden --- frontend/public/earth/js/main.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/public/earth/js/main.js b/frontend/public/earth/js/main.js index 109c9039..774fbb2a 100644 --- a/frontend/public/earth/js/main.js +++ b/frontend/public/earth/js/main.js @@ -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;