Fixed an adding of color change tick on last layer
This commit is contained in:
parent
5ae23a242b
commit
6b95c579af
2 changed files with 9 additions and 3 deletions
|
@ -691,7 +691,12 @@ void Preview::fill_slider_values(std::vector<std::pair<int, double>> &values,
|
|||
std::vector<double> &ticks_from_config = (wxGetApp().preset_bundle->project_config.option<ConfigOptionFloats>("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();
|
||||
|
|
|
@ -2196,9 +2196,10 @@ std::vector<double> DoubleSlider::GetTicksValues() const
|
|||
{
|
||||
std::vector<double> 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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue