From 6b95c579af9f6e20bd449c52c9e55646e0c51192 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Wed, 4 Sep 2019 08:53:21 +0200 Subject: [PATCH] Fixed an adding of color change tick on last layer --- src/slic3r/GUI/GUI_Preview.cpp | 7 ++++++- src/slic3r/GUI/wxExtensions.cpp | 5 +++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/slic3r/GUI/GUI_Preview.cpp b/src/slic3r/GUI/GUI_Preview.cpp index de6289f7d..c5746fed1 100644 --- a/src/slic3r/GUI/GUI_Preview.cpp +++ b/src/slic3r/GUI/GUI_Preview.cpp @@ -691,7 +691,12 @@ void Preview::fill_slider_values(std::vector> &values, std::vector &ticks_from_config = (wxGetApp().preset_bundle->project_config.option("colorprint_heights"))->values; unsigned int old_size = ticks_from_config.size(); ticks_from_config.erase(std::remove_if(ticks_from_config.begin(), ticks_from_config.end(), - [values](double val) { return values.back().second < val; }), + [values](double val) + { + return (values.back().second < val && + // we can't ignore tick on last layer + fabs(values.back().second - val) > EPSILON); + }), ticks_from_config.end()); if (ticks_from_config.size() != old_size) m_schedule_background_process(); diff --git a/src/slic3r/GUI/wxExtensions.cpp b/src/slic3r/GUI/wxExtensions.cpp index a41bb1147..9b18e2a7b 100644 --- a/src/slic3r/GUI/wxExtensions.cpp +++ b/src/slic3r/GUI/wxExtensions.cpp @@ -2196,9 +2196,10 @@ std::vector DoubleSlider::GetTicksValues() const { std::vector values; + const int val_size = m_values.size(); if (!m_values.empty()) - for (auto tick : m_ticks) { - if (tick > m_values.size()) + for (int tick : m_ticks) { + if (tick > val_size) break; values.push_back(m_values[tick].second); }