Follow-up of e042cab8fa -> Avoid polluting undo/redo stack

This commit is contained in:
Enrico Turri 2020-02-04 09:32:09 +01:00
parent d320a03c54
commit 3371fa42da

View file

@ -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;
};