diff --git a/doc/users/next_whats_new/2017-11-24_figurecanvas_inaxes.rst b/doc/users/next_whats_new/2017-11-24_figurecanvas_inaxes.rst deleted file mode 100644 index 6de6f8a7740d..000000000000 --- a/doc/users/next_whats_new/2017-11-24_figurecanvas_inaxes.rst +++ /dev/null @@ -1,6 +0,0 @@ - -Add ``inaxes`` method to FigureCanvas -------------------------------------------------------------- - -The `FigureCanvas` class has now an ``inaxes`` method to check whether a point is in an axes -and returns the topmost axes, else None. diff --git a/lib/matplotlib/backend_bases.py b/lib/matplotlib/backend_bases.py index 4591327bd2ad..fcad2ef25920 100644 --- a/lib/matplotlib/backend_bases.py +++ b/lib/matplotlib/backend_bases.py @@ -1319,12 +1319,15 @@ def __init__(self, name, canvas, x, y, guiEvent=None): self._update_enter_leave() return + # Find all axes containing the mouse if self.canvas.mouse_grabber is None: - self.inaxes = self.canvas.inaxes((x, y)) + axes_list = [a for a in self.canvas.figure.get_axes() + if a.in_axes(self)] else: - self.inaxes = self.canvas.mouse_grabber + axes_list = [self.canvas.mouse_grabber] - if self.inaxes is not None: + if axes_list: + self.inaxes = cbook._topmost_artist(axes_list) try: trans = self.inaxes.transData.inverted() xdata, ydata = trans.transform_point((x, y)) @@ -1789,39 +1792,6 @@ def enter_notify_event(self, guiEvent=None, xy=None): event = LocationEvent('figure_enter_event', self, x, y, guiEvent) self.callbacks.process('figure_enter_event', event) - @cbook.deprecated("2.1") - def idle_event(self, guiEvent=None): - """Called when GUI is idle.""" - s = 'idle_event' - event = IdleEvent(s, self, guiEvent=guiEvent) - self.callbacks.process(s, event) - - def inaxes(self, xy): - """ - Check if a point is in an axes. - - Parameters - ---------- - xy : tuple or list - (x,y) coordinates. - x position - pixels from left of canvas. - y position - pixels from bottom of canvas. - - Returns - ------- - axes: topmost axes containing the point, or None if no axes. - - """ - axes_list = [a for a in self.figure.get_axes() - if a.patch.contains_point(xy)] - - if axes_list: - axes = cbook._topmost_artist(axes_list) - else: - axes = None - - return axes - def grab_mouse(self, ax): """ Set the child axes which are currently grabbing the mouse events. pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy