diff --git a/src/slic3r/GUI/GUI_Preview.cpp b/src/slic3r/GUI/GUI_Preview.cpp index c5746fed1..2b9da6aa0 100644 --- a/src/slic3r/GUI/GUI_Preview.cpp +++ b/src/slic3r/GUI/GUI_Preview.cpp @@ -634,7 +634,7 @@ void Preview::update_double_slider(const std::vector& layers_z, bool kee bool force_sliders_full_range = was_empty; if (!keep_z_range) { - bool span_changed = layers_z.empty() || std::abs(layers_z.back() - m_slider->GetMaxValueD()) > 1e-6; + bool span_changed = layers_z.empty() || std::abs(layers_z.back() - m_slider->GetMaxValueD()) > DoubleSlider::epsilon()/*1e-6*/; force_sliders_full_range |= span_changed; } bool snap_to_min = force_sliders_full_range || m_slider->is_lower_at_min(); @@ -650,12 +650,12 @@ void Preview::update_double_slider(const std::vector& layers_z, bool kee int idx_high = m_slider->GetMaxValue(); if (! layers_z.empty()) { if (! snap_to_min) { - int idx_new = find_close_layer_idx(layers_z, z_low, 1e-6); + int idx_new = find_close_layer_idx(layers_z, z_low, DoubleSlider::epsilon()/*1e-6*/); if (idx_new != -1) idx_low = idx_new; } if (! snap_to_max) { - int idx_new = find_close_layer_idx(layers_z, z_high, 1e-6); + int idx_new = find_close_layer_idx(layers_z, z_high, DoubleSlider::epsilon()/*1e-6*/); if (idx_new != -1) idx_high = idx_new; } @@ -695,7 +695,7 @@ void Preview::fill_slider_values(std::vector> &values, { return (values.back().second < val && // we can't ignore tick on last layer - fabs(values.back().second - val) > EPSILON); + fabs(values.back().second - val) > DoubleSlider::epsilon()); }), ticks_from_config.end()); if (ticks_from_config.size() != old_size) diff --git a/src/slic3r/GUI/wxExtensions.cpp b/src/slic3r/GUI/wxExtensions.cpp index 5f11bec45..06e9a7f90 100644 --- a/src/slic3r/GUI/wxExtensions.cpp +++ b/src/slic3r/GUI/wxExtensions.cpp @@ -2217,10 +2217,10 @@ void DoubleSlider::SetTicksValues(const std::vector& heights) m_ticks.clear(); unsigned int i = 0; for (auto h : heights) { - while (i < m_values.size() && m_values[i].second - EPSILON/*1e-6*/ < h) + while (i < m_values.size() && m_values[i].second - epsilon()/*1e-6*/ < h) ++i; // don't miss last layer if it is - if (i == m_values.size() && fabs(m_values[i-1].second - h) > EPSILON) + if (i == m_values.size() && fabs(m_values[i-1].second - h) > epsilon()) return; m_ticks.insert(i-1); } diff --git a/src/slic3r/GUI/wxExtensions.hpp b/src/slic3r/GUI/wxExtensions.hpp index 14ceab8ff..51faffda7 100644 --- a/src/slic3r/GUI/wxExtensions.hpp +++ b/src/slic3r/GUI/wxExtensions.hpp @@ -720,6 +720,9 @@ public: const wxString& name = wxEmptyString); ~DoubleSlider() {} + // permissible error for layer height + static double epsilon() { return 0.0011;} + void msw_rescale(); int GetMinValue() const { return m_min_value; }