MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / contains

Method contains

lib/matplotlib/text.py:271–292  ·  view source on GitHub ↗

Return whether the mouse event occurred inside the axis-aligned bounding-box of the text.

(self, mouseevent)

Source from the content-addressed store, hash-verified

269 return d
270
271 def contains(self, mouseevent):
272 """
273 Return whether the mouse event occurred inside the axis-aligned
274 bounding-box of the text.
275 """
276 if (self._different_canvas(mouseevent) or not self.get_visible()
277 or self._renderer is None):
278 return False, {}
279 # Explicitly use Text.get_window_extent(self) and not
280 # self.get_window_extent() so that Annotation.contains does not
281 # accidentally cover the entire annotation bounding box.
282 bbox = Text.get_window_extent(self)
283 inside = (bbox.x0 <= mouseevent.x <= bbox.x1
284 and bbox.y0 <= mouseevent.y <= bbox.y1)
285 cattr = {}
286 # if the text has a surrounding patch, also check containment for it,
287 # and merge the results with the results for the text.
288 if self._bbox_patch:
289 patch_inside, patch_cattr = self._bbox_patch.contains(mouseevent)
290 inside = inside or patch_inside
291 cattr["bbox_patch"] = patch_cattr
292 return inside, cattr
293
294 def _get_xy_display(self):
295 """

Callers 15

drawMethod · 0.45
containsMethod · 0.45
_clickMethod · 0.45
_releaseMethod · 0.45
_motionMethod · 0.45
_updateMethod · 0.45
_updateMethod · 0.45
_clickedMethod · 0.45
_clickMethod · 0.45
_motionMethod · 0.45

Calls 3

_different_canvasMethod · 0.80
get_visibleMethod · 0.45
get_window_extentMethod · 0.45

Tested by 2