From c74ac8a6c342dd3883b4c42910266ee2476333a3 Mon Sep 17 00:00:00 2001 From: Ian Bassi Date: Tue, 6 Oct 2026 11:36:47 -0300 Subject: [PATCH] Keep FPS/timings overlay below the toolbar on narrow canvases (#16215) --- src/slic3r/GUI/GLCanvas3D.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 9c2fca1957..e9724f41ed 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -7970,9 +7970,16 @@ void GLCanvas3D::_render_fps_overlay(int fps) const const float margin = 10.0f * get_scale(); const ImVec2 display_size = ImGui::GetIO().DisplaySize; ImVec2 pos(display_size.x - margin, margin); + // Last frame's size; zero until the overlay has been shown once. + const ImGuiWindow* self = ImGui::FindWindowByName("###fps_overlay"); + const float left = pos.x - (self != nullptr ? self->Size.x : 0.0f); // The Preview legend takes the top-right corner. if (const ImGuiWindow* legend = ImGui::FindWindowByName("Legend"); m_canvas_type == ECanvasType::CanvasPreview && legend != nullptr && legend->Active) pos = ImVec2(legend->Pos.x - margin, legend->Pos.y); + // The toolbar row can reach the corner on a narrow canvas; stack the overlay below it then. + else if (m_main_toolbar.is_enabled() && + get_main_toolbar_offset() + m_main_toolbar.get_width() + m_separator_toolbar.get_width() + m_gizmos.get_scaled_total_width() + m_assemble_view_toolbar.get_width() > left) + pos.y = std::max(m_main_toolbar.get_height(), m_gizmos.get_scaled_total_height()) + margin; ImGui::SetNextWindowPos(pos, ImGuiCond_Always, ImVec2(1.0f, 0.0f)); ImGui::SetNextWindowBgAlpha(0.35f); ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 8.0f * get_scale());