diff options
author | bubnikv <bubnikv@gmail.com> | 2020-02-28 16:59:59 +0300 |
---|---|---|
committer | bubnikv <bubnikv@gmail.com> | 2020-02-28 16:59:59 +0300 |
commit | 0a0219961b8b96fadbcf780b8756347573ff2c9f (patch) | |
tree | 1cbbb18c71b9116d6e51dcb3a4bccf380b82971e /src/slic3r/GUI/GLCanvas3D.cpp | |
parent | b6068b6278441f084ccacb37e047f9cd9844cc2a (diff) |
Free rotating camera reworked to rotate around the free rotation
axis in a single step.
Diffstat (limited to 'src/slic3r/GUI/GLCanvas3D.cpp')
-rw-r--r-- | src/slic3r/GUI/GLCanvas3D.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 1ccebbabb..a6eee73e8 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -3464,13 +3464,12 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) // if dragging over blank area with left button, rotate if (m_hover_volume_idxs.empty() && m_mouse.is_start_position_3D_defined()) { - const Vec3d& orig = m_mouse.drag.start_position_3D; - double x = Geometry::deg2rad(pos(0) - orig(0)) * (double)TRACKBALLSIZE; - double y = Geometry::deg2rad(pos(1) - orig(1)) * (double)TRACKBALLSIZE; + const Vec3d rot = (Vec3d(pos.x(), pos.y(), 0.) - m_mouse.drag.start_position_3D) * (PI * TRACKBALLSIZE / 180.); if (wxGetApp().plater()->get_mouse3d_controller().is_running() || (wxGetApp().app_config->get("use_free_camera") == "1")) - m_camera.rotate_local_around_target(Vec3d(y, x, 0.0)); + // Virtual track ball (similar to the 3DConnexion mouse). + m_camera.rotate_local_around_target(Vec3d(rot.y(), rot.x(), 0.)); else - m_camera.rotate_on_sphere(x, y, wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() != ptSLA); + m_camera.rotate_on_sphere(rot.x(), rot.y(), wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() != ptSLA); m_dirty = true; } |