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

Method contains

lib/matplotlib/collections.py:528–554  ·  view source on GitHub ↗

Test whether the mouse event occurred in the collection. Returns ``bool, dict(ind=itemlist)``, where every item in itemlist contains the event.

(self, mouseevent)

Source from the content-addressed store, hash-verified

526 return self._pickradius
527
528 def contains(self, mouseevent):
529 """
530 Test whether the mouse event occurred in the collection.
531
532 Returns ``bool, dict(ind=itemlist)``, where every item in itemlist
533 contains the event.
534 """
535 if self._different_canvas(mouseevent) or not self.get_visible():
536 return False, {}
537 pickradius = (
538 float(self._picker)
539 if isinstance(self._picker, Number) and
540 self._picker is not True # the bool, not just nonzero or 1
541 else self._pickradius)
542 if self.axes:
543 self.axes._unstale_viewLim()
544 transform, offset_trf, offsets, paths = self._prepare_points()
545 # Tests if the point is contained on one of the polygons formed
546 # by the control points of each of the paths. A point is considered
547 # "on" a path if it would lie within a stroke of width 2*pickradius
548 # following the path. If pickradius <= 0, then we instead simply check
549 # if the point is *inside* of the path instead.
550 ind = _path.point_in_path_collection(
551 mouseevent.x, mouseevent.y, pickradius,
552 transform.frozen(), paths, self.get_transforms(),
553 offsets, offset_trf, pickradius <= 0)
554 return len(ind) > 0, dict(ind=ind)
555
556 def set_urls(self, urls):
557 """

Callers 1

get_cursor_dataMethod · 0.45

Calls 6

_prepare_pointsMethod · 0.95
get_transformsMethod · 0.95
_different_canvasMethod · 0.80
_unstale_viewLimMethod · 0.80
get_visibleMethod · 0.45
frozenMethod · 0.45

Tested by

no test coverage detected