diff --git a/lib/matplotlib/offsetbox.py b/lib/matplotlib/offsetbox.py index 6a3a122fc3e7..09fede27e99d 100644 --- a/lib/matplotlib/offsetbox.py +++ b/lib/matplotlib/offsetbox.py @@ -1504,7 +1504,9 @@ def __init__(self, ref_artist, use_blit=False): @staticmethod def _picker(artist, mouseevent): # A custom picker to prevent dragging on mouse scroll events - return (artist.contains(mouseevent) and mouseevent.name != "scroll_event"), {} + if mouseevent.name != "scroll_event": + return artist.contains(mouseevent) + return False, {} # A property, not an attribute, to maintain picklability. canvas = property(lambda self: self.ref_artist.get_figure(root=True).canvas)