Fixed a crash when using place to bed function with the layer editing active

This was caused by trying to render a deleted layer height profile. Other gizmos were
not affected because they are not dragging at the time of their action, so the profile
was correctly recalculated for them.
This commit is contained in:
Lukas Matena 2019-06-26 11:49:02 +02:00
parent f93e7496f7
commit d845332de1

View File

@ -457,8 +457,10 @@ void GLCanvas3D::LayersEditing::_render_profile(const Rect& bar_rect) const
{
//FIXME show some kind of legend.
if (!m_slicing_parameters)
return;
// Make the vertical bar a bit wider so the layer height curve does not touch the edge of the bar region.
assert(m_slicing_parameters != nullptr);
float scale_x = bar_rect.get_width() / (float)(1.12 * m_slicing_parameters->max_layer_height);
float scale_y = bar_rect.get_height() / m_object_max_z;
float x = bar_rect.get_left() + (float)m_slicing_parameters->layer_height * scale_x;