mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-07-17 02:31:50 +08:00
Fix for f5d3866847
This commit is contained in:
parent
f5d3866847
commit
1c2d264570
@ -659,7 +659,7 @@ void Control::draw_tick_on_mouse_position(wxDC& dc)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string short_and_splitted_time(const std::string& time)
|
static wxString short_and_splitted_time(const std::string& time)
|
||||||
{
|
{
|
||||||
// Parse the dhms time format.
|
// Parse the dhms time format.
|
||||||
int days = 0;
|
int days = 0;
|
||||||
@ -697,7 +697,7 @@ static std::string short_and_splitted_time(const std::string& time)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
::sprintf(buffer, "%ds", seconds);
|
::sprintf(buffer, "%ds", seconds);
|
||||||
return buffer;
|
return wxString::FromUTF8(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString Control::get_label(int tick, LabelType label_type/* = ltHeightWithLayer*/) const
|
wxString Control::get_label(int tick, LabelType label_type/* = ltHeightWithLayer*/) const
|
||||||
@ -719,9 +719,13 @@ wxString Control::get_label(int tick, LabelType label_type/* = ltHeightWithLayer
|
|||||||
auto get_layer_number = [this](int value) {
|
auto get_layer_number = [this](int value) {
|
||||||
double layer_print_z = m_values[is_wipe_tower_layer(value) ? std::max<int>(value - 1, 0) : value];
|
double layer_print_z = m_values[is_wipe_tower_layer(value) ? std::max<int>(value - 1, 0) : value];
|
||||||
auto it = std::lower_bound(m_layers_values.begin(), m_layers_values.end(), layer_print_z - epsilon());
|
auto it = std::lower_bound(m_layers_values.begin(), m_layers_values.end(), layer_print_z - epsilon());
|
||||||
if (it == m_layers_values.end())
|
if (it == m_layers_values.end()) {
|
||||||
return -1;
|
it = std::lower_bound(m_values.begin(), m_values.end(), layer_print_z - epsilon());
|
||||||
return int(it - m_layers_values.begin());
|
if (it == m_values.end())
|
||||||
|
return size_t(-1);
|
||||||
|
return m_layers_values.size();
|
||||||
|
}
|
||||||
|
return size_t(it - m_layers_values.begin());
|
||||||
};
|
};
|
||||||
|
|
||||||
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
||||||
@ -737,10 +741,10 @@ wxString Control::get_label(int tick, LabelType label_type/* = ltHeightWithLayer
|
|||||||
else {
|
else {
|
||||||
if (label_type == ltEstimatedTime) {
|
if (label_type == ltEstimatedTime) {
|
||||||
if (m_is_smart_wipe_tower) {
|
if (m_is_smart_wipe_tower) {
|
||||||
int layer_number = get_layer_number(value);
|
size_t layer_number = get_layer_number(value);
|
||||||
return layer_number < 0 ? "" : short_and_splitted_time(get_time_dhms(m_layers_times[layer_number]));
|
return layer_number == size_t(-1) ? wxEmptyString : short_and_splitted_time(get_time_dhms(m_layers_times[layer_number]));
|
||||||
}
|
}
|
||||||
return value < m_layers_times.size() ? short_and_splitted_time(get_time_dhms(m_layers_times[value])) : "";
|
return value < m_layers_times.size() ? short_and_splitted_time(get_time_dhms(m_layers_times[value])) : wxEmptyString;
|
||||||
}
|
}
|
||||||
wxString str = m_values.empty() ?
|
wxString str = m_values.empty() ?
|
||||||
wxString::Format("%.*f", 2, m_label_koef * value) :
|
wxString::Format("%.*f", 2, m_label_koef * value) :
|
||||||
@ -748,7 +752,7 @@ wxString Control::get_label(int tick, LabelType label_type/* = ltHeightWithLayer
|
|||||||
if (label_type == ltHeight)
|
if (label_type == ltHeight)
|
||||||
return str;
|
return str;
|
||||||
if (label_type == ltHeightWithLayer) {
|
if (label_type == ltHeightWithLayer) {
|
||||||
size_t layer_number = m_is_smart_wipe_tower ? (size_t)get_layer_number(value) : (m_values.empty() ? value : value + 1);
|
size_t layer_number = m_is_smart_wipe_tower ? get_layer_number(value) : (m_values.empty() ? value : value + 1);
|
||||||
return format_wxstr("%1%\n(%2%)", str, layer_number);
|
return format_wxstr("%1%\n(%2%)", str, layer_number);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user