diff --git a/src/slic3r/GUI/GUI_Preview.cpp b/src/slic3r/GUI/GUI_Preview.cpp index c9228d0855..d28b921d92 100644 --- a/src/slic3r/GUI/GUI_Preview.cpp +++ b/src/slic3r/GUI/GUI_Preview.cpp @@ -533,6 +533,7 @@ void Preview::create_double_slider() m_slider->Bind(wxEVT_SCROLL_CHANGED, &Preview::on_sliders_scroll_changed, this); + Bind(wxCUSTOMEVT_TICKSCHANGED, [this](wxEvent&) { auto& config = wxGetApp().preset_bundle->project_config; ((config.option("colorprint_heights"))->values) = (m_slider->GetTicksValues()); @@ -823,7 +824,7 @@ void Preview::load_print_as_sla() } } -void Preview::on_sliders_scroll_changed(wxEvent& event) +void Preview::on_sliders_scroll_changed(wxCommandEvent& event) { if (IsShown()) { @@ -831,7 +832,7 @@ void Preview::on_sliders_scroll_changed(wxEvent& event) if (tech == ptFFF) { m_canvas->set_toolpaths_range(m_slider->GetLowerValueD() - 1e-6, m_slider->GetHigherValueD() + 1e-6); - m_canvas_widget->Refresh(); + m_canvas->render(); m_canvas->set_use_clipping_planes(false); } else if (tech == ptSLA) @@ -839,10 +840,11 @@ void Preview::on_sliders_scroll_changed(wxEvent& event) m_canvas->set_clipping_plane(0, ClippingPlane(Vec3d::UnitZ(), -m_slider->GetLowerValueD())); m_canvas->set_clipping_plane(1, ClippingPlane(-Vec3d::UnitZ(), m_slider->GetHigherValueD())); m_canvas->set_use_clipping_planes(m_slider->GetHigherValue() != 0); - m_canvas_widget->Refresh(); + m_canvas->render(); } } } + } // namespace GUI } // namespace Slic3r diff --git a/src/slic3r/GUI/GUI_Preview.hpp b/src/slic3r/GUI/GUI_Preview.hpp index b70d01fa40..1838082c38 100644 --- a/src/slic3r/GUI/GUI_Preview.hpp +++ b/src/slic3r/GUI/GUI_Preview.hpp @@ -154,7 +154,7 @@ private: void load_print_as_fff(bool keep_z_range = false); void load_print_as_sla(); - void on_sliders_scroll_changed(wxEvent& event); + void on_sliders_scroll_changed(wxCommandEvent& event); }; diff --git a/src/slic3r/GUI/wxExtensions.cpp b/src/slic3r/GUI/wxExtensions.cpp index 0e89a72f20..599d3edac2 100644 --- a/src/slic3r/GUI/wxExtensions.cpp +++ b/src/slic3r/GUI/wxExtensions.cpp @@ -2235,14 +2235,16 @@ void DoubleSlider::OnMotion(wxMouseEvent& event) } else if (m_is_left_down || m_is_right_down) { if (m_selection == ssLower) { + int current_value = m_lower_value; m_lower_value = get_value_from_position(pos.x, pos.y); correct_lower_value(); - action = true; + action = (current_value != m_lower_value); } else if (m_selection == ssHigher) { + int current_value = m_higher_value; m_higher_value = get_value_from_position(pos.x, pos.y); correct_higher_value(); - action = true; + action = (current_value != m_higher_value); } } Refresh(); @@ -2253,6 +2255,7 @@ void DoubleSlider::OnMotion(wxMouseEvent& event) { wxCommandEvent e(wxEVT_SCROLL_CHANGED); e.SetEventObject(this); + e.SetString("moving"); ProcessWindowEvent(e); } }