-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
RectangleSelector does not work if start and end points are identical #10075
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
Comments
I suspect that we missed half of the de-bounce logic (skip updating the state but do not skip running the callback). |
If I understand you correctly, you want to avoid running the callback if the mouse positition is identical at press and release time. That would change the behaviour as compared to version 1.4.2., though. There, when a "point" is selected instead of a rectangle, the callback is run with identical startpoint and endpoint coordinates. I use that in my code to differentiate between a real rectangle and a point. Actually, I found that useful in that I could invalidate a selected rectangle by just pressing and releasing the mouse without moving it in between. |
The docs need an update on this one too. If you have a rectangle ABCD then the line will draw from vertex A to C regardless where start and stop positions are. Anyway, this is the same problem with SpanSelector that I tried to highlight in #9660. Do you want the span to reset when there are no movement etc. Callbacks should be called regardsless of state change. It should be the user that implements the guard if necessary. For example:
|
Bug report
If in a RectangleSelector the mouse does not move between button press and button release, wrong values for start and end coordinates are returned. It seems to me that those coordinates correspond to the last callback where the mouse had been moved between press and release.
The following example code in the Matplotlib documentation illustrates the consequences:
**If you start with drawing a line, everything works fine. If you then move the mouse to a different point, click it and release it without moving, the previous line shows up again (and the old coordinates are printed to stdout). If you draw a line from upper left to lower right, the detached line makes weird movements.
The example program works correctly with Matplotlib version 1.4.2.
Matplotlib version
print(matplotlib.get_backend())
): qt5aggI installed matplotlib with miniconda from the default channel.
The text was updated successfully, but these errors were encountered: