From c6940970f21c608af6d4c862b7ac6fa35c4a1e27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hejl?= Date: Fri, 12 Nov 2021 17:52:12 +0100 Subject: [PATCH] Decreased the minimum diameter of the brush in the multi-material painting gizmo to 0.1 with respect to #7108. --- src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.hpp | 4 ++++ src/slic3r/GUI/Gizmos/GLGizmoPainterBase.cpp | 4 ++-- src/slic3r/GUI/Gizmos/GLGizmoPainterBase.hpp | 4 ++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.hpp b/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.hpp index e5336869e..9475f9ba6 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.hpp @@ -97,6 +97,8 @@ public: // will be also extended to support additional states, requiring at least one state to remain free out of 19 states. static const constexpr size_t EXTRUDERS_LIMIT = 16; + virtual const float get_cursor_radius_min() const { return CursorRadiusMin; } + protected: std::array get_cursor_sphere_left_button_color() const override; std::array get_cursor_sphere_right_button_color() const override; @@ -120,6 +122,8 @@ protected: std::vector> m_modified_extruders_colors; std::vector m_original_volumes_extruder_idxs; + static const constexpr float CursorRadiusMin = 0.1f; // cannot be zero + private: bool on_init() override; diff --git a/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.cpp b/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.cpp index 2825913d3..5ee0fddb1 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.cpp @@ -254,8 +254,8 @@ bool GLGizmoPainterBase::gizmo_event(SLAGizmoEventType action, const Vec2d& mous } else if (alt_down) { if (m_tool_type == ToolType::BRUSH && (m_cursor_type == TriangleSelector::CursorType::SPHERE || m_cursor_type == TriangleSelector::CursorType::CIRCLE)) { - m_cursor_radius = action == SLAGizmoEventType::MouseWheelDown ? std::max(m_cursor_radius - CursorRadiusStep, CursorRadiusMin) - : std::min(m_cursor_radius + CursorRadiusStep, CursorRadiusMax); + m_cursor_radius = action == SLAGizmoEventType::MouseWheelDown ? std::max(m_cursor_radius - this->get_cursor_radius_step(), this->get_cursor_radius_min()) + : std::min(m_cursor_radius + this->get_cursor_radius_step(), this->get_cursor_radius_max()); m_parent.set_as_dirty(); return true; } else if (m_tool_type == ToolType::SMART_FILL) { diff --git a/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.hpp b/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.hpp index 2705f82d3..ff030f19f 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.hpp @@ -122,6 +122,10 @@ public: // after all volumes (including transparent ones) are rendered. virtual void render_painter_gizmo() const = 0; + virtual const float get_cursor_radius_min() const { return CursorRadiusMin; } + virtual const float get_cursor_radius_max() const { return CursorRadiusMax; } + virtual const float get_cursor_radius_step() const { return CursorRadiusStep; } + protected: virtual void render_triangles(const Selection& selection) const; void render_cursor() const;