Skip to content

Commit

Permalink
Gui: Correct spin sensitivity
Browse files Browse the repository at this point in the history
  • Loading branch information
Rexbas authored and chennes committed Oct 28, 2024
1 parent 742de86 commit 1cf5b23
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Gui/NavigationStyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,8 @@ void NavigationStyle::spin(const SbVec2f & pointerpos)
lastpos[0] = float(this->log.position[1][0]) / float(std::max((int)(glsize[0]-1), 1));
lastpos[1] = float(this->log.position[1][1]) / float(std::max((int)(glsize[1]-1), 1));

float sensitivity = getSensitivity();

// Adjust the spin projector sphere to the screen position of the rotation center
if (rotationCenterFound) {
const auto pointOnScreen = viewer->getPointOnViewport(rotationCenter);
Expand All @@ -874,7 +876,9 @@ void NavigationStyle::spin(const SbVec2f & pointerpos)
float x, y;
sphereCenter.getValue(x, y);

const float radius = FCSphereSheetProjector::defaultSphereRadius * (1 + sphereCenter.length());
const float sphereScale = 1 + sphereCenter.length();
const float radius = FCSphereSheetProjector::defaultSphereRadius * sphereScale;
sensitivity *= sphereScale;

spinprojector->setSphere(SbSphere {SbVec3f {x, y, 0}, radius});
}
Expand All @@ -899,7 +903,6 @@ void NavigationStyle::spin(const SbVec2f & pointerpos)
this->spinprojector->project(lastpos);
SbRotation r;
this->spinprojector->projectAndGetRotation(pointerpos, r);
float sensitivity = getSensitivity();
if (sensitivity > 1.0f) {
SbVec3f axis;
float radians{};
Expand Down

0 comments on commit 1cf5b23

Please sign in to comment.