8000 Add internal method to clear without update to simplify code · matplotlib/matplotlib@f084ed2 · GitHub
[go: up one dir, main page]

Skip to content

Commit f084ed2

Browse files
committed
Add internal method to clear without update to simplify code
1 parent 3370281 commit f084ed2

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/matplotlib/widgets.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2074,9 +2074,12 @@ def visible(self, visible):
20742074

20752075
def clear(self):
20762076
"""Clear the selection and set the selector ready to make a new one."""
2077+
self._clear_without_update()
2078+
self.update()
2079+
2080+
def _clear_without_update(self):
20772081
self._selection_completed = False
20782082
self.set_visible(False)
2079-
self.update()
20802083

20812084
@property
20822085
def artists(self):
@@ -3094,12 +3097,10 @@ def _release(self, event):
30943097
# either x or y-direction
30953098
minspanxy = (spanx <= self.minspanx or spany <= self.minspany)
30963099
if (self._drawtype != 'none' and minspanxy):
3097-
for artist in self.artists:
3098-
artist.set_visible(False)
30993100
if self._selection_completed:
31003101
# Call onselect, only when the selection is already existing
31013102
self.onselect(self._eventpress, self._eventrelease)
3102-
self._selection_completed = False
3103+
self._clear_without_update()
31033104
else:
31043105
self.onselect(self._eventpress, self._eventrelease)
31053106
self._selection_completed = True

0 commit comments

Comments
 (0)
0