Skip to content

Commit

Permalink
prusa3d#8563 - Fix icon scaling causing crash on startup. Ported from s…
Browse files Browse the repository at this point in the history
  • Loading branch information
enricoturri1966 committed Aug 22, 2022
1 parent f586a3e commit e9f5551
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/slic3r/GUI/GLCanvas3D.cpp
Expand Up @@ -6152,7 +6152,11 @@ void GLCanvas3D::_check_and_update_toolbar_icon_scale()
float noitems_width = top_tb_width - size * items_cnt; // width of separators and borders in top toolbars

// calculate scale needed for items in all top toolbars
float new_h_scale = (cnv_size.get_width() - noitems_width) / (items_cnt * GLToolbar::Default_Icons_Size);
// the std::max() is there because on some Linux dialects/virtual machines this code is called when the canvas has not been properly initialized yet,
// leading to negative values for the scale.
// See: https://github.com/prusa3d/PrusaSlicer/issues/8563
// https://github.com/supermerill/SuperSlicer/issues/854
float new_h_scale = std::max((cnv_size.get_width() - noitems_width), 1.0f) / (items_cnt * GLToolbar::Default_Icons_Size);

items_cnt = m_gizmos.get_selectable_icons_cnt() + 3; // +3 means a place for top and view toolbars and separators in gizmos toolbar

Expand Down

0 comments on commit e9f5551

Please sign in to comment.