@@ -461,28 +461,22 @@ def get_children(self):
461461 r"""Return a list of the child `.Artist`\s of this `.Artist`."""
462462 return []
463463
464- def _default_contains (self , mouseevent , figure = None ):
464+ def _different_canvas (self , event ):
465465 """
466- Base impl. for checking whether a mouseevent happened in an artist.
466+ Check whether an *event* occurred on a canvas other that this artist's canvas .
467467
468- 1. If the artist figure is known and the event did not occur in that
469- figure (by checking its ``canvas`` attribute), reject it.
470- 2. Otherwise, return `None, {}`, indicating that the subclass'
471- implementation should be used.
468+ If this method returns True, the event definitely occurred on a different
469+ canvas; if it returns False, either it occurred on the same canvas, or we may
470+ not have enough information to know.
472471
473- Subclasses should start their definition of `contains` as follows:
472+ Subclasses should start their definition of `contains` as follows::
474473
475- inside, info = self._default_contains(mouseevent)
476- if inside is not None:
477- return inside, info
474+ if self._different_canvas(mouseevent):
475+ return False, {}
478476 # subclass-specific implementation follows
479-
480- The *figure* kwarg is provided for the implementation of
481- `.Figure.contains`.
482477 """
483- if figure is not None and mouseevent .canvas is not figure .canvas :
484- return False , {}
485- return None , {}
478+ return (getattr (event , "canvas" , None ) is not None and self .figure is not None
479+ and event .canvas is not self .figure .canvas )
486480
487481 def contains (self , mouseevent ):
488482 """
0 commit comments