SPE-1908: Fixed travel moves starting above the top layer not shown in preview

This commit is contained in:
enricoturri1966 2023-09-21 13:59:45 +02:00
parent e1ff5feb41
commit e8ba79a0ad

View File

@ -2540,8 +2540,11 @@ void GCodeViewer::refresh_render_paths(bool keep_sequential_current_first, bool
const size_t min_s_id = m_layers.get_range_at(min_id).first;
const size_t max_s_id = m_layers.get_range_at(max_id).last;
return (min_s_id <= path.sub_paths.front().first.s_id && path.sub_paths.front().first.s_id <= max_s_id) ||
(min_s_id <= path.sub_paths.back().last.s_id && path.sub_paths.back().last.s_id <= max_s_id);
const bool top_layer_shown = max_id == m_layers.size() - 1;
return (min_s_id <= path.sub_paths.front().first.s_id && path.sub_paths.front().first.s_id <= max_s_id) || // the leading vertex is contained
(min_s_id <= path.sub_paths.back().last.s_id && path.sub_paths.back().last.s_id <= max_s_id) || // the trailing vertex is contained
(top_layer_shown && max_s_id < path.sub_paths.front().first.s_id); // the leading vertex is above the top layer and the top layer is shown
};
#if ENABLE_GCODE_VIEWER_STATISTICS