Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some Mouse Events not Captured After Drag and Drop #716

Closed
Bartimaeus- opened this issue Aug 5, 2022 · 1 comment
Closed

Some Mouse Events not Captured After Drag and Drop #716

Bartimaeus- opened this issue Aug 5, 2022 · 1 comment

Comments

@Bartimaeus-
Copy link
Contributor

Bartimaeus- commented Aug 5, 2022

Edit: some of the content here incorrectly describes the behavior of what was happening. See #717

Summary
Some mouse events are not handled by most plot widgets after one or more curves are added to an empty plot widget

Setup
-Open a new plot widget (Plot 2)
-Add curve(s) to Plot 2

Issue
-After curve added to Plot 2, some mouse events (right/left/middle-click) are not handled by Plot 1 (mouse scroll wheel events are still handled ). Only the plot widget itself seems to have this issue-- the plot toolbar and plot legend are not impacted

Mouse event handling in the other open plots is restored after any of the following occurs:
-A mouse event occurs in any other part of PlotJuggler besides Plot 1's plotting area. This includes Plot 2 (which is handled)
-The zoom changes in Plot 1 using a mouse scroll wheel event
-The mouse moves over any of the green shaded region indicated in the figure below

image

Other Notes:
-Only verified on Windows (Linux not checked)
-Behavior is present at least back to 3.5.0 release (earlier versions not checked)

@Bartimaeus-
Copy link
Contributor Author

Bartimaeus- commented Aug 6, 2022

Edit: some of the content here incorrectly describes the behavior of what was happening. See #717

I've figured out how to fix most of this by clearing the drag info and curves after a mouse button release event:

(snippet from canvasEventFilter() in plotwidget.cpp)

    case QEvent::MouseButtonRelease: {
      if (_dragging.mode == DragInfo::NONE)
      {
        QApplication::restoreOverrideCursor();
        return false;
      }
      _dragging.mode = DragInfo::NONE;     // new line added
      _dragging.curves.clear();    // new line added
    }

While testing this solution I found this fixes everything except for the first plotwidget. This is somehow due to _dragging.mode not getting reset to DrafInfo::NONE

To demonstrate the issue, I've added the following code:

    case QEvent::MouseButtonPress: {
      if (_dragging.mode != DragInfo::NONE)
      {
          QMessageBox::warning(qwtPlot(), "Drag in process",    // (this is the code that was added)
                               tr("Mouse button press event but there's a drag in process!"));
          return true;  // don't pass to canvas().  (this code was already present)
      }

You can see in the video below that after a drag and drop event onto the upper right plot that panning works as intended on the bottom curve. If I try to do the pan on the upper left plot (which was the first plotwidget that existed on the tab) that the warning popup message I added is triggered and the panning event doesn't occur:

plotjuggler_Issue-716_panning_debugging.mp4

This also applies to other button events

Bartimaeus- added a commit to Bartimaeus-/PlotJuggler that referenced this issue Aug 6, 2022
@Bartimaeus- Bartimaeus- changed the title Some Mouse Events not Captured After Curve(s) Added to Empty Plot Some Mouse Events not Captured After Drag and Drop Aug 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants