feat: 自动旋转按钮改为播放/暂停图标状态

This commit is contained in:
rayd1o
2026-03-19 09:49:37 +08:00
parent e21b783bef
commit f50830712c

View File

@@ -179,11 +179,26 @@ export function resetView(camera) {
} }
function setupRotateControls(camera, earth) { 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(); toggleAutoRotate();
showStatusMessage(autoRotate ? '自动旋转已开启' : '自动旋转已暂停', 'info'); const isRotating = getAutoRotate();
updateRotateIcon();
showStatusMessage(isRotating ? '自动旋转已开启' : '自动旋转已暂停', 'info');
}); });
updateRotateIcon();
document.getElementById('reset-view').addEventListener('click', function() { document.getElementById('reset-view').addEventListener('click', function() {
resetView(camera); resetView(camera);
}); });