mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-07-28 02:51:59 +08:00
Fix icon scaling causing crash on startup
Icons can get scaled even if the window is not yet fully initialised, in which case they ended up with a negative scale. Potentially related to supermerill/SuperSlicer#854 Revert "Add a linux startup crash fix." This reverts commit 34ff5c0304a24f57505db19d559be3ecc09522ef.
This commit is contained in:
parent
650c13e900
commit
c8bb0a46b8
@ -5266,8 +5266,8 @@ void GLCanvas3D::_check_and_update_toolbar_icon_scale() const
|
|||||||
int items_cnt = m_main_toolbar.get_visible_items_cnt() + m_undoredo_toolbar.get_visible_items_cnt() + collapse_toolbar.get_visible_items_cnt();
|
int items_cnt = m_main_toolbar.get_visible_items_cnt() + m_undoredo_toolbar.get_visible_items_cnt() + collapse_toolbar.get_visible_items_cnt();
|
||||||
float noitems_width = top_tb_width - size * items_cnt; // width of separators and borders in top toolbars
|
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
|
// calculate scale needed for items in all top toolbars (make sure the size is positive even if `cnv_size` is less than `noitems_width`)
|
||||||
float new_h_scale = (cnv_size.get_width() - noitems_width) / (items_cnt * GLToolbar::Default_Icons_Size);
|
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
|
items_cnt = m_gizmos.get_selectable_icons_cnt() + 3; // +3 means a place for top and view toolbars and separators in gizmos toolbar
|
||||||
|
|
||||||
|
@ -1199,10 +1199,6 @@ float GUI_App::toolbar_icon_scale(const bool is_limited/* = false*/) const
|
|||||||
|
|
||||||
if (is_limited && int_val < 50)
|
if (is_limited && int_val < 50)
|
||||||
int_val = 50;
|
int_val = 50;
|
||||||
else if (int_val < 1) {
|
|
||||||
int_val = 10; //buggy code? issue supermerill/superslicer#854
|
|
||||||
assert(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0.01f * int_val * icon_sc;
|
return 0.01f * int_val * icon_sc;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user