@@ -1915,7 +1915,7 @@ def on_select(min: float, max: float) -> Any
19151915 when *interactive* is True. See `matplotlib.lines.Line2D` for valid
19161916 properties.
19171917
1918- handle_grab_distance : float, default: 10
1918+ grab_range : float, default: 10
19191919 Distance in pixels within which the interactive tool handles can be
19201920 activated.
19211921
@@ -1942,7 +1942,7 @@ def on_select(min: float, max: float) -> Any
19421942 @_api .rename_parameter ("3.5" , "span_stays" , "interactive" )
19431943 def __init__ (self , ax , onselect , direction , minspan = 0 , useblit = False ,
19441944 props = None , onmove_callback = None , interactive = False ,
1945- button = None , handle_props = None , handle_grab_distance = 10 ,
1945+ button = None , handle_props = None , grab_range = 10 ,
19461946 drag_from_anywhere = False ):
19471947
19481948 super ().__init__ (ax , onselect , useblit = useblit , button = button )
@@ -1966,7 +1966,7 @@ def __init__(self, ax, onselect, direction, minspan=0, useblit=False,
19661966 self .onmove_callback = onmove_callback
19671967 self .minspan = minspan
19681968
1969- self .handle_grab_distance = handle_grab_distance
1969+ self .grab_range = grab_range
19701970 self ._interactive = interactive
19711971 self .drag_from_anywhere = drag_from_anywhere
19721972
@@ -2173,7 +2173,7 @@ def _set_active_handle(self, event):
21732173 # Use 'C' to match the notation used in the RectangleSelector
21742174 if 'move' in self .state :
21752175 self ._active_handle = 'C'
2176- elif e_dist > self .handle_grab_distance :
2176+ elif e_dist > self .grab_range :
21772177 # Not close to any handles
21782178 self ._active_handle = None
21792179 if self .drag_from_anywhere and self ._contains (event ):
@@ -2421,7 +2421,7 @@ def onselect(eclick: MouseEvent, erelease: MouseEvent)
24212421 button : `.MouseButton`, list of `.MouseButton`, default: all buttons
24222422 Button(s) that trigger rectangle selection.
24232423
2424- handle_grab_distance : float, default: 10
2424+ grab_range : float, default: 10
24252425 Distance in pixels within which the interactive tool handles can be
24262426 activated.
24272427
@@ -2483,15 +2483,15 @@ class RectangleSelector(_SelectorWidget):
24832483
24842484 _shape_klass = Rectangle
24852485
2486- @_api .rename_parameter ("3.5" , "maxdist" , "handle_grab_distance " )
2486+ @_api .rename_parameter ("3.5" , "maxdist" , "grab_range " )
24872487 @_api .rename_parameter ("3.5" , "marker_props" , "handle_props" )
24882488 @_api .rename_parameter ("3.5" , "rectprops" , "props" )
24892489 @_api .delete_parameter ("3.5" , "drawtype" )
24902490 @_api .delete_parameter ("3.5" , "lineprops" )
24912491 def __init__ (self , ax , onselect , drawtype = 'box' ,
24922492 minspanx = 0 , minspany = 0 , useblit = False ,
24932493 lineprops = None , props = None , spancoords = 'data' ,
2494- button = None , handle_grab_distance = 10 , handle_props = None ,
2494+ button = None , grab_range = 10 , handle_props = None ,
24952495 interactive = False , state_modifier_keys = None ,
24962496 drag_from_anywhere = False ):
24972497 super ().__init__ (ax , onselect , useblit = useblit , button = button ,
@@ -2542,7 +2542,7 @@ def __init__(self, ax, onselect, drawtype='box',
25422542 self .spancoords = spancoords
25432543 self ._drawtype = drawtype
25442544
2545- self .handle_grab_distance = handle_grab_distance
2545+ self .grab_range = grab_range
25462546
25472547 if props is None :
25482548 _handle_props = dict (markeredgecolor = 'black' )
@@ -2589,7 +2589,7 @@ def __init__(self, ax, onselect, drawtype='box',
25892589 interactive = _api .deprecate_privatize_attribute ("3.5" )
25902590
25912591 maxdist = _api .deprecated ("3.5" )(
2592- property (lambda self : self .handle_grab_distance )
2592+ property (lambda self : self .grab_range )
25932593 )
25942594
25952595 def _press (self , event ):
@@ -2806,11 +2806,11 @@ def _set_active_handle(self, event):
28062806 self ._active_handle = 'C'
28072807 self ._extents_on_press = self .extents
28082808 # Set active handle as closest handle, if mouse click is close enough.
2809- elif m_dist < self .handle_grab_distance * 2 :
2809+ elif m_dist < self .grab_range * 2 :
28102810 # Prioritise center handle over other handles
28112811 self ._active_handle = 'C'
2812- elif (c_dist > self .handle_grab_distance and
2813- e_dist > self .handle_grab_distance ):
2812+ elif (c_dist > self .grab_range and
2813+ e_dist > self .grab_range ):
28142814 # Not close to any handles
28152815 if self .drag_from_anywhere and self ._contains (event ):
28162816 # Check if we've clicked inside the region
@@ -3058,9 +3058,9 @@ class PolygonSelector(_SelectorWidget):
30583058 the default value of ``markeredgecolor`` which will be the same as the
30593059 ``color`` property in *props*.
30603060
3061- handle_grab_distance : float, default: 15px
3061+ grab_range : float, default: 10
30623062 A vertex is selected (to complete the polygon or to move a vertex) if
3063- the mouse click is within *handle_grab_distance * pixels of the vertex.
3063+ the mouse click is within *grab_range * pixels of the vertex.
30643064
30653065 Examples
30663066 --------
@@ -3075,10 +3075,9 @@ class PolygonSelector(_SelectorWidget):
30753075
30763076 @_api .rename_parameter ("3.5" , "lineprops" , "props" )
30773077 @_api .rename_parameter ("3.5" , "markerprops" , "handle_props" )
3078- @_api .rename_parameter ("3.5" , "vertex_select_radius" ,
3079- "handle_grab_distance" )
3078+ @_api .rename_parameter ("3.5" , "vertex_select_radius" , "grab_range" )
30803079 def __init__ (self , ax , onselect , useblit = False ,
3081- props = None , handle_props = None , handle_grab_distance = 15 ):
3080+ props = None , handle_props = None , grab_range = 10 ):
30823081 # The state modifiers 'move', 'square', and 'center' are expected by
30833082 # _SelectorWidget but are not supported by PolygonSelector
30843083 # Note: could not use the existing 'move' state modifier in-place of
@@ -3108,13 +3107,13 @@ def __init__(self, ax, onselect, useblit=False,
31083107 marker_props = handle_props )
31093108
31103109 self ._active_handle_idx = - 1
3111- self .handle_grab_distance = handle_grab_distance
3110+ self .grab_range = grab_range
31123111
31133112 self .artists = [self .line , self ._polygon_handles .artist ]
31143113 self .set_visible (True )
31153114
31163115 vertex_select_radius = _api .deprecated ("3.5" )(
3117- property (lambda self : self .handle_grab_distance )
3116+ property (lambda self : self .grab_range )
31183117 )
31193118
31203119 @property
@@ -3150,7 +3149,7 @@ def _press(self, event):
31503149 if ((self ._polygon_completed or 'move_vertex' in self .state )
31513150 and len (self ._xs ) > 0 ):
31523151 h_idx , h_dist = self ._polygon_handles .closest (event .x , event .y )
3153- if h_dist < self .handle_grab_distance :
3152+ if h_dist < self .grab_range :
31543153 self ._active_handle_idx = h_idx
31553154 # Save the vertex positions at the time of the press event (needed to
31563155 # support the 'move_all' state modifier).
@@ -3224,7 +3223,7 @@ def _onmove(self, event):
32243223 self ._ys [0 ]))
32253224 v0_dist = np .hypot (x0 - event .x , y0 - event .y )
32263225 # Lock on to the start vertex if near it and ready to complete.
3227- if len (self ._xs ) > 3 and v0_dist < self .handle_grab_distance :
3226+ if len (self ._xs ) > 3 and v0_dist < self .grab_range :
32283227 self ._xs [- 1 ], self ._ys [- 1 ] = self ._xs [0 ], self ._ys [0 ]
32293228 else :
32303229 self ._xs [- 1 ], self ._ys [- 1 ] = event .xdata , event .ydata
0 commit comments