diff --git a/src/confscreen.cpp b/src/confscreen.cpp index 1e2e82a6..2e7b2288 100644 --- a/src/confscreen.cpp +++ b/src/confscreen.cpp @@ -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", diff --git a/src/mouse.cpp b/src/mouse.cpp index 1ee3d33c..1c73dd29 100644 --- a/src/mouse.cpp +++ b/src/mouse.cpp @@ -139,8 +139,9 @@ 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 - if(SS.turntableNav) { // lock the Z to vertical + 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( Vector::From(orig.projRight.x, orig.projRight.y, orig.projRight.y), s * dy); diff --git a/src/solvespace.cpp b/src/solvespace.cpp index 68aaf5a4..5e9b9630 100644 --- a/src/solvespace.cpp +++ b/src/solvespace.cpp @@ -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 diff --git a/src/solvespace.h b/src/solvespace.h index 2568a70b..d8d7b3d3 100644 --- a/src/solvespace.h +++ b/src/solvespace.h @@ -578,6 +578,7 @@ public: bool drawBackFaces; bool showContourAreas; bool checkClosedContour; + bool cameraNav; bool turntableNav; bool immediatelyEditDimension; bool automaticLineConstraints; diff --git a/src/ui.h b/src/ui.h index 5b2b1886..0895007a 100644 --- a/src/ui.h +++ b/src/ui.h @@ -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);