From 777891f86528065367b016f43aa3ca43b9ea9b6e Mon Sep 17 00:00:00 2001 From: rayd1o Date: Thu, 19 Mar 2026 12:13:55 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DresetView=E8=A7=86?= =?UTF-8?q?=E8=A7=92=E5=92=8C=E7=A6=BB=E5=BC=80=E5=9C=B0=E7=90=83=E9=9A=90?= =?UTF-8?q?=E8=97=8Ftooltip?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/public/earth/js/controls.js | 12 +++++++++--- frontend/public/earth/js/main.js | 2 ++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/frontend/public/earth/js/controls.js b/frontend/public/earth/js/controls.js index 027a4f0e..1ca92aef 100644 --- a/frontend/public/earth/js/controls.js +++ b/frontend/public/earth/js/controls.js @@ -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') { diff --git a/frontend/public/earth/js/main.js b/frontend/public/earth/js/main.js index 1d56a858..06f49862 100644 --- a/frontend/public/earth/js/main.js +++ b/frontend/public/earth/js/main.js @@ -301,6 +301,8 @@ function onMouseMove(event, camera) { showTooltip(event.clientX + 10, event.clientY + 10, `纬度: ${coords.lat}°
经度: ${coords.lon}°
海拔: ${coords.alt.toFixed(1)} km`); } + } else { + hideTooltip(); } if (isDragging) {