Move Gizmo -> added movements using arrow keys:

Left arrow = decrease X by 1mm

Right arrow = increase X by 1mm

Up arrow = increase Y by 1mm

Down arrow = decrease Y by 1mm
This commit is contained in:
Enrico Turri 2020-02-03 14:39:16 +01:00
parent 73f69f3387
commit 9d55121695

View file

@ -497,7 +497,7 @@ bool GLGizmosManager::on_mouse(wxMouseEvent& evt)
processed = true;
}
else if (evt.Dragging() && (m_parent.get_move_volume_id() != -1) && (m_current == SlaSupports || m_current == Hollow))
// don't allow dragging objects with the Sla gizmo on
// don't allow dragging objects with the Sla gizmo on
processed = true;
else if (evt.Dragging() && (m_current == SlaSupports || m_current == Hollow) && gizmo_event(SLAGizmoEventType::Dragging, mouse_pos, evt.ShiftDown(), evt.AltDown(), evt.ControlDown()))
{
@ -554,12 +554,9 @@ bool GLGizmosManager::on_mouse(wxMouseEvent& evt)
else if (evt.LeftUp() && is_dragging())
{
switch (m_current) {
case Move : m_parent.do_move(L("Gizmo-Move"));
break;
case Scale : m_parent.do_scale(L("Gizmo-Scale"));
break;
case Rotate : m_parent.do_rotate(L("Gizmo-Rotate"));
break;
case Move : m_parent.do_move(L("Gizmo-Move")); break;
case Scale : m_parent.do_scale(L("Gizmo-Scale")); break;
case Rotate : m_parent.do_rotate(L("Gizmo-Rotate")); break;
default : break;
}
@ -776,6 +773,27 @@ bool GLGizmosManager::on_key(wxKeyEvent& evt)
processed = true;
}
}
else if (m_current == Move)
{
auto do_move = [this, &processed](const Vec3d& displacement) {
Selection& selection = m_parent.get_selection();
selection.start_dragging();
selection.translate(displacement);
wxGetApp().obj_manipul()->set_dirty();
m_parent.do_move(L("Gizmo-Move"));
m_parent.set_as_dirty();
processed = true;
};
switch (keyCode)
{
case WXK_NUMPAD_LEFT: case WXK_LEFT: { do_move(-Vec3d::UnitX()); break; }
case WXK_NUMPAD_RIGHT: case WXK_RIGHT: { do_move(Vec3d::UnitX()); break; }
case WXK_NUMPAD_UP: case WXK_UP: { do_move(Vec3d::UnitY()); break; }
case WXK_NUMPAD_DOWN: case WXK_DOWN: { do_move(-Vec3d::UnitY()); break; }
default: { break; }
}
}
// if (processed)
// m_parent.set_cursor(GLCanvas3D::Standard);