fix: 修复resetView视角和离开地球隐藏tooltip

This commit is contained in:
rayd1o
2026-03-19 12:13:55 +08:00
parent c2eba54da0
commit 777891f865
2 changed files with 11 additions and 3 deletions

View File

@@ -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') {