Skip to content

Commit 571c8bc

Browse files
committed
only forward pick events to children with the same axes instance as the pick event inaxes method
svn path=/trunk/matplotlib/; revision=7141
1 parent cd4b823 commit 571c8bc

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

lib/matplotlib/artist.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@
2424

2525

2626

27-
def allow_rasterization(draw):
27+
def allow_rasterization(draw):
2828
"""
2929
Decorator for Artist.draw method. Provides routines
3030
that run before and after the draw call. The before and after functions
3131
are useful for changing artist-dependant renderer attributes or making
3232
other setup function calls, such as starting and flushing a mixed-mode
33-
renderer.
33+
renderer.
3434
"""
3535
def before(artist, renderer):
3636
if artist.get_rasterized():
@@ -42,7 +42,7 @@ def after(artist, renderer):
4242

4343
# the axes class has a second argument inframe for its draw method.
4444
def draw_wrapper(artist, renderer, *kl):
45-
before(artist, renderer)
45+
before(artist, renderer)
4646
draw(artist, renderer, *kl)
4747
after(artist, renderer)
4848

@@ -52,7 +52,7 @@ def draw_wrapper(artist, renderer, *kl):
5252
draw_wrapper.__doc__ = draw.__doc__
5353
draw_wrapper._supports_rasterization = True
5454
return draw_wrapper
55-
55+
5656

5757
class Artist(object):
5858
"""
@@ -308,7 +308,10 @@ def pick(self, mouseevent):
308308

309309
# Pick children
310310
for a in self.get_children():
311-
a.pick(mouseevent)
311+
# make sure the event happened in the same axes
312+
ax = getattr(a, 'axes', None)
313+
if mouseevent.inaxes==ax:
314+
a.pick(mouseevent)
312315

313316
def set_picker(self, picker):
314317
"""
@@ -543,16 +546,16 @@ def _set_gc_clip(self, gc):
543546
else:
544547
gc.set_clip_rectangle(None)
545548
gc.set_clip_path(None)
546-
549+
547550
def get_rasterized(self):
548551
return self._rasterized
549-
552+
550553
def set_rasterized(self, rasterized):
551554
"""
552555
Force rasterized (bitmap) drawing in vector backend output.
553-
556+
554557
Defaults to None, which implies the backend's default behavior
555-
558+
556559
ACCEPTS: [True | False | None]
557560
"""
558561
if rasterized and not hasattr(self.draw, "_supports_rasterization"):

0 commit comments

Comments
 (0)