Follow-up of 439e9bc7e7 - Added a button into Preview legend to quickly switch between showing/hiding custom gcode toolpaths for visualization which use different color ranges for the two cases

This commit is contained in:
enricoturri1966 2023-04-05 10:57:02 +02:00
parent bf87b89ea2
commit f56cffe546

View File

@ -3945,6 +3945,20 @@ void GCodeViewer::render_legend(float& legend_height)
}
}
if (m_view_type == EViewType::Width || m_view_type == EViewType::VolumetricRate) {
const auto custom_it = std::find(m_roles.begin(), m_roles.end(), GCodeExtrusionRole::Custom);
if (custom_it != m_roles.end()) {
const bool custom_visible = is_visible(GCodeExtrusionRole::Custom);
const wxString btn_text = custom_visible ? _u8L("Hide Custom GCode") : _u8L("Show Custom GCode");
ImGui::Separator();
if (imgui.button(btn_text, ImVec2(-1.0f, 0.0f), true)) {
m_extrusions.role_visibility_flags = custom_visible ? m_extrusions.role_visibility_flags & ~(1 << int(GCodeExtrusionRole::Custom)) :
m_extrusions.role_visibility_flags | (1 << int(GCodeExtrusionRole::Custom));
wxGetApp().plater()->refresh_print();
}
}
}
// total estimated printing time section
if (show_estimated_time) {
ImGui::Spacing();