From a3f9aa454c4b6ad6666a9656906cfa70057bdde9 Mon Sep 17 00:00:00 2001 From: Vovodroid Date: Wed, 29 Mar 2023 21:36:30 +0300 Subject: [PATCH] Var layer height: show 2 digits in GUI. --- src/slic3r/GUI/DoubleSlider.cpp | 8 +++++++- src/slic3r/GUI/GLCanvas3D.cpp | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/DoubleSlider.cpp b/src/slic3r/GUI/DoubleSlider.cpp index dda268f2a0d..99d340238ff 100644 --- a/src/slic3r/GUI/DoubleSlider.cpp +++ b/src/slic3r/GUI/DoubleSlider.cpp @@ -783,7 +783,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); } } diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 990928e9a28..fb07feccfaf 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -346,7 +346,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;