fix: 修复resetView视角和离开地球隐藏tooltip
This commit is contained in:
12
frontend/public/earth/js/controls.js
vendored
12
frontend/public/earth/js/controls.js
vendored
@@ -153,11 +153,17 @@ function animateValue(start, end, duration, onUpdate, onComplete) {
|
||||
export function resetView(camera) {
|
||||
if (!earthObj) return;
|
||||
|
||||
const chinaLat = 40;
|
||||
const chinaLon = -154;
|
||||
|
||||
const baseTilt = 23.5 * Math.PI / 180;
|
||||
const latRot = chinaLat * Math.PI / 180;
|
||||
const targetRotX = baseTilt + latRot * 0.5;
|
||||
const targetRotY = -(chinaLon * Math.PI / 180);
|
||||
|
||||
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) => {
|
||||
@@ -170,7 +176,7 @@ export function resetView(camera) {
|
||||
updateZoomDisplay(zoomLevel, camera.position.z.toFixed(0));
|
||||
}, () => {
|
||||
zoomLevel = 1.0;
|
||||
showStatusMessage('视图已重置', 'info');
|
||||
showStatusMessage('视角已重置到中国', 'info');
|
||||
});
|
||||
|
||||
if (typeof window.clearLockedCable === 'function') {
|
||||
|
||||
Reference in New Issue
Block a user