Skip to content

Commit

Permalink
Add "R" key as shortcut for resetTime (#1088)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulerikf authored Dec 20, 2023
1 parent de5e84f commit bb2ab95
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion rviz2/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,8 @@ Clock" (aka real) time has passed.

The time panel also lets you reset the visualizer's internal time
state -- this causes a reset of all the displays, as well as a reset
of tf's internal cache of data.
of tf's internal cache of data. The keyboard shortcut for this "reset"
functionality is "r".

.. image:: time-panel.png

Expand Down
10 changes: 10 additions & 0 deletions rviz_common/src/rviz_common/view_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#include "rviz_common/properties/float_property.hpp"
#include "rviz_common/interaction/view_picker_iface.hpp"
#include "rviz_common/render_panel.hpp"
#include "rviz_common/visualization_manager.hpp"

namespace rviz_common
{
Expand Down Expand Up @@ -232,6 +233,15 @@ void ViewController::handleKeyEvent(QKeyEvent * event, RenderPanel * panel)
if (event->key() == Qt::Key_Z) {
reset();
}

if (event->key() == Qt::Key_R) {
rviz_common::VisualizationManager * vis_manager =
dynamic_cast<rviz_common::VisualizationManager *>(context_);

if (vis_manager != nullptr) {
vis_manager->resetTime();
}
}
}

void ViewController::setCursor(CursorType cursor_type)
Expand Down

0 comments on commit bb2ab95

Please sign in to comment.