Skip to content

Commit

Permalink
Allow continouos dragging
Browse files Browse the repository at this point in the history
  • Loading branch information
rhaschke committed Apr 25, 2024
1 parent 8469d18 commit b55497d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/rviz/image/mouse_click.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ void MouseClick::disable()

bool MouseClick::eventFilter(QObject* obj, QEvent* event)
{
if (publisher_.operator void*() && event->type() == QEvent::MouseButtonPress)
if (publisher_.operator void*() &&
(event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseMove))
{
QMouseEvent* me = static_cast<QMouseEvent*>(event);
QPointF windowPos = me->windowPos();
bool left_button = me->buttons() == Qt::LeftButton;

if (img_width_ != 0 && img_height_ != 0 && win_width_ != 0 && win_height_ != 0)
if (left_button && img_width_ != 0 && img_height_ != 0 && win_width_ != 0 && win_height_ != 0)
{
float img_aspect = float(img_width_) / float(img_height_);
float win_aspect = float(win_width_) / float(win_height_);
Expand Down

0 comments on commit b55497d

Please sign in to comment.