diff --git a/src/slic3r/GUI/Camera.cpp b/src/slic3r/GUI/Camera.cpp index 7a1023e62..dd6cbefe1 100644 --- a/src/slic3r/GUI/Camera.cpp +++ b/src/slic3r/GUI/Camera.cpp @@ -25,6 +25,7 @@ Camera::Camera() , phi(45.0f) // , distance(0.0f) , requires_zoom_to_bed(false) + , inverted_phi(false) , m_theta(45.0f) , m_target(Vec3d::Zero()) { diff --git a/src/slic3r/GUI/Camera.hpp b/src/slic3r/GUI/Camera.hpp index d19bc870e..b9c5dfc32 100644 --- a/src/slic3r/GUI/Camera.hpp +++ b/src/slic3r/GUI/Camera.hpp @@ -22,6 +22,7 @@ struct Camera float phi; // float distance; bool requires_zoom_to_bed; + bool inverted_phi; private: Vec3d m_target; diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index dfddc7f45..d02878a1a 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -2729,7 +2729,8 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) if ((m_hover_volume_id == -1) && m_mouse.is_start_position_3D_defined()) { const Vec3d& orig = m_mouse.drag.start_position_3D; - m_camera.phi += (((float)pos(0) - (float)orig(0)) * TRACKBALLSIZE); + float sign = m_camera.inverted_phi ? -1.0f : 1.0f; + m_camera.phi += sign * ((float)pos(0) - (float)orig(0)) * TRACKBALLSIZE; m_camera.set_theta(m_camera.get_theta() - ((float)pos(1) - (float)orig(1)) * TRACKBALLSIZE, wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() != ptSLA); m_dirty = true; } @@ -2781,6 +2782,9 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) post_event(SimpleEvent(EVT_GLCANVAS_OBJECT_SELECT)); } } + else if (evt.LeftUp() && m_mouse.dragging) + // Flips X mouse deltas if bed is upside down + m_camera.inverted_phi = (m_camera.get_dir_up()(2) < 0.0); else if (evt.RightUp()) { m_mouse.position = pos.cast();