From 3371fa42daae024e15ccb31bec84f0fae1431618 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Tue, 4 Feb 2020 09:32:09 +0100 Subject: [PATCH] Follow-up of e042cab8faaeb47da363314839236071003c6083 -> Avoid polluting undo/redo stack --- src/slic3r/GUI/Gizmos/GLGizmosManager.cpp | 54 ++++++++++++++++++++++- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp index 4e4f716f4..8e2923cac 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp @@ -776,6 +776,56 @@ bool GLGizmosManager::on_key(wxKeyEvent& evt) processed = true; } } + else if (m_current == Move) + { + switch (keyCode) + { + case WXK_NUMPAD_LEFT: case WXK_LEFT: + case WXK_NUMPAD_RIGHT: case WXK_RIGHT: + case WXK_NUMPAD_UP: case WXK_UP: + case WXK_NUMPAD_DOWN: case WXK_DOWN: + { + m_parent.do_move(L("Gizmo-Move")); + stop_dragging(); + update_data(); + + wxGetApp().obj_manipul()->set_dirty(); + // Let the plater know that the dragging finished, so a delayed refresh + // of the scene with the background processing data should be performed. + m_parent.post_event(SimpleEvent(EVT_GLCANVAS_MOUSE_DRAGGING_FINISHED)); + // updates camera target constraints + m_parent.refresh_camera_scene_box(); + processed = true; + + break; + } + default: { break; } + } + } + else if (m_current == Rotate) + { + switch (keyCode) + { + case WXK_NUMPAD_LEFT: case WXK_LEFT: + case WXK_NUMPAD_RIGHT: case WXK_RIGHT: + { + m_parent.do_rotate(L("Gizmo-Rotate")); + stop_dragging(); + update_data(); + + wxGetApp().obj_manipul()->set_dirty(); + // Let the plater know that the dragging finished, so a delayed refresh + // of the scene with the background processing data should be performed. + m_parent.post_event(SimpleEvent(EVT_GLCANVAS_MOUSE_DRAGGING_FINISHED)); + // updates camera target constraints + m_parent.refresh_camera_scene_box(); + processed = true; + + break; + } + default: { break; } + } + } // if (processed) // m_parent.set_cursor(GLCanvas3D::Standard); @@ -793,9 +843,9 @@ bool GLGizmosManager::on_key(wxKeyEvent& evt) auto do_move = [this, &processed](const Vec3d& displacement) { Selection& selection = m_parent.get_selection(); selection.start_dragging(); + start_dragging(); selection.translate(displacement); wxGetApp().obj_manipul()->set_dirty(); - m_parent.do_move(L("Gizmo-Move")); processed = true; }; @@ -813,9 +863,9 @@ bool GLGizmosManager::on_key(wxKeyEvent& evt) auto do_rotate = [this, &processed](const Vec3d& rotation) { Selection& selection = m_parent.get_selection(); selection.start_dragging(); + start_dragging(); selection.rotate(rotation, TransformationType(TransformationType::World_Relative_Joint)); wxGetApp().obj_manipul()->set_dirty(); - m_parent.do_rotate(L("Gizmo-Rotate")); processed = true; };