Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/matplotlib/offsetbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -1650,6 +1650,7 @@ def finalize_offset(self):
def __init__(self, ref_artist, use_blit=False):
self.ref_artist = ref_artist
self.got_artist = False
self.got_other_artist = False

self.canvas = self.ref_artist.figure.canvas
self._use_blit = use_blit and self.canvas.supports_blit
Expand Down Expand Up @@ -1677,7 +1678,9 @@ def on_motion_blit(self, evt):
self.canvas.blit(self.ref_artist.figure.bbox)

def on_pick(self, evt):
if evt.artist == self.ref_artist:
if self.got_other_artist:
return
if self.got_artist or evt.artist == self.ref_artist:

self.mouse_x = evt.mouseevent.x
self.mouse_y = evt.mouseevent.y
Expand All @@ -1696,8 +1699,11 @@ def on_pick(self, evt):
self._c1 = self.canvas.mpl_connect('motion_notify_event',
self.on_motion)
self.save_offset()
else:
self.got_other_artist = True

def on_release(self, event):
self.got_other_artist = False
if self.got_artist:
self.finalize_offset()
self.got_artist = False
Expand Down