Add config option for "camera" rotation navigation

SS rotates the model when middle button dragging while some users expect
this operation to rotate the camera where left-right and up-down directions are
reversed instead.  This adds that option.
pull/1344/head
robnee 2021-03-07 11:46:07 -05:00 committed by Paul Kahler
parent 302aebfd1a
commit 3c91bf7ca4
5 changed files with 15 additions and 2 deletions

View File

@ -92,6 +92,10 @@ void TextWindow::ScreenChangeTurntableNav(int link, uint32_t v) {
}
}
void TextWindow::ScreenChangeCameraNav(int link, uint32_t v) {
SS.cameraNav = !SS.cameraNav;
}
void TextWindow::ScreenChangeImmediatelyEditDimension(int link, uint32_t v) {
SS.immediatelyEditDimension = !SS.immediatelyEditDimension;
SS.GW.Invalidate(/*clearPersistent=*/true);
@ -333,6 +337,8 @@ void TextWindow::ShowConfiguration() {
Printf(false, " %Fd%f%Ll%s enable automatic line constraints%E",
&ScreenChangeAutomaticLineConstraints,
SS.automaticLineConstraints ? CHECK_TRUE : CHECK_FALSE);
Printf(false, " %Fd%f%Ll%s use camera mouse navigation%E", &ScreenChangeCameraNav,
SS.cameraNav ? CHECK_TRUE : CHECK_FALSE);
Printf(false, " %Fd%f%Ll%s use turntable mouse navigation%E", &ScreenChangeTurntableNav,
SS.turntableNav ? CHECK_TRUE : CHECK_FALSE);
Printf(false, " %Fd%f%Ll%s edit newly added dimensions%E",

View File

@ -139,7 +139,8 @@ void GraphicsWindow::MouseMoved(double x, double y, bool leftDown,
double dy = (y - orig.mouse.y) / scale;
if(!(shiftDown || ctrlDown)) {
double s = 0.3*(PI/180)*scale; // degrees per pixel
double sign = SS.cameraNav ? -1.0 : 1.0;
double s = 0.3*(PI/180)*scale*sign; // degrees per pixel
if(SS.turntableNav) { // lock the Z to vertical
projRight = orig.projRight.RotatedAbout(Vector::From(0, 0, 1), -s * dx);
projUp = orig.projUp.RotatedAbout(

View File

@ -75,6 +75,8 @@ void SolveSpaceUI::Init() {
exportBackgroundColor = settings->ThawBool("ExportBackgroundColor", false);
// Draw back faces of triangles (when mesh is leaky/self-intersecting)
drawBackFaces = settings->ThawBool("DrawBackFaces", true);
// Use camera mouse navigation
cameraNav = settings->ThawBool("CameraNav", false);
// Use turntable mouse navigation
turntableNav = settings->ThawBool("TurntableNav", false);
// Immediately edit dimension
@ -258,6 +260,8 @@ void SolveSpaceUI::Exit() {
settings->FreezeBool("ShowContourAreas", showContourAreas);
// Check that contours are closed and not self-intersecting
settings->FreezeBool("CheckClosedContour", checkClosedContour);
// Use camera mouse navigation
settings->FreezeBool("CameraNav", cameraNav);
// Use turntable mouse navigation
settings->FreezeBool("TurntableNav", turntableNav);
// Immediately edit dimensions

View File

@ -578,6 +578,7 @@ public:
bool drawBackFaces;
bool showContourAreas;
bool checkClosedContour;
bool cameraNav;
bool turntableNav;
bool immediatelyEditDimension;
bool automaticLineConstraints;

View File

@ -447,6 +447,7 @@ public:
static void ScreenChangeBackFaces(int link, uint32_t v);
static void ScreenChangeShowContourAreas(int link, uint32_t v);
static void ScreenChangeCheckClosedContour(int link, uint32_t v);
static void ScreenChangeCameraNav(int link, uint32_t v);
static void ScreenChangeTurntableNav(int link, uint32_t v);
static void ScreenChangeImmediatelyEditDimension(int link, uint32_t v);
static void ScreenChangeAutomaticLineConstraints(int link, uint32_t v);