From 35e736a8e50a9d52f086e9cb636b443c5df71d20 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Fri, 26 Apr 2024 09:34:42 +0200 Subject: [PATCH] ImGuiDoubleSlider: Fixed flickering on moving of the overlapped thumbs + Hide sliders after theirs creation --- src/slic3r/GUI/GUI_Preview.cpp | 4 ++++ src/slic3r/GUI/ImGuiDoubleSlider.cpp | 6 +++--- src/slic3r/GUI/Plater.cpp | 2 -- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/slic3r/GUI/GUI_Preview.cpp b/src/slic3r/GUI/GUI_Preview.cpp index bb773bf421..f097f51159 100644 --- a/src/slic3r/GUI/GUI_Preview.cpp +++ b/src/slic3r/GUI/GUI_Preview.cpp @@ -534,6 +534,10 @@ void Preview::create_sliders() // m_canvas_widget m_canvas_widget->Bind(wxEVT_KEY_DOWN, &Preview::update_sliders_from_canvas, this); m_canvas_widget->Bind(EVT_GLCANVAS_SLIDERS_MANIPULATION, &Preview::update_sliders_from_canvas, this); + + // Hide sliders from the very begibing. Visibility will be set later + m_layers_slider->Hide(); + m_moves_slider->Hide(); } // Find an index of a value in a sorted vector, which is in . diff --git a/src/slic3r/GUI/ImGuiDoubleSlider.cpp b/src/slic3r/GUI/ImGuiDoubleSlider.cpp index 37ffcca378..cae765852f 100644 --- a/src/slic3r/GUI/ImGuiDoubleSlider.cpp +++ b/src/slic3r/GUI/ImGuiDoubleSlider.cpp @@ -414,12 +414,12 @@ void ImGuiControl::check_and_correct_thumbs(int* higher_pos, int* lower_pos) if (is_horizontal()) { if (lower_thumb_center_pos + thumb_radius > higher_thumb_center_pos) { if (m_selection == ssHigher) { - m_regions.lower_thumb = m_regions.higher_thumb; + m_regions.higher_thumb = m_regions.lower_thumb; m_regions.higher_thumb.TranslateX(thumb_radius); *lower_pos = *higher_pos; } else { - m_regions.higher_thumb = m_regions.lower_thumb; + m_regions.lower_thumb = m_regions.higher_thumb; m_regions.lower_thumb.TranslateX(-thumb_radius); *higher_pos = *lower_pos; } @@ -434,7 +434,7 @@ void ImGuiControl::check_and_correct_thumbs(int* higher_pos, int* lower_pos) } else { m_regions.higher_thumb = m_regions.lower_thumb; - m_regions.lower_thumb.TranslateY(-thumb_radius); + m_regions.higher_thumb.TranslateY(-thumb_radius); *higher_pos = *lower_pos; } } diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 8c41c88f94..a90e7c8bca 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -753,8 +753,6 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) q->Layout(); set_current_panel(wxGetApp().is_editor() ? static_cast(view3D) : static_cast(preview)); - if (wxGetApp().is_gcode_viewer()) - preview->hide_layers_slider(); // updates camera type from .ini file camera.enable_update_config_on_type_change(true);