Skip to content

Commit

Permalink
Merge branch 'ign-gazebo3' into codecheck_fix_20201217
Browse files Browse the repository at this point in the history
  • Loading branch information
Nate Koenig committed Dec 17, 2020
2 parents ca53234 + 128e29d commit 75d0aa3
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/gui/plugins/scene3d/Scene3D.cc
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,9 @@ inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE {
/// \brief Flag to indicate whether the z key is currently being pressed
public: bool zPressed = false;

/// \brief Flag to indicate whether the escape key has been released.
public: bool escapeReleased = false;

/// \brief ID of thread where render calls can be made.
public: std::thread::id renderThreadId;

Expand Down Expand Up @@ -673,6 +676,17 @@ void IgnRenderer::Render()
}
}

// Escape action, clear all selections and terminate any
// spawned previews if escape button is released
{
if (this->dataPtr->escapeReleased)
{
this->DeselectAllEntities(true);
this->TerminateSpawnPreview();
this->dataPtr->escapeReleased = false;
}
}

if (ignition::gui::App())
{
gui::events::Render event;
Expand Down Expand Up @@ -957,6 +971,9 @@ void IgnRenderer::HandleKeyRelease(QKeyEvent *_e)
case Qt::Key_Z:
this->dataPtr->zPressed = false;
break;
case Qt::Key_Escape:
this->dataPtr->escapeReleased = true;
break;
default:
break;
}
Expand Down Expand Up @@ -2890,8 +2907,6 @@ void RenderWindowItem::HandleKeyRelease(QKeyEvent *_e)

_e->accept();
}
this->DeselectAllEntities(true);
this->dataPtr->renderThread->ignRenderer.TerminateSpawnPreview();
}
}

Expand Down

0 comments on commit 75d0aa3

Please sign in to comment.