From 2c99fd35d38934604c8976aa4b499c80c3eea7b6 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Tue, 5 Mar 2019 10:54:03 +0100 Subject: [PATCH] Force canvas resize when switching between views --- src/slic3r/GUI/GLCanvas3D.cpp | 8 +++++--- src/slic3r/GUI/GLTexture.cpp | 2 +- src/slic3r/GUI/Plater.cpp | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 9a8b6c469..2f7d1a5c5 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -5137,11 +5137,13 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) auto *top_level_wnd = dynamic_cast(p); if (top_level_wnd && top_level_wnd->IsActive()) m_canvas->SetFocus(); - // forces a frame render to ensure that m_hover_volume_id is updated even when the user right clicks while + m_mouse.position = pos.cast(); + // 1) forces a frame render to ensure that m_hover_volume_id is updated even when the user right clicks while // the context menu is shown, ensuring it to disappear if the mouse is outside any volume and to // change the volume hover state if any is under the mouse - m_mouse.position = pos.cast(); - render(); + // 2) when switching between 3d view and preview the size of the canvas changes if the side panels are visible, + // so forces a resize to avoid multiple renders with different sizes (seen as flickering) + _refresh_if_shown_on_screen(); } m_mouse.set_start_position_2D_as_invalid(); //#endif diff --git a/src/slic3r/GUI/GLTexture.cpp b/src/slic3r/GUI/GLTexture.cpp index ab83d8051..b48ca2044 100644 --- a/src/slic3r/GUI/GLTexture.cpp +++ b/src/slic3r/GUI/GLTexture.cpp @@ -165,7 +165,7 @@ bool GLTexture::load_from_svg_files_as_sprites_array(const std::vector panels; Sidebar *sidebar; Bed3D bed;