Force canvas resize when switching between views

This commit is contained in:
Enrico Turri 2019-03-05 10:54:03 +01:00
parent de06db7989
commit 2c99fd35d3
3 changed files with 8 additions and 6 deletions

View File

@ -5137,11 +5137,13 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
auto *top_level_wnd = dynamic_cast<wxTopLevelWindow*>(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<double>();
// 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<double>();
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

View File

@ -165,7 +165,7 @@ bool GLTexture::load_from_svg_files_as_sprites_array(const std::vector<std::stri
}
int state_offset_px = sprite_offset_px + state_id * sprite_size_px;
for (int j = 0; j < sprite_size_px; ++j)
for (int j = 0; j < (int)sprite_size_px; ++j)
{
::memcpy((void*)&data.data()[(state_offset_px + j * m_width) * 4], (const void*)&output_data.data()[j * sprite_stride], sprite_stride);
}

View File

@ -1014,8 +1014,8 @@ struct Plater::priv
Slic3r::GCodePreviewData gcode_preview_data;
// GUI elements
wxSizer* panel_sizer;
wxPanel* current_panel;
wxSizer* panel_sizer{ nullptr };
wxPanel* current_panel{ nullptr };
std::vector<wxPanel*> panels;
Sidebar *sidebar;
Bed3D bed;