From 3ceec3441f5ea3ab192b67e8534086767bb36ac3 Mon Sep 17 00:00:00 2001 From: paireks Date: Fri, 25 Oct 2024 23:10:23 +0200 Subject: [PATCH] Change to rotate around last clicked position --- .../scene/CameraControl/lib/handlers/MousePickHandler.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/viewer/scene/CameraControl/lib/handlers/MousePickHandler.js b/src/viewer/scene/CameraControl/lib/handlers/MousePickHandler.js index e3fc594978..b45f9a6d71 100644 --- a/src/viewer/scene/CameraControl/lib/handlers/MousePickHandler.js +++ b/src/viewer/scene/CameraControl/lib/handlers/MousePickHandler.js @@ -16,6 +16,7 @@ class MousePickHandler { this._clicks = 0; this._timeout = null; this._lastPickedEntityId = null; + this._lastClickedWorldPos = null; let leftDown = false; let rightDown = false; @@ -165,11 +166,16 @@ class MousePickHandler { if (pickResult && pickResult.worldPos) { pivotController.setPivotPos(pickResult.worldPos); pivotController.startPivot(); + this._lastClickedWorldPos = pickResult.worldPos; } else { if (configs.smartPivot) { pivotController.setCanvasPivotPos(states.pointerCanvasPos); } else { - pivotController.setPivotPos(scene.camera.look); + if (this._lastClickedWorldPos) { + pivotController.setPivotPos(this._lastClickedWorldPos); + } else { + pivotController.setPivotPos(scene.camera.look); + } } pivotController.startPivot(); }