Skip to content

Commit

Permalink
Merge pull request #1713 from paireks/develop/PivotBehaviourForBackgr…
Browse files Browse the repository at this point in the history
…oundPicking

[FEATURE] Rotate around previous pivot when clicking on background
  • Loading branch information
xeolabs authored Oct 25, 2024
2 parents e63b064 + 3ceec34 commit 38cd043
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class MousePickHandler {
this._clicks = 0;
this._timeout = null;
this._lastPickedEntityId = null;
this._lastClickedWorldPos = null;

let leftDown = false;
let rightDown = false;
Expand Down Expand Up @@ -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();
}
Expand Down

0 comments on commit 38cd043

Please sign in to comment.