glcanvas: scale icons using icon size, not scale factor
Calculate toolbar icon size the same way as it done on windows: manipulate icon size, not toolbar scale. Scaling icons this way makes images sharper since they getting rasterized to a target size rather than being rasterized for 40px and scaled to a desired size later.
This commit is contained in:
parent
0c190860e2
commit
7b3e0cc637
1 changed files with 2 additions and 18 deletions
|
@ -7431,7 +7431,7 @@ void GLCanvas3D::_check_and_update_toolbar_icon_scale()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
float scale = wxGetApp().toolbar_icon_scale();
|
float scale = wxGetApp().toolbar_icon_scale() * get_scale();
|
||||||
Size cnv_size = get_canvas_size();
|
Size cnv_size = get_canvas_size();
|
||||||
|
|
||||||
//BBS: GUI refactor: GLToolbar
|
//BBS: GUI refactor: GLToolbar
|
||||||
|
@ -7442,26 +7442,12 @@ void GLCanvas3D::_check_and_update_toolbar_icon_scale()
|
||||||
float size = size_i;
|
float size = size_i;
|
||||||
|
|
||||||
// Set current size for all top toolbars. It will be used for next calculations
|
// Set current size for all top toolbars. It will be used for next calculations
|
||||||
#if ENABLE_RETINA_GL
|
|
||||||
const float sc = m_retina_helper->get_scale_factor() * scale;
|
|
||||||
//BBS: GUI refactor: GLToolbar
|
|
||||||
m_main_toolbar.set_scale(sc);
|
|
||||||
m_assemble_view_toolbar.set_scale(sc);
|
|
||||||
m_separator_toolbar.set_scale(sc);
|
|
||||||
collapse_toolbar.set_scale(sc / 2.0);
|
|
||||||
size *= m_retina_helper->get_scale_factor();
|
|
||||||
|
|
||||||
auto* m_notification = wxGetApp().plater()->get_notification_manager();
|
|
||||||
m_notification->set_scale(sc);
|
|
||||||
m_gizmos.set_overlay_scale(sc);
|
|
||||||
#else
|
|
||||||
//BBS: GUI refactor: GLToolbar
|
//BBS: GUI refactor: GLToolbar
|
||||||
m_main_toolbar.set_icons_size(size);
|
m_main_toolbar.set_icons_size(size);
|
||||||
m_assemble_view_toolbar.set_icons_size(size);
|
m_assemble_view_toolbar.set_icons_size(size);
|
||||||
m_separator_toolbar.set_icons_size(size);
|
m_separator_toolbar.set_icons_size(size);
|
||||||
collapse_toolbar.set_icons_size(size / 2.0);
|
collapse_toolbar.set_icons_size(size / 2.0);
|
||||||
m_gizmos.set_overlay_icon_size(size);
|
m_gizmos.set_overlay_icon_size(size);
|
||||||
#endif // ENABLE_RETINA_GL
|
|
||||||
|
|
||||||
//BBS: GUI refactor: GLToolbar
|
//BBS: GUI refactor: GLToolbar
|
||||||
#if BBS_TOOLBAR_ON_TOP
|
#if BBS_TOOLBAR_ON_TOP
|
||||||
|
@ -7498,9 +7484,7 @@ void GLCanvas3D::_check_and_update_toolbar_icon_scale()
|
||||||
|
|
||||||
// set minimum scale as a auto scale for the toolbars
|
// set minimum scale as a auto scale for the toolbars
|
||||||
float new_scale = std::min(new_h_scale, new_v_scale);
|
float new_scale = std::min(new_h_scale, new_v_scale);
|
||||||
#if ENABLE_RETINA_GL
|
new_scale /= get_scale();
|
||||||
new_scale /= m_retina_helper->get_scale_factor();
|
|
||||||
#endif
|
|
||||||
if (fabs(new_scale - scale) > 0.05) // scale is changed by 5% and more
|
if (fabs(new_scale - scale) > 0.05) // scale is changed by 5% and more
|
||||||
wxGetApp().set_auto_toolbar_icon_scale(new_scale);
|
wxGetApp().set_auto_toolbar_icon_scale(new_scale);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue