diff --git a/frontend/public/earth/js/controls.js b/frontend/public/earth/js/controls.js index cb36c094..45d9cdc0 100644 --- a/frontend/public/earth/js/controls.js +++ b/frontend/public/earth/js/controls.js @@ -194,24 +194,13 @@ export function resetView(camera) { function setupRotateControls(camera, earth) { const rotateBtn = document.getElementById('rotate-toggle'); - const tooltip = rotateBtn?.querySelector('.tooltip'); - - function updateRotateIcon() { - const isRotating = getAutoRotate(); - rotateBtn.innerHTML = isRotating ? '⏸️' : '▶️'; - if (tooltip) { - tooltip.textContent = isRotating ? '暂停旋转' : '开始旋转'; - } - } rotateBtn.addEventListener('click', function() { - toggleAutoRotate(); - const isRotating = getAutoRotate(); - updateRotateIcon(); + const isRotating = toggleAutoRotate(); showStatusMessage(isRotating ? '自动旋转已开启' : '自动旋转已暂停', 'info'); }); - updateRotateIcon(); + updateRotateUI(); document.getElementById('reset-view').addEventListener('click', function() { resetView(camera); @@ -260,55 +249,28 @@ function setupTerrainControls() { } } -function setupMouseControls(camera, renderer) { - let previousMousePosition = { x: 0, y: 0 }; - - renderer.domElement.addEventListener('mousedown', (e) => { - isDragging = true; - previousMousePosition = { x: e.clientX, y: e.clientY }; - }); - - renderer.domElement.addEventListener('mouseup', () => { - isDragging = false; - }); - - renderer.domElement.addEventListener('mousemove', (e) => { - if (isDragging) { - const deltaX = e.clientX - previousMousePosition.x; - const deltaY = e.clientY - previousMousePosition.y; - - if (earth) { - earth.rotation.y += deltaX * 0.005; - earth.rotation.x += deltaY * 0.005; - } - - previousMousePosition = { x: e.clientX, y: e.clientY }; - } - }); -} - export function getAutoRotate() { return autoRotate; } -export function setAutoRotate(value) { - autoRotate = value; +function updateRotateUI() { const btn = document.getElementById('rotate-toggle'); if (btn) { - btn.classList.toggle('active', value); + btn.classList.toggle('active', autoRotate); + btn.innerHTML = autoRotate ? '⏸️' : '▶️'; const tooltip = btn.querySelector('.tooltip'); - if (tooltip) tooltip.textContent = value ? '暂停旋转' : '自动旋转'; + if (tooltip) tooltip.textContent = autoRotate ? '暂停旋转' : '开始旋转'; } } +export function setAutoRotate(value) { + autoRotate = value; + updateRotateUI(); +} + export function toggleAutoRotate() { autoRotate = !autoRotate; - const btn = document.getElementById('rotate-toggle'); - if (btn) { - btn.classList.toggle('active', autoRotate); - const tooltip = btn.querySelector('.tooltip'); - if (tooltip) tooltip.textContent = autoRotate ? '暂停旋转' : '自动旋转'; - } + updateRotateUI(); if (window.clearLockedCable) { window.clearLockedCable(); } diff --git a/frontend/public/earth/js/satellites.js b/frontend/public/earth/js/satellites.js index df2c68cb..5156f6a3 100644 --- a/frontend/public/earth/js/satellites.js +++ b/frontend/public/earth/js/satellites.js @@ -312,10 +312,6 @@ export function selectSatellite(index) { return getSatelliteAt(index); } -export function getSelectedSatellite() { - return selectedSatellite; -} - export function getSatellitePoints() { return satellitePoints; } diff --git a/frontend/public/earth/js/ui.js b/frontend/public/earth/js/ui.js index 1e9c1b7c..67b82bb6 100644 --- a/frontend/public/earth/js/ui.js +++ b/frontend/public/earth/js/ui.js @@ -29,16 +29,6 @@ export function updateZoomDisplay(zoomLevel, distance) { document.getElementById('camera-distance').textContent = distance + ' km'; } -// Update cable details -export function updateCableDetails(cable) { - document.getElementById('cable-name').textContent = cable.name || 'Unknown'; - document.getElementById('cable-owner').textContent = cable.owner || '-'; - document.getElementById('cable-status').textContent = cable.status || '-'; - document.getElementById('cable-length').textContent = cable.length || '-'; - document.getElementById('cable-coords').textContent = cable.coords || '-'; - document.getElementById('cable-rfs').textContent = cable.rfs || '-'; -} - // Update earth stats export function updateEarthStats(stats) { document.getElementById('cable-count').textContent = stats.cableCount || 0;