Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8761e0d

Browse files
authored
Merge pull request#30101 from meeseeksmachine/auto-backport-of-pr-30096-on-v3.10.x
2 parents9f08b50 +4b8e2a0 commit8761e0d

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

‎lib/matplotlib/offsetbox.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1506,7 +1506,9 @@ def __init__(self, ref_artist, use_blit=False):
15061506
@staticmethod
15071507
def_picker(artist,mouseevent):
15081508
# A custom picker to prevent dragging on mouse scroll events
1509-
return (artist.contains(mouseevent)andmouseevent.name!="scroll_event"), {}
1509+
ifmouseevent.name=="scroll_event":
1510+
returnFalse, {}
1511+
returnartist.contains(mouseevent)
15101512

15111513
# A property, not an attribute, to maintain picklability.
15121514
canvas=property(lambdaself:self.ref_artist.get_figure(root=True).canvas)

‎lib/matplotlib/tests/test_offsetbox.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,3 +460,13 @@ def test_draggable_in_subfigure():
460460
fig.canvas.draw()# Texts are non-pickable until the first draw.
461461
MouseEvent("button_press_event",fig.canvas,1,1)._process()
462462
assertann._draggable.got_artist
463+
# Stop dragging the annotation.
464+
MouseEvent("button_release_event",fig.canvas,1,1)._process()
465+
assertnotann._draggable.got_artist
466+
# A scroll event should not initiate a drag.
467+
MouseEvent("scroll_event",fig.canvas,1,1)._process()
468+
assertnotann._draggable.got_artist
469+
# An event outside the annotation should not initiate a drag.
470+
bbox=ann.get_window_extent()
471+
MouseEvent("button_press_event",fig.canvas,bbox.x1+2,bbox.y1+2)._process()
472+
assertnotann._draggable.got_artist

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp