@@ -2039,11 +2039,22 @@ def get_visible(self):
2039
2039
property (lambda self : self ._visible ,
2040
2040
lambda self , value : setattr (self , "_visible" , value )))
2041
2041
2042
- def clear (self ):
2043
- """Clear the selection and set the selector ready to make a new one."""
2042
+ def clear (self , update = True ):
2043
+ """
2044
+ Clear the selection and set the selector ready to make a new one.
2045
+
2046
+ Parameters
2047
+ ----------
2048
+ update : bool
2049
+ Call the `update` method of the selector to remove the selector
2050
+ from the figure. If False, the selector will be removed at the
2051
+ next draw.
2052
+
2053
+ """
2044
2054
self ._selection_completed = False
2045
2055
self .set_visible (False )
2046
-
8000
self .update ()
2056
+ if update :
2057
+ self .update ()
2047
2058
2048
2059
@property
2049
2060
def artists (self ):
@@ -3046,12 +3057,10 @@ def _release(self, event):
3046
3057
# either x or y-direction
3047
3058
minspanxy = (spanx <= self .minspanx or spany <= self .minspany )
3048
3059
if (self ._drawtype != 'none' and minspanxy ):
3049
- for artist in self .artists :
3050
- artist .set_visible (False )
3051
3060
if self ._selection_completed :
3052
3061
# Call onselect, only when the selection is already existing
3053
3062
self .onselect (self ._eventpress , self ._eventrelease )
3054
- self ._selection_completed = False
3063
+ self .clear ( update = False )
3055
3064
else :
3056
3065
self .onselect (self ._eventpress , self ._eventrelease )
3057
3066
self ._selection_completed = True
0 commit comments