From 143c23c54a971aa3ade1e13ea4f487d98be61dee Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Thu, 18 Oct 2018 08:51:06 +0200 Subject: [PATCH] New selection -> Force volume selection when right clicking to get the object context menu --- src/slic3r/GUI/GLCanvas3D.cpp | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 813d10f7c..e8c79b176 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -3949,7 +3949,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) #endif // ENABLE_EXTENDED_SELECTION { #if ENABLE_EXTENDED_SELECTION - if (m_hover_volume_id != -1) + if (evt.LeftDown() && (m_hover_volume_id != -1)) { if (evt.ControlDown()) m_selection.remove(m_hover_volume_id); @@ -4043,13 +4043,24 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) render(); if (m_hover_volume_id != -1) { - // if right clicking on volume, propagate event through callback (shows context menu) #if ENABLE_EXTENDED_SELECTION - if (m_volumes.volumes[m_hover_volume_id]->hover) -#else - if (m_volumes.volumes[volume_idx]->hover) -#endif // ENABLE_EXTENDED_SELECTION + // if right clicking on volume, propagate event through callback (shows context menu) + if (m_volumes.volumes[m_hover_volume_id]->hover && !m_volumes.volumes[m_hover_volume_id]->is_wipe_tower) + { + // forces the selection of the volume + m_selection.add(m_hover_volume_id); + m_gizmos.update_on_off_state(m_selection); + update_gizmos_data(); + wxGetApp().obj_manipul()->update_settings_value(m_selection); + // forces a frame render to update the view before the context menu is shown + render(); post_event(Vec2dEvent(EVT_GLCANVAS_RIGHT_CLICK, pos.cast())); + } +#else + // if right clicking on volume, propagate event through callback (shows context menu) + if (m_volumes.volumes[volume_idx]->hover) + post_event(Vec2dEvent(EVT_GLCANVAS_RIGHT_CLICK, pos.cast())); +#endif // ENABLE_EXTENDED_SELECTION } } }