Skip to content

Commit

Permalink
Var layer height: show 2 digits in GUI.
Browse files Browse the repository at this point in the history
  • Loading branch information
Vovodroid authored and Vovodroid committed Apr 10, 2023
1 parent 0384d63 commit e071161
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/slic3r/GUI/DoubleSlider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,13 @@ wxString Control::get_label(int tick, LabelType label_type/* = ltHeightWithLayer
return str;
if (label_type == ltHeightWithLayer) {
size_t layer_number = m_is_wipe_tower ? get_layer_number(value, label_type) + 1 : (m_values.empty() ? value : value + 1);
return format_wxstr("%1%\n(%2%)", str, layer_number);
double layer_height = m_values.empty() ? m_label_koef : m_values[layer_number - 1] - (layer_number > 1 ? m_values[layer_number - 2] : 0);

//could be negative when custom G-code has layer height bigger than real one.
//Also could be less then real height when support not synchronized
if (layer_height <= 0)
layer_height = m_values[layer_number - 1];
return format_wxstr("%1%\n(%2%,\n%3%)", str, wxString::Format("%.2f", layer_height), layer_number);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/slic3r/GUI/GLCanvas3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ std::string GLCanvas3D::LayersEditing::get_tooltip(const GLCanvas3D& canvas) con
}
}
if (h > 0.0f)
ret = std::to_string(h);
ret = wxString::Format("%.2f", h).ToStdString();
}
}
return ret;
Expand Down

0 comments on commit e071161

Please sign in to comment.