mirror of
https://git.mirrors.martin98.com/https://github.com/bambulab/BambuStudio.git
synced 2025-09-28 21:03:12 +08:00
FIX:Supplementary case: Display with a smaller interface
jira: STUDIO-11623 Change-Id: I32c5e3775077cf93e3f2258c390d3697de3783de
This commit is contained in:
parent
d6eeceb20c
commit
6c19637d46
@ -2116,11 +2116,15 @@ int GLCanvas3D::get_main_toolbar_offset() const
|
|||||||
if (cnv_width < toolbar_total_width) {
|
if (cnv_width < toolbar_total_width) {
|
||||||
return is_collapse_toolbar_on_left() ? collapse_toolbar_width : 0;
|
return is_collapse_toolbar_on_left() ? collapse_toolbar_width : 0;
|
||||||
} else {
|
} else {
|
||||||
const float offset = (cnv_width - toolbar_total_width) / 2;
|
const float offset = (cnv_width - toolbar_total_width) / 2.f;
|
||||||
return is_collapse_toolbar_on_left() ? offset + collapse_toolbar_width : offset;
|
return is_collapse_toolbar_on_left() ? offset + collapse_toolbar_width : offset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float GLCanvas3D::get_main_toolbar_left(int cnv_width,float inv_zoom) const {
|
||||||
|
return (-0.5f * cnv_width + get_main_toolbar_offset()) * inv_zoom;
|
||||||
|
}
|
||||||
|
|
||||||
bool GLCanvas3D::is_collapse_toolbar_on_left() const
|
bool GLCanvas3D::is_collapse_toolbar_on_left() const
|
||||||
{
|
{
|
||||||
auto state = wxGetApp().plater()->get_sidebar_docking_state();
|
auto state = wxGetApp().plater()->get_sidebar_docking_state();
|
||||||
@ -7932,13 +7936,8 @@ void GLCanvas3D::_render_main_toolbar()
|
|||||||
float inv_zoom = (float)get_active_camera().get_inv_zoom();
|
float inv_zoom = (float)get_active_camera().get_inv_zoom();
|
||||||
|
|
||||||
#if BBS_TOOLBAR_ON_TOP
|
#if BBS_TOOLBAR_ON_TOP
|
||||||
GLToolbar& collapse_toolbar = wxGetApp().plater()->get_collapse_toolbar();
|
|
||||||
float collapse_toolbar_width = collapse_toolbar.is_enabled() ? collapse_toolbar.get_width() : 0.0f;
|
|
||||||
float gizmo_width = m_gizmos.get_scaled_total_width();
|
|
||||||
float assemble_width = m_assemble_view_toolbar.get_width();
|
|
||||||
float separator_width = m_separator_toolbar.get_width();
|
|
||||||
float top = 0.5f * (float)cnv_size.get_height() * inv_zoom;
|
float top = 0.5f * (float)cnv_size.get_height() * inv_zoom;
|
||||||
float left = std::max(-0.5f * cnv_size.get_width(), -0.5f * (m_main_toolbar.get_width() + separator_width + gizmo_width + assemble_width - collapse_toolbar_width)) * inv_zoom;
|
float left = get_main_toolbar_left(cnv_size.get_width(),inv_zoom);
|
||||||
#else
|
#else
|
||||||
float gizmo_height = m_gizmos.get_scaled_total_height();
|
float gizmo_height = m_gizmos.get_scaled_total_height();
|
||||||
float space_height = GLGizmosManager::Default_Icons_Size * wxGetApp().toolbar_icon_scale();
|
float space_height = GLGizmosManager::Default_Icons_Size * wxGetApp().toolbar_icon_scale();
|
||||||
@ -8314,15 +8313,11 @@ void GLCanvas3D::_render_assemble_view_toolbar() const
|
|||||||
float inv_zoom = (float)get_active_camera().get_inv_zoom();
|
float inv_zoom = (float)get_active_camera().get_inv_zoom();
|
||||||
|
|
||||||
#if BBS_TOOLBAR_ON_TOP
|
#if BBS_TOOLBAR_ON_TOP
|
||||||
GLToolbar& collapse_toolbar = wxGetApp().plater()->get_collapse_toolbar();
|
const float separator_width = m_separator_toolbar.get_width();
|
||||||
float collapse_toolbar_width = collapse_toolbar.is_enabled() ? collapse_toolbar.get_width() : 0.0f;
|
|
||||||
float gizmo_width = m_gizmos.get_scaled_total_width();
|
float gizmo_width = m_gizmos.get_scaled_total_width();
|
||||||
float assemble_width = m_assemble_view_toolbar.get_width();
|
|
||||||
float separator_width = m_separator_toolbar.get_width();
|
|
||||||
float top = 0.5f * (float)cnv_size.get_height() * inv_zoom;
|
float top = 0.5f * (float)cnv_size.get_height() * inv_zoom;
|
||||||
float main_toolbar_left = std::max(-0.5f * cnv_size.get_width(), -0.5f * (m_main_toolbar.get_width() + gizmo_width + assemble_width - separator_width - collapse_toolbar_width)) * inv_zoom;
|
float main_toolbar_left = get_main_toolbar_left(cnv_size.get_width(), inv_zoom);
|
||||||
float left = main_toolbar_left + (m_main_toolbar.get_width() + gizmo_width) * inv_zoom;
|
float left = main_toolbar_left + (m_main_toolbar.get_width() + gizmo_width + separator_width) * inv_zoom;
|
||||||
//float left = 0.5f * (m_main_toolbar.get_width() + gizmo_width - m_assemble_view_toolbar.get_width() + collapse_toolbar_width) * inv_zoom;
|
|
||||||
#else
|
#else
|
||||||
float gizmo_height = m_gizmos.get_scaled_total_height();
|
float gizmo_height = m_gizmos.get_scaled_total_height();
|
||||||
//float space_height = GLGizmosManager::Default_Icons_Size * wxGetApp().toolbar_icon_scale();
|
//float space_height = GLGizmosManager::Default_Icons_Size * wxGetApp().toolbar_icon_scale();
|
||||||
@ -8494,8 +8489,8 @@ void GLCanvas3D::_render_separator_toolbar_right() const
|
|||||||
float assemble_width = m_assemble_view_toolbar.get_width();
|
float assemble_width = m_assemble_view_toolbar.get_width();
|
||||||
float separator_width = m_separator_toolbar.get_width();
|
float separator_width = m_separator_toolbar.get_width();
|
||||||
float top = 0.5f * (float)cnv_size.get_height() * inv_zoom;
|
float top = 0.5f * (float)cnv_size.get_height() * inv_zoom;
|
||||||
float main_toolbar_left = std::max(-0.5f * cnv_size.get_width(), -0.5f * (m_main_toolbar.get_width() + gizmo_width + assemble_width - collapse_toolbar_width)) * inv_zoom;
|
float main_toolbar_left = get_main_toolbar_left(cnv_size.get_width(), inv_zoom);
|
||||||
float left = main_toolbar_left + (m_main_toolbar.get_width() + gizmo_width) * inv_zoom;
|
float left = main_toolbar_left + (m_main_toolbar.get_width() + gizmo_width + 0.5 * separator_width) * inv_zoom;
|
||||||
|
|
||||||
m_separator_toolbar.set_position(top, left);
|
m_separator_toolbar.set_position(top, left);
|
||||||
m_separator_toolbar.render(*this,GLToolbarItem::SeparatorLine);
|
m_separator_toolbar.render(*this,GLToolbarItem::SeparatorLine);
|
||||||
@ -8508,14 +8503,9 @@ void GLCanvas3D::_render_separator_toolbar_left() const
|
|||||||
|
|
||||||
Size cnv_size = get_canvas_size();
|
Size cnv_size = get_canvas_size();
|
||||||
float inv_zoom = (float)get_active_camera().get_inv_zoom();
|
float inv_zoom = (float)get_active_camera().get_inv_zoom();
|
||||||
|
|
||||||
GLToolbar& collapse_toolbar = wxGetApp().plater()->get_collapse_toolbar();
|
|
||||||
float collapse_toolbar_width = collapse_toolbar.is_enabled() ? collapse_toolbar.get_width() : 0.0f;
|
|
||||||
float gizmo_width = m_gizmos.get_scaled_total_width();
|
|
||||||
float assemble_width = m_assemble_view_toolbar.get_width();
|
|
||||||
float separator_width = m_separator_toolbar.get_width();
|
float separator_width = m_separator_toolbar.get_width();
|
||||||
float top = 0.5f * (float)cnv_size.get_height() * inv_zoom;
|
float top = 0.5f * (float)cnv_size.get_height() * inv_zoom;
|
||||||
float main_toolbar_left = std::max(-0.5f * cnv_size.get_width(), -0.5f * (m_main_toolbar.get_width() + gizmo_width + assemble_width + separator_width - collapse_toolbar_width)) * inv_zoom;
|
float main_toolbar_left = get_main_toolbar_left(cnv_size.get_width(), inv_zoom);
|
||||||
float left = main_toolbar_left + (m_main_toolbar.get_width()) * inv_zoom;
|
float left = main_toolbar_left + (m_main_toolbar.get_width()) * inv_zoom;
|
||||||
|
|
||||||
m_separator_toolbar.set_position(top, left);
|
m_separator_toolbar.set_position(top, left);
|
||||||
@ -8524,6 +8514,11 @@ void GLCanvas3D::_render_separator_toolbar_left() const
|
|||||||
|
|
||||||
void GLCanvas3D::_render_collapse_toolbar() const
|
void GLCanvas3D::_render_collapse_toolbar() const
|
||||||
{
|
{
|
||||||
|
auto & plater = *wxGetApp().plater();
|
||||||
|
const auto sidebar_docking_dir = plater.get_sidebar_docking_state();
|
||||||
|
if (sidebar_docking_dir == Sidebar::None) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
GLToolbar& collapse_toolbar = wxGetApp().plater()->get_collapse_toolbar();
|
GLToolbar& collapse_toolbar = wxGetApp().plater()->get_collapse_toolbar();
|
||||||
|
|
||||||
Size cnv_size = get_canvas_size();
|
Size cnv_size = get_canvas_size();
|
||||||
|
@ -911,6 +911,7 @@ public:
|
|||||||
void select_plate();
|
void select_plate();
|
||||||
//BBS: GUI refactor: GLToolbar&&gizmo
|
//BBS: GUI refactor: GLToolbar&&gizmo
|
||||||
int get_main_toolbar_offset() const;
|
int get_main_toolbar_offset() const;
|
||||||
|
float get_main_toolbar_left(int cnv_width,float inv_zoom) const;
|
||||||
int get_main_toolbar_height() const { return m_main_toolbar.get_height(); }
|
int get_main_toolbar_height() const { return m_main_toolbar.get_height(); }
|
||||||
int get_main_toolbar_width() const { return m_main_toolbar.get_width(); }
|
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_width() const { return m_assemble_view_toolbar.get_width(); }
|
||||||
|
@ -1634,12 +1634,13 @@ void GLGizmosManager::do_render_overlay() const
|
|||||||
float main_toolbar_width = (float)m_parent.get_main_toolbar_width();
|
float main_toolbar_width = (float)m_parent.get_main_toolbar_width();
|
||||||
float assemble_view_width = (float)m_parent.get_assemble_view_toolbar_width();
|
float assemble_view_width = (float)m_parent.get_assemble_view_toolbar_width();
|
||||||
float collapse_width = (float)m_parent.get_collapse_toolbar_width();
|
float collapse_width = (float)m_parent.get_collapse_toolbar_width();
|
||||||
|
float separator_width = m_parent.get_separator_toolbar_width();
|
||||||
//float space_width = GLGizmosManager::Default_Icons_Size * wxGetApp().toolbar_icon_scale();
|
//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 zoomed_top_x = 0.5f *(cnv_w + main_toolbar_width - 2 * space_width - width) * inv_zoom;
|
||||||
|
|
||||||
float main_toolbar_left = std::max(-0.5f * cnv_w, -0.5f * (main_toolbar_width + get_scaled_total_width() + assemble_view_width - collapse_width)) * inv_zoom;
|
float main_toolbar_left = m_parent.get_main_toolbar_left(cnv_w, inv_zoom);
|
||||||
//float zoomed_top_x = 0.5f *(main_toolbar_width + collapse_width - width - assemble_view_width) * inv_zoom;
|
//float zoomed_top_x = 0.5f *(main_toolbar_width + collapse_width - width - assemble_view_width) * inv_zoom;
|
||||||
zoomed_top_x = main_toolbar_left + (main_toolbar_width)*inv_zoom;
|
zoomed_top_x = main_toolbar_left + (main_toolbar_width + separator_width /2.f) * inv_zoom;
|
||||||
}
|
}
|
||||||
float zoomed_top_y = 0.5f * cnv_h * inv_zoom;
|
float zoomed_top_y = 0.5f * cnv_h * inv_zoom;
|
||||||
#else
|
#else
|
||||||
|
@ -4467,7 +4467,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Hide sidebar initially, will re-show it after initialization when we got proper window size
|
// Hide sidebar initially, will re-show it after initialization when we got proper window size
|
||||||
sidebar.Hide();
|
//sidebar.Hide();
|
||||||
m_aui_mgr.Update();
|
m_aui_mgr.Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5001,7 +5001,8 @@ void Plater::priv::select_next_view_3D()
|
|||||||
|
|
||||||
void Plater::priv::enable_sidebar(bool enabled)
|
void Plater::priv::enable_sidebar(bool enabled)
|
||||||
{
|
{
|
||||||
if (q->m_only_gcode) enabled = false;
|
if (q->m_only_gcode)
|
||||||
|
enabled = false;
|
||||||
|
|
||||||
sidebar_layout.is_enabled = enabled;
|
sidebar_layout.is_enabled = enabled;
|
||||||
update_sidebar();
|
update_sidebar();
|
||||||
@ -8093,11 +8094,12 @@ void Plater::priv::set_current_panel(wxPanel* panel, bool no_slice)
|
|||||||
|
|
||||||
preview->set_as_dirty();
|
preview->set_as_dirty();
|
||||||
};
|
};
|
||||||
|
// Add sidebar and toolbar collapse logic
|
||||||
//BBS: add the collapse logic
|
if (panel == view3D || panel == preview) {
|
||||||
|
this->enable_sidebar(!q->only_gcode_mode());
|
||||||
|
}
|
||||||
if (panel == preview) {
|
if (panel == preview) {
|
||||||
if (q->only_gcode_mode()) {
|
if (q->only_gcode_mode()) {
|
||||||
this->sidebar->collapse(true);
|
|
||||||
preview->get_canvas3d()->enable_select_plate_toolbar(false);
|
preview->get_canvas3d()->enable_select_plate_toolbar(false);
|
||||||
} else if (q->using_exported_file() && (q->m_valid_plates_count <= 1)) {
|
} else if (q->using_exported_file() && (q->m_valid_plates_count <= 1)) {
|
||||||
preview->get_canvas3d()->enable_select_plate_toolbar(false);
|
preview->get_canvas3d()->enable_select_plate_toolbar(false);
|
||||||
@ -8156,7 +8158,7 @@ void Plater::priv::set_current_panel(wxPanel* panel, bool no_slice)
|
|||||||
p->Hide();
|
p->Hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_aui_mgr.Update();
|
update_sidebar(true);
|
||||||
|
|
||||||
if (wxGetApp().plater()) {
|
if (wxGetApp().plater()) {
|
||||||
Camera& cam = wxGetApp().plater()->get_camera();
|
Camera& cam = wxGetApp().plater()->get_camera();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user