From 9df646c91c244b3b0a25c9070e957da0bf054bca Mon Sep 17 00:00:00 2001 From: fukunee Date: Sat, 19 Sep 2026 17:07:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=AD=E9=94=AE=E5=9B=9E=E6=AD=A3=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E5=A4=A9=E5=BA=95+=E5=8C=97=E6=9C=9D=E4=B8=8A?= =?UTF-8?q?=EF=BC=88=E4=B8=8D=E6=81=A2=E5=A4=8D=E5=8E=9F=E8=A7=86=E8=A7=92?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/scene/CesiumGlobe.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/scene/CesiumGlobe.js b/src/scene/CesiumGlobe.js index f437405..1970982 100644 --- a/src/scene/CesiumGlobe.js +++ b/src/scene/CesiumGlobe.js @@ -400,7 +400,7 @@ export class CesiumGlobe { viewer.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK); } - // 右键原生 tilt:按下记录相机状态;松开不回正。中键:回正(flyTo 动画飞回按下前状态) + // 右键原生 tilt:按下记录位置;松开不回正。中键:回正到“不倾斜不旋转”(天底 + 北朝上) _setupRightRestore() { const scene = this.viewer.scene; const camera = this.viewer.camera; @@ -409,11 +409,7 @@ export class CesiumGlobe { handler.setInputAction(() => { camera.cancelFlight(); // 取消可能仍在进行的回正动画 - this._rightHome = { - position: Cesium.Cartesian3.clone(camera.position), - direction: Cesium.Cartesian3.clone(camera.direction), - up: Cesium.Cartesian3.clone(camera.up), - }; + this._rightHome = Cesium.Cartesian3.clone(camera.position); }, Cesium.ScreenSpaceEventType.RIGHT_DOWN); handler.setInputAction(() => { @@ -423,13 +419,13 @@ export class CesiumGlobe { }, Cesium.ScreenSpaceEventType.RIGHT_UP); handler.setInputAction(() => { - // 中键:回正(动画飞回) + // 中键:回正(天底 + 北朝上,保持原注视点) if (!this._rightHome) return; - const s = this._rightHome; + const pos = this._rightHome; this._rightHome = null; camera.flyTo({ - destination: s.position, - orientation: { direction: s.direction, up: s.up }, + destination: pos, + orientation: { heading: 0, pitch: Cesium.Math.toRadians(-90), roll: 0 }, duration: 0.5, }); }, Cesium.ScreenSpaceEventType.MIDDLE_DOWN);