diff --git a/frontend/public/earth/js/controls.js b/frontend/public/earth/js/controls.js index 5cc62806..027a4f0e 100644 --- a/frontend/public/earth/js/controls.js +++ b/frontend/public/earth/js/controls.js @@ -179,11 +179,26 @@ export function resetView(camera) { } function setupRotateControls(camera, earth) { - document.getElementById('rotate-toggle').addEventListener('click', function() { + 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(); - showStatusMessage(autoRotate ? '自动旋转已开启' : '自动旋转已暂停', 'info'); + const isRotating = getAutoRotate(); + updateRotateIcon(); + showStatusMessage(isRotating ? '自动旋转已开启' : '自动旋转已暂停', 'info'); }); + updateRotateIcon(); + document.getElementById('reset-view').addEventListener('click', function() { resetView(camera); });