mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-14 10:17:55 -06:00
fix gizmo bar wobbling (#6230)
* fix gizmo bar wobbling Gizmo bar is wobbling at specific application window width range. This comes from a bar scaling calculations method: - new scale calculated for already scaled bar - scale stored as application settings loosing precision Rework gizmo bar resizing code to remove feedback: - calculate scale factor based on unscaled bar size * rework gizmo bar scaling Unify scaling implementation across platforms (MacOS, Win, Linux). Now all platform scale bar setting icon size. Toolbar scale is used for high-DPI displays scaling only. * Add comments, reorganize changes to minimize diff
This commit is contained in:
parent
8b8a70fffa
commit
9ff0e9335f
1 changed files with 21 additions and 27 deletions
|
@ -7400,37 +7400,21 @@ void GLCanvas3D::_check_and_update_toolbar_icon_scale()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
float scale = wxGetApp().toolbar_icon_scale();
|
|
||||||
Size cnv_size = get_canvas_size();
|
Size cnv_size = get_canvas_size();
|
||||||
|
|
||||||
//BBS: GUI refactor: GLToolbar
|
// Orca: Toolbar scale is a constant value which depends on display resolution and OS.
|
||||||
int size_i = int(GLToolbar::Default_Icons_Size * scale);
|
// Icon size is the only variable we change to scale the toolbars.
|
||||||
// force even size
|
const float sc = get_scale();
|
||||||
if (size_i % 2 != 0)
|
|
||||||
size_i -= 1;
|
|
||||||
float size = size_i;
|
|
||||||
|
|
||||||
// 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_main_toolbar.set_scale(sc);
|
||||||
m_assemble_view_toolbar.set_scale(sc);
|
m_assemble_view_toolbar.set_scale(sc);
|
||||||
m_separator_toolbar.set_scale(sc);
|
m_separator_toolbar.set_scale(sc);
|
||||||
collapse_toolbar.set_scale(sc / 2.0);
|
collapse_toolbar.set_scale(sc);
|
||||||
size *= m_retina_helper->get_scale_factor();
|
|
||||||
|
|
||||||
auto* m_notification = wxGetApp().plater()->get_notification_manager();
|
auto* m_notification = wxGetApp().plater()->get_notification_manager();
|
||||||
m_notification->set_scale(sc);
|
m_notification->set_scale(sc);
|
||||||
m_gizmos.set_overlay_scale(sc);
|
m_gizmos.set_overlay_scale(sc);
|
||||||
#else
|
|
||||||
//BBS: GUI refactor: GLToolbar
|
float size = m_main_toolbar.get_icons_size();
|
||||||
m_main_toolbar.set_icons_size(size);
|
|
||||||
m_assemble_view_toolbar.set_icons_size(size);
|
|
||||||
m_separator_toolbar.set_icons_size(size);
|
|
||||||
collapse_toolbar.set_icons_size(size / 2.0);
|
|
||||||
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
|
||||||
|
@ -7467,11 +7451,21 @@ 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 = std::min(new_scale, 1.f);
|
||||||
new_scale /= m_retina_helper->get_scale_factor();
|
|
||||||
#endif
|
//BBS: GUI refactor: GLToolbar
|
||||||
if (fabs(new_scale - scale) > 0.01) // scale is changed by 1% and more
|
int size_i = int(GLToolbar::Default_Icons_Size * new_scale);
|
||||||
wxGetApp().set_auto_toolbar_icon_scale(new_scale);
|
// Orca: force even size
|
||||||
|
if (size_i % 2 != 0)
|
||||||
|
size_i -= 1;
|
||||||
|
size = size_i;
|
||||||
|
|
||||||
|
// Orca: set toolbar icon size regardless of platform
|
||||||
|
m_main_toolbar.set_icons_size(size);
|
||||||
|
m_assemble_view_toolbar.set_icons_size(size);
|
||||||
|
m_separator_toolbar.set_icons_size(size);
|
||||||
|
collapse_toolbar.set_icons_size(size / 2.0);
|
||||||
|
m_gizmos.set_overlay_icon_size(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLCanvas3D::_render_overlays()
|
void GLCanvas3D::_render_overlays()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue