@@ -142,14 +142,13 @@ def contains(self, mouseevent, radius=None):
142142
143143 Returns T/F, {}
144144 """
145- # This is a general version of contains that should work on any
146- # patch with a path. However, patches that have a faster
147- # algebraic solution to hit-testing should override this
148- # method.
149145 if six .callable (self ._contains ):
150146 return self ._contains (self , mouseevent )
151147 if radius is None :
152- radius = self .get_linewidth ()
148+ if cbook .is_numlike (self ._picker ):
149+ radius = self ._picker
150+ else :
151+ radius = self .get_linewidth ()
153152 inside = self .get_path ().contains_point (
154153 (mouseevent .x , mouseevent .y ), self .get_transform (), radius )
155154 return inside , {}
@@ -160,7 +159,10 @@ def contains_point(self, point, radius=None):
160159 (transformed with its transform attribute).
161160 """
162161 if radius is None :
163- radius = self .get_linewidth ()
162+ if cbook .is_numlike (self ._picker ):
163+ radius = self ._picker
164+ else :
165+ radius = self .get_linewidth ()
164166 return self .get_path ().contains_point (point ,
165167 self .get_transform (),
166168 radius )
@@ -670,15 +672,6 @@ def get_patch_transform(self):
670672 self ._update_patch_transform ()
671673 return self ._rect_transform
672674
673- def contains (self , mouseevent ):
674- # special case the degenerate rectangle
675- if self ._width == 0 or self ._height == 0 :
676- return False , {}
677-
678- x , y = self .get_transform ().inverted ().transform_point (
679- (mouseevent .x , mouseevent .y ))
680- return (x >= 0.0 and x <= 1.0 and y >= 0.0 and y <= 1.0 ), {}
681-
682675 def get_x (self ):
683676 "Return the left coord of the rectangle"
684677 return self ._x
@@ -1416,12 +1409,6 @@ def get_patch_transform(self):
14161409 self ._recompute_transform ()
14171410 return self ._patch_transform
14181411
1419- def contains (self , ev ):
1420- if ev .x is None or ev .y is None :
1421- return False , {}
1422- x , y = self .get_transform ().inverted ().transform_point ((ev .x , ev .y ))
1423- return (x * x + y * y ) <= 1.0 , {}
1424-
14251412
14261413class Circle (Ellipse ):
14271414 """
0 commit comments