From b55497d5c3929031aa9342bda47588421d09c968 Mon Sep 17 00:00:00 2001 From: Robert Haschke Date: Thu, 25 Apr 2024 11:45:35 +0200 Subject: [PATCH] Allow continouos dragging --- src/rviz/image/mouse_click.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/rviz/image/mouse_click.cpp b/src/rviz/image/mouse_click.cpp index 9eb63c0b1..447471b59 100644 --- a/src/rviz/image/mouse_click.cpp +++ b/src/rviz/image/mouse_click.cpp @@ -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(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_);