feat: 自动旋转按钮改为播放/暂停图标状态
This commit is contained in:
19
frontend/public/earth/js/controls.js
vendored
19
frontend/public/earth/js/controls.js
vendored
@@ -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);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user