@@ -142,14 +142,13 @@ def contains(self, mouseevent, radius=None):
142
142
143
143
Returns T/F, {}
144
144
"""
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.
149
145
if six .callable (self ._contains ):
150
146
return self ._contains (self , mouseevent )
151
147
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 ()
153
152
inside = self .get_path ().contains_point (
154
153
(mouseevent .x , mouseevent .y ), self .get_transform (), radius )
155
154
return inside , {}
@@ -160,7 +159,10 @@ def contains_point(self, point, radius=None):
160
159
(transformed with its transform attribute).
161
160
"""
162
161
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 ()
164
166
return self .get_path ().contains_point (point ,
165
167
self .get_transform (),
166
168
radius )
@@ -670,15 +672,6 @@ def get_patch_transform(self):
670
672
self ._update_patch_transform ()
671
673
return self ._rect_transform
672
674
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
-
682
675
def get_x (self ):
683
676
"Return the left coord of the rectangle"
684
677
return self ._x
@@ -1416,12 +1409,6 @@ def get_patch_transform(self):
1416
1409
self ._recompute_transform ()
1417
1410
return self ._patch_transform
1418
1411
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
-
1425
1412
1426
1413
class Circle (Ellipse ):
1427
1414
"""
0 commit comments