Fixed "Extruder sequence", when extruder changes are per mm

This commit is contained in:
YuSanka 2021-05-13 09:47:44 +02:00
parent 707ce9d3d4
commit 044634d7d1
2 changed files with 4 additions and 4 deletions

View file

@ -326,10 +326,10 @@ double Control::get_double_value(const SelectedSlider& selection)
return m_values[selection == ssLower ? m_lower_value : m_higher_value];
}
int Control::get_tick_from_value(double value)
int Control::get_tick_from_value(double value, bool force_lower_bound/* = false*/)
{
std::vector<double>::iterator it;
if (m_is_wipe_tower)
if (m_is_wipe_tower && !force_lower_bound)
it = std::find_if(m_values.begin(), m_values.end(),
[value](const double & val) { return fabs(value - val) <= epsilon(); });
else
@ -2395,7 +2395,7 @@ void Control::edit_extruder_sequence()
extruder = 0;
if (m_extruders_sequence.is_mm_intervals) {
value += m_extruders_sequence.interval_by_mm;
tick = get_tick_from_value(value);
tick = get_tick_from_value(value, true);
if (tick < 0)
break;
}

View file

@ -322,7 +322,7 @@ private:
wxSize get_size() const;
void get_size(int* w, int* h) const;
double get_double_value(const SelectedSlider& selection);
int get_tick_from_value(double value);
int get_tick_from_value(double value, bool force_lower_bound = false);
wxString get_tooltip(int tick = -1);
int get_edited_tick_for_position(wxPoint pos, Type type = ColorChange);