Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/confscreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,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);
Expand Down Expand Up @@ -370,6 +374,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",
Expand Down
5 changes: 3 additions & 2 deletions src/mouse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,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

@ruevs ruevs Jan 29, 2023

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And also I think this fixes the CTRL-middle drag "hack" of turntable navigation.
#888 (comment)
#1307 (comment)

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);
Expand Down
4 changes: 4 additions & 0 deletions src/solvespace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,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
Expand Down Expand Up @@ -260,6 +262,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
Expand Down
1 change: 1 addition & 0 deletions src/solvespace.h
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,7 @@ class SolveSpaceUI {
bool drawBackFaces;
bool showContourAreas;
bool checkClosedContour;
bool cameraNav;
bool turntableNav;
bool immediatelyEditDimension;
bool automaticLineConstraints;
Expand Down
1 change: 1 addition & 0 deletions src/ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ class TextWindow {
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);
Expand Down