Handling of gizmos related key events moved into new method GLGizmosManager::on_key()

This commit is contained in:
Enrico Turri 2019-03-26 14:38:30 +01:00
parent 52f11a6f0d
commit 47c39f51e5
3 changed files with 35 additions and 13 deletions

View file

@ -660,7 +660,6 @@ bool GLGizmosManager::on_char(wxKeyEvent& evt, GLCanvas3D& canvas)
int keyCode = evt.GetKeyCode();
int ctrlMask = wxMOD_CONTROL;
const Selection& selection = canvas.get_selection();
bool processed = false;
if ((evt.GetModifiers() & ctrlMask) != 0)
@ -732,7 +731,7 @@ bool GLGizmosManager::on_char(wxKeyEvent& evt, GLCanvas3D& canvas)
if (!processed)
{
if (handle_shortcut(keyCode, selection))
if (handle_shortcut(keyCode, canvas.get_selection()))
{
canvas.update_gizmos_data();
processed = true;
@ -745,6 +744,24 @@ bool GLGizmosManager::on_char(wxKeyEvent& evt, GLCanvas3D& canvas)
return processed;
}
bool GLGizmosManager::on_key(wxKeyEvent& evt, GLCanvas3D& canvas)
{
const int keyCode = evt.GetKeyCode();
bool processed = false;
if (evt.GetEventType() == wxEVT_KEY_UP)
{
if ((m_current == SlaSupports) && (keyCode == WXK_SHIFT) && gizmo_event(SLAGizmoEventType::ShiftUp))
// shift has been just released - SLA gizmo might want to close rectangular selection.
processed = true;
}
if (processed)
canvas.set_as_dirty();
return processed;
}
void GLGizmosManager::reset()
{
for (GizmosMap::value_type& gizmo : m_gizmos)