Best effort for pixel perfect icon rendering (#4552)
* Make sure all icons & toolbars have sizes & locations in whole number pixels, so icons won't be blurry * Make every size even so it scales well on screen
This commit is contained in:
parent
136313f539
commit
ba3016bc3d
5 changed files with 22 additions and 19 deletions
|
@ -6292,8 +6292,8 @@ bool GLCanvas3D::_init_main_toolbar()
|
|||
//BBS: main toolbar is at the top and left, we don't need the rounded-corner effect at the right side and the top side
|
||||
m_main_toolbar.set_horizontal_orientation(GLToolbar::Layout::HO_Right);
|
||||
m_main_toolbar.set_vertical_orientation(GLToolbar::Layout::VO_Top);
|
||||
m_main_toolbar.set_border(5.0f);
|
||||
m_main_toolbar.set_separator_size(5);
|
||||
m_main_toolbar.set_border(4.0f);
|
||||
m_main_toolbar.set_separator_size(4);
|
||||
m_main_toolbar.set_gap_size(4);
|
||||
|
||||
m_main_toolbar.del_all_item();
|
||||
|
@ -6483,7 +6483,7 @@ bool GLCanvas3D::_init_assemble_view_toolbar()
|
|||
//BBS: assemble toolbar is at the top and right, we don't need the rounded-corner effect at the left side and the top side
|
||||
m_assemble_view_toolbar.set_horizontal_orientation(GLToolbar::Layout::HO_Left);
|
||||
m_assemble_view_toolbar.set_vertical_orientation(GLToolbar::Layout::VO_Top);
|
||||
m_assemble_view_toolbar.set_border(5.0f);
|
||||
m_assemble_view_toolbar.set_border(4.0f);
|
||||
m_assemble_view_toolbar.set_separator_size(10);
|
||||
m_assemble_view_toolbar.set_gap_size(4);
|
||||
|
||||
|
@ -6540,7 +6540,7 @@ bool GLCanvas3D::_init_separator_toolbar()
|
|||
//BBS: assemble toolbar is at the top and right, we don't need the rounded-corner effect at the left side and the top side
|
||||
m_separator_toolbar.set_horizontal_orientation(GLToolbar::Layout::HO_Left);
|
||||
m_separator_toolbar.set_vertical_orientation(GLToolbar::Layout::VO_Top);
|
||||
m_separator_toolbar.set_border(5.0f);
|
||||
m_separator_toolbar.set_border(4.0f);
|
||||
|
||||
m_separator_toolbar.del_all_item();
|
||||
|
||||
|
@ -7383,8 +7383,11 @@ void GLCanvas3D::_check_and_update_toolbar_icon_scale()
|
|||
Size cnv_size = get_canvas_size();
|
||||
|
||||
//BBS: GUI refactor: GLToolbar
|
||||
float size = GLToolbar::Default_Icons_Size * scale;
|
||||
//float main_size = GLGizmosManager::Default_Icons_Size * scale;
|
||||
int size_i = int(GLToolbar::Default_Icons_Size * scale);
|
||||
// force even size
|
||||
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
|
||||
|
@ -7401,7 +7404,7 @@ void GLCanvas3D::_check_and_update_toolbar_icon_scale()
|
|||
m_gizmos.set_overlay_scale(sc);
|
||||
#else
|
||||
//BBS: GUI refactor: GLToolbar
|
||||
m_main_toolbar.set_icons_size(GLGizmosManager::Default_Icons_Size * scale);
|
||||
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);
|
||||
|
@ -7662,7 +7665,7 @@ void GLCanvas3D::_render_gizmos_overlay()
|
|||
}
|
||||
}
|
||||
|
||||
float GLCanvas3D::get_main_toolbar_offset() const
|
||||
int GLCanvas3D::get_main_toolbar_offset() const
|
||||
{
|
||||
const float cnv_width = get_canvas_size().get_width();
|
||||
const float collapse_toolbar_width = get_collapse_toolbar_width() * 2;
|
||||
|
|
|
@ -850,9 +850,9 @@ public:
|
|||
//BBS: add part plate related logic
|
||||
void select_plate();
|
||||
//BBS: GUI refactor: GLToolbar&&gizmo
|
||||
float get_main_toolbar_offset() const;
|
||||
float get_main_toolbar_height() const { return m_main_toolbar.get_height(); }
|
||||
float get_main_toolbar_width() const { return m_main_toolbar.get_width(); }
|
||||
int get_main_toolbar_offset() const;
|
||||
int get_main_toolbar_height() const { return m_main_toolbar.get_height(); }
|
||||
int get_main_toolbar_width() const { return m_main_toolbar.get_width(); }
|
||||
float get_assemble_view_toolbar_width() const { return m_assemble_view_toolbar.get_width(); }
|
||||
float get_assemble_view_toolbar_height() const { return m_assemble_view_toolbar.get_height(); }
|
||||
float get_assembly_paint_toolbar_width() const { return m_paint_toolbar_width; }
|
||||
|
|
|
@ -1101,10 +1101,10 @@ void GLGizmosManager::do_render_overlay() const
|
|||
//float space_width = GLGizmosManager::Default_Icons_Size * wxGetApp().toolbar_icon_scale();
|
||||
//float zoomed_top_x = 0.5f *(cnv_w + main_toolbar_width - 2 * space_width - width) * inv_zoom;
|
||||
|
||||
float main_toolbar_left = -0.5f * cnv_w + m_parent.get_main_toolbar_offset();
|
||||
int main_toolbar_left = -cnv_w + m_parent.get_main_toolbar_offset() * 2;
|
||||
//float zoomed_top_x = 0.5f *(main_toolbar_width + collapse_width - width - assemble_view_width) * inv_zoom;
|
||||
top_x = main_toolbar_left + main_toolbar_width + separator_width / 2;
|
||||
top_x = top_x * inv_cnv_w * 2;
|
||||
top_x = main_toolbar_left + main_toolbar_width * 2 + separator_width;
|
||||
top_x = top_x * inv_cnv_w;
|
||||
}
|
||||
float top_y = 1.0f;
|
||||
|
||||
|
|
|
@ -102,10 +102,10 @@ private:
|
|||
{
|
||||
float scale{ 1.0f };
|
||||
float icons_size{ Default_Icons_Size };
|
||||
float border{ 5.0f };
|
||||
float gap_y{ 5.0f };
|
||||
float border{ 4.0f };
|
||||
float gap_y{ 4.0f };
|
||||
//BBS: GUI refactor: to support top layout
|
||||
float gap_x{ 5.0f };
|
||||
float gap_x{ 4.0f };
|
||||
float stride_x() const { return icons_size + gap_x;}
|
||||
float scaled_gap_x() const { return scale * gap_x; }
|
||||
float scaled_stride_x() const { return scale * stride_x(); }
|
||||
|
|
|
@ -7779,8 +7779,8 @@ bool Plater::priv::init_collapse_toolbar()
|
|||
collapse_toolbar.set_layout_type(GLToolbar::Layout::Vertical);
|
||||
collapse_toolbar.set_horizontal_orientation(GLToolbar::Layout::HO_Right);
|
||||
collapse_toolbar.set_vertical_orientation(GLToolbar::Layout::VO_Top);
|
||||
collapse_toolbar.set_border(5.0f);
|
||||
collapse_toolbar.set_separator_size(5);
|
||||
collapse_toolbar.set_border(4.0f);
|
||||
collapse_toolbar.set_separator_size(4);
|
||||
collapse_toolbar.set_gap_size(2);
|
||||
|
||||
collapse_toolbar.del_all_item();
|
||||
|
|
Loading…
Reference in a new issue