From b0200c04ae03dddbec6cb22d9ce8fac6fffed19c Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Mon, 20 May 2019 15:59:54 +0200 Subject: [PATCH] Fixed debug technology ENABLE_RENDER_SELECTION_CENTER --- src/slic3r/GUI/GLCanvas3D.cpp | 3 +-- src/slic3r/GUI/Selection.cpp | 6 +++--- src/slic3r/GUI/Selection.hpp | 7 ++++++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 48dc2e46e..26d205055 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -4025,8 +4025,7 @@ void GLCanvas3D::_render_selection() const #if ENABLE_RENDER_SELECTION_CENTER void GLCanvas3D::_render_selection_center() const { - if (!m_gizmos.is_running()) - m_selection.render_center(); + m_selection.render_center(m_gizmos.is_dragging()); } #endif // ENABLE_RENDER_SELECTION_CENTER diff --git a/src/slic3r/GUI/Selection.cpp b/src/slic3r/GUI/Selection.cpp index 0b880c75f..00fbaa42a 100644 --- a/src/slic3r/GUI/Selection.cpp +++ b/src/slic3r/GUI/Selection.cpp @@ -955,14 +955,14 @@ void Selection::render(float scale_factor) const } #if ENABLE_RENDER_SELECTION_CENTER -void Selection::render_center() const +void Selection::render_center(bool gizmo_is_dragging) const { if (!m_valid || is_empty() || (m_quadric == nullptr)) return; - const Vec3d& center = get_bounding_box().center(); + Vec3d center = gizmo_is_dragging ? m_cache.dragging_center : get_bounding_box().center(); - glsafe(::glDisable(GL_DEPTH_TEST))); + glsafe(::glDisable(GL_DEPTH_TEST)); glsafe(::glEnable(GL_LIGHTING)); diff --git a/src/slic3r/GUI/Selection.hpp b/src/slic3r/GUI/Selection.hpp index 4e5da3685..99d939acc 100644 --- a/src/slic3r/GUI/Selection.hpp +++ b/src/slic3r/GUI/Selection.hpp @@ -5,6 +5,11 @@ #include "libslic3r/Geometry.hpp" #include "3DScene.hpp" +#if ENABLE_RENDER_SELECTION_CENTER +class GLUquadric; +typedef class GLUquadric GLUquadricObj; +#endif // ENABLE_RENDER_SELECTION_CENTER + namespace Slic3r { namespace GUI { @@ -291,7 +296,7 @@ public: void render(float scale_factor = 1.0) const; #if ENABLE_RENDER_SELECTION_CENTER - void render_center() const; + void render_center(bool gizmo_is_dragging) const; #endif // ENABLE_RENDER_SELECTION_CENTER void render_sidebar_hints(const std::string& sidebar_field) const;