Merge branch 'master' into fs_emboss
This commit is contained in:
commit
ce2e0e7978
13 changed files with 132 additions and 180 deletions
|
@ -5660,10 +5660,10 @@ void GLCanvas3D::_check_and_update_toolbar_icon_scale()
|
|||
if (wxGetApp().plater()->is_preview_shown())
|
||||
return;
|
||||
|
||||
float scale = wxGetApp().toolbar_icon_scale();
|
||||
Size cnv_size = get_canvas_size();
|
||||
const float scale = wxGetApp().toolbar_icon_scale();
|
||||
const Size cnv_size = get_canvas_size();
|
||||
|
||||
float size = GLToolbar::Default_Icons_Size * scale;
|
||||
int size = int(GLToolbar::Default_Icons_Size * scale);
|
||||
|
||||
// Set current size for all top toolbars. It will be used for next calculations
|
||||
GLToolbar& collapse_toolbar = wxGetApp().plater()->get_collapse_toolbar();
|
||||
|
@ -5672,28 +5672,28 @@ void GLCanvas3D::_check_and_update_toolbar_icon_scale()
|
|||
m_main_toolbar.set_scale(sc);
|
||||
m_undoredo_toolbar.set_scale(sc);
|
||||
collapse_toolbar.set_scale(sc);
|
||||
size *= m_retina_helper->get_scale_factor();
|
||||
size *= int(m_retina_helper->get_scale_factor());
|
||||
#else
|
||||
m_main_toolbar.set_icons_size(size);
|
||||
m_undoredo_toolbar.set_icons_size(size);
|
||||
collapse_toolbar.set_icons_size(size);
|
||||
#endif // ENABLE_RETINA_GL
|
||||
|
||||
float top_tb_width = m_main_toolbar.get_width() + m_undoredo_toolbar.get_width() + collapse_toolbar.get_width();
|
||||
const float top_tb_width = m_main_toolbar.get_width() + m_undoredo_toolbar.get_width() + collapse_toolbar.get_width();
|
||||
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
|
||||
const float noitems_width = top_tb_width - float(size) * items_cnt; // width of separators and borders in top toolbars
|
||||
|
||||
// calculate scale needed for items in all top toolbars
|
||||
// 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);
|
||||
const 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
|
||||
|
||||
// calculate scale needed for items in the gizmos toolbar
|
||||
float new_v_scale = cnv_size.get_height() / (items_cnt * GLGizmosManager::Default_Icons_Size);
|
||||
const float new_v_scale = cnv_size.get_height() / (items_cnt * GLGizmosManager::Default_Icons_Size);
|
||||
|
||||
// set minimum scale as a auto scale for the toolbars
|
||||
float new_scale = std::min(new_h_scale, new_v_scale);
|
||||
|
@ -5708,24 +5708,12 @@ void GLCanvas3D::_render_overlays()
|
|||
{
|
||||
glsafe(::glDisable(GL_DEPTH_TEST));
|
||||
|
||||
// main toolbar and undoredo toolbar need to be both updated before rendering because both their sizes are needed
|
||||
// to correctly place them
|
||||
_check_and_update_toolbar_icon_scale();
|
||||
|
||||
_render_gizmos_overlay();
|
||||
|
||||
// main toolbar and undoredo toolbar need to be both updated before rendering because both their sizes are needed
|
||||
// to correctly place them
|
||||
#if ENABLE_RETINA_GL
|
||||
const float scale = m_retina_helper->get_scale_factor() * wxGetApp().toolbar_icon_scale(/*true*/);
|
||||
m_main_toolbar.set_scale(scale);
|
||||
m_undoredo_toolbar.set_scale(scale);
|
||||
wxGetApp().plater()->get_collapse_toolbar().set_scale(scale);
|
||||
#else
|
||||
const float size = int(GLToolbar::Default_Icons_Size * wxGetApp().toolbar_icon_scale(/*true*/));
|
||||
m_main_toolbar.set_icons_size(size);
|
||||
m_undoredo_toolbar.set_icons_size(size);
|
||||
wxGetApp().plater()->get_collapse_toolbar().set_icons_size(size);
|
||||
#endif // ENABLE_RETINA_GL
|
||||
|
||||
_render_main_toolbar();
|
||||
_render_undoredo_toolbar();
|
||||
_render_collapse_toolbar();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue