refactor: 统一启动脚本到planet.sh,修复resetView调用
- 新增planet.sh统一管理start/stop/restart/health/log命令 - docker-compose.yml只保留postgres和redis - controls.js点击事件调用resetView函数
This commit is contained in:
22
frontend/public/earth/js/controls.js
vendored
22
frontend/public/earth/js/controls.js
vendored
@@ -185,27 +185,7 @@ function setupRotateControls(camera, earth) {
|
||||
});
|
||||
|
||||
document.getElementById('reset-view').addEventListener('click', function() {
|
||||
if (!earthObj) return;
|
||||
|
||||
const startRotX = earthObj.rotation.x;
|
||||
const startRotY = earthObj.rotation.y;
|
||||
const startZoom = zoomLevel;
|
||||
const targetRotX = 23.5 * Math.PI / 180;
|
||||
const targetRotY = 0;
|
||||
const targetZoom = 1.0;
|
||||
|
||||
animateValue(0, 1, 800, (progress) => {
|
||||
const ease = 1 - Math.pow(1 - progress, 3);
|
||||
earthObj.rotation.x = startRotX + (targetRotX - startRotX) * ease;
|
||||
earthObj.rotation.y = startRotY + (targetRotY - startRotY) * ease;
|
||||
|
||||
zoomLevel = startZoom + (targetZoom - startZoom) * ease;
|
||||
camera.position.z = CONFIG.defaultCameraZ / zoomLevel;
|
||||
updateZoomDisplay(zoomLevel, camera.position.z.toFixed(0));
|
||||
}, () => {
|
||||
zoomLevel = 1.0;
|
||||
showStatusMessage('视图已重置', 'info');
|
||||
});
|
||||
resetView(camera);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user