From 1c0cb70faa4608f3b5eb68a272b67a34c00249e7 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Mon, 24 Jun 2024 10:37:22 +0200 Subject: [PATCH] Fix for #12877 - Color Change Added After Moving Slider + Fixed update of the ruler, when it was hidden and than shown + Added messed include in RulerForDoubleSlider.cpp (#12882) + Fixed some warnings --- src/slic3r/GUI/DoubleSliderForLayers.cpp | 3 +-- src/slic3r/GUI/GUI_Preview.cpp | 2 +- src/slic3r/GUI/ImGuiDoubleSlider.cpp | 8 +++++++- src/slic3r/GUI/RulerForDoubleSlider.cpp | 1 + 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/slic3r/GUI/DoubleSliderForLayers.cpp b/src/slic3r/GUI/DoubleSliderForLayers.cpp index be29a3f3cb..460373bc2d 100644 --- a/src/slic3r/GUI/DoubleSliderForLayers.cpp +++ b/src/slic3r/GUI/DoubleSliderForLayers.cpp @@ -969,8 +969,7 @@ void DSForLayers::Render(const int canvas_width, const int canvas_height, float void DSForLayers::force_ruler_update() { - if (m_show_ruler) - m_ruler.invalidate(); + m_ruler.invalidate(); } bool DSForLayers::is_wipe_tower_layer(int tick) const diff --git a/src/slic3r/GUI/GUI_Preview.cpp b/src/slic3r/GUI/GUI_Preview.cpp index 78bfec39cf..b903162d54 100644 --- a/src/slic3r/GUI/GUI_Preview.cpp +++ b/src/slic3r/GUI/GUI_Preview.cpp @@ -408,7 +408,7 @@ void Preview::create_sliders() m_layers_slider->set_callback_on_thumb_move( [this]() -> void { Preview::on_layers_slider_scroll_changed(); } ); - m_layers_slider->set_callback_on_change_app_config([this](const std::string& key, const std::string& val) -> void { + m_layers_slider->set_callback_on_change_app_config([](const std::string& key, const std::string& val) -> void { wxGetApp().app_config->set(key, val); }); diff --git a/src/slic3r/GUI/ImGuiDoubleSlider.cpp b/src/slic3r/GUI/ImGuiDoubleSlider.cpp index fcc976261e..614ec759c1 100644 --- a/src/slic3r/GUI/ImGuiDoubleSlider.cpp +++ b/src/slic3r/GUI/ImGuiDoubleSlider.cpp @@ -545,6 +545,11 @@ bool ImGuiControl::draw_slider( int* higher_pos, int* lower_pos, m_lclick_on_selected_thumb = true; } } + + if (ImGui::ItemHoverable(active_thumb, id) && ImGui::IsMouseDragging(0)) { + // invalidate active thumb clicking + m_active_thumb = ImRect(0.f, 0.f, 0.f, 0.f); + } } // update thumb position @@ -621,7 +626,8 @@ bool ImGuiControl::draw_slider( int* higher_pos, int* lower_pos, } // draw label on mouse move - draw_label(move_label, mouse_pos_rc, false, true); + if (m_show_move_label) + draw_label(move_label, mouse_pos_rc, false, true); return pos_changed; } diff --git a/src/slic3r/GUI/RulerForDoubleSlider.cpp b/src/slic3r/GUI/RulerForDoubleSlider.cpp index d1d6f2f776..936ba89843 100644 --- a/src/slic3r/GUI/RulerForDoubleSlider.cpp +++ b/src/slic3r/GUI/RulerForDoubleSlider.cpp @@ -4,6 +4,7 @@ ///|/ #include "RulerForDoubleSlider.hpp" #include "libslic3r/CustomGCode.hpp" +#include "libslic3r/libslic3r.h" using namespace Slic3r; using namespace CustomGCode;