diff options
author | enricoturri1966 <enricoturri@seznam.cz> | 2021-10-21 12:27:36 +0300 |
---|---|---|
committer | enricoturri1966 <enricoturri@seznam.cz> | 2022-06-02 14:09:43 +0300 |
commit | 90744071962a091caef19e12aadd48f5d212c66d (patch) | |
tree | 7d999c6f7b021c9808c59b498ed3efed3d327da5 /src/slic3r | |
parent | 1191ab42cb1e0a2046237f892b6d404415256dfd (diff) |
Follow-up of 86b44b48005e3ddb96e851e19f8e2ccd1a38b667 - Constrained uniform scaling in world coordinates for rotated instances
Diffstat (limited to 'src/slic3r')
-rw-r--r-- | src/slic3r/GUI/Gizmos/GLGizmoScale.cpp | 7 | ||||
-rw-r--r-- | src/slic3r/GUI/Gizmos/GLGizmoScale.hpp | 3 |
2 files changed, 4 insertions, 6 deletions
diff --git a/src/slic3r/GUI/Gizmos/GLGizmoScale.cpp b/src/slic3r/GUI/Gizmos/GLGizmoScale.cpp index fac348cdd..6cadae77d 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoScale.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoScale.cpp @@ -159,10 +159,6 @@ void GLGizmoScale3D::on_start_dragging() m_starting.pivots[3] = trafo * Vec3d(center.x(), m_starting.box.min.y(), center.z()); m_starting.pivots[4] = trafo * Vec3d(center.x(), center.y(), m_starting.box.max.z()); m_starting.pivots[5] = trafo * Vec3d(center.x(), center.y(), m_starting.box.min.z()); - m_starting.pivots[6] = trafo * Vec3d(m_starting.box.max.x(), m_starting.box.max.y(), center.z()); - m_starting.pivots[7] = trafo * Vec3d(m_starting.box.min.x(), m_starting.box.max.y(), center.z()); - m_starting.pivots[8] = trafo * Vec3d(m_starting.box.min.x(), m_starting.box.min.y(), center.z()); - m_starting.pivots[9] = trafo * Vec3d(m_starting.box.max.x(), m_starting.box.min.y(), center.z()); } #else m_starting.drag_position = m_grabbers[m_hover_id].center; @@ -687,10 +683,13 @@ void GLGizmoScale3D::do_scale_uniform(const UpdateData& data) #if ENABLE_WORLD_COORDINATE if (m_starting.ctrl_down) { m_offset = 0.5 * (ratio - 1.0) * m_starting.box.size(); + if (m_hover_id == 6 || m_hover_id == 9) m_offset.x() *= -1.0; if (m_hover_id == 6 || m_hover_id == 7) m_offset.y() *= -1.0; + + m_offset += (ratio - 1.0) * (m_starting.center - m_starting.box.center()); } else { #endif // ENABLE_WORLD_COORDINATE diff --git a/src/slic3r/GUI/Gizmos/GLGizmoScale.hpp b/src/slic3r/GUI/Gizmos/GLGizmoScale.hpp index 1429cf633..0792fcc7a 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoScale.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoScale.hpp @@ -25,8 +25,7 @@ class GLGizmoScale3D : public GLGizmoBase Vec3d center{ Vec3d::Zero() }; #endif // ENABLE_WORLD_COORDINATE BoundingBoxf3 box; - std::array<Vec3d, 10> pivots{ Vec3d::Zero(), Vec3d::Zero(), Vec3d::Zero(), Vec3d::Zero(), Vec3d::Zero(), - Vec3d::Zero(), Vec3d::Zero(), Vec3d::Zero(), Vec3d::Zero(),Vec3d::Zero() }; + std::array<Vec3d, 6> pivots{ Vec3d::Zero(), Vec3d::Zero(), Vec3d::Zero(), Vec3d::Zero(), Vec3d::Zero(), Vec3d::Zero() }; }; BoundingBoxf3 m_box; |