Skip to content

Commit 5ad52e9

Browse files
committed
Fix OffsetBox custom picker
As with the custom picker, `Artist.contains` returns a boolean and a dictionary in a tuple. This non-empty tuple is always true, so the custom picker would always return True for any non-scroll event. It would also lose the related dictionary.
1 parent a7c08c8 commit 5ad52e9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/matplotlib/offsetbox.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1504,7 +1504,9 @@ def __init__(self, ref_artist, use_blit=False):
15041504
@staticmethod
15051505
def _picker(artist, mouseevent):
15061506
# A custom picker to prevent dragging on mouse scroll events
1507-
return (artist.contains(mouseevent) and mouseevent.name != "scroll_event"), {}
1507+
if mouseevent.name != "scroll_event":
1508+
return artist.contains(mouseevent)
1509+
return False, {}
15081510

15091511
# A property, not an attribute, to maintain picklability.
15101512
canvas = property(lambda self: self.ref_artist.get_figure(root=True).canvas)

0 commit comments

Comments
 (0)