Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 282ef47

Browse files
authored
Merge pull request #29858 from meeseeksmachine/auto-backport-of-pr-29842-on-v3.10.x
2 parents ba588a5 + b29bd15 commit 282ef47

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/matplotlib/offsetbox.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1488,7 +1488,7 @@ def finalize_offset(self):
14881488
def __init__(self, ref_artist, use_blit=False):
14891489
self.ref_artist = ref_artist
14901490
if not ref_artist.pickable():
1491-
ref_artist.set_picker(True)
1491+
ref_artist.set_picker(self._picker)
14921492
self.got_artist = False
14931493
self._use_blit = use_blit and self.canvas.supports_blit
14941494
callbacks = self.canvas.callbacks
@@ -1502,6 +1502,11 @@ def __init__(self, ref_artist, use_blit=False):
15021502
]
15031503
]
15041504

1505+
@staticmethod
1506+
def _picker(artist, mouseevent):
1507+
# A custom picker to prevent dragging on mouse scroll events
1508+
return (artist.contains(mouseevent) and mouseevent.name != "scroll_event"), {}
1509+
15051510
# A property, not an attribute, to maintain picklability.
15061511
canvas = property(lambda self: self.ref_artist.get_figure(root=True).canvas)
15071512
cids = property(lambda self: [

0 commit comments

Comments
 (0)