Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e3a5cee

Browse files
authored
Merge pull request #26946 from anntzer/cu
Inline Cursor._update into its sole caller.
2 parents c333052 + 890d4b3 commit e3a5cee

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

lib/matplotlib/widgets.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1886,23 +1886,19 @@ def onmove(self, event):
18861886
if not self.ax.contains(event)[0]:
18871887
self.linev.set_visible(False)
18881888
self.lineh.set_visible(False)
1889-
18901889
if self.needclear:
18911890
self.canvas.draw()
18921891
self.needclear = False
18931892
return
18941893
self.needclear = True
1895-
18961894
xdata, ydata = self._get_data_coords(event)
18971895
self.linev.set_xdata((xdata, xdata))
18981896
self.linev.set_visible(self.visible and self.vertOn)
18991897
self.lineh.set_ydata((ydata, ydata))
19001898
self.lineh.set_visible(self.visible and self.horizOn)
1901-
1902-
if self.visible and (self.vertOn or self.horizOn):
1903-
self._update()
1904-
1905-
def _update(self):
1899+
if not (self.visible and (self.vertOn or self.horizOn)):
1900+
return
1901+
# Redraw.
19061902
if self.useblit:
19071903
if self.background is not None:
19081904
self.canvas.restore_region(self.background)
@@ -1911,7 +1907,6 @@ def _update(self):
19111907
self.canvas.blit(self.ax.bbox)
19121908
else:
19131909
self.canvas.draw_idle()
1914-
return False
19151910

19161911

19171912
class MultiCursor(Widget):
@@ -2026,10 +2021,9 @@ def onmove(self, event):
20262021
for line in self.hlines:
20272022
line.set_ydata((ydata, ydata))
20282023
line.set_visible(self.visible and self.horizOn)
2029-
if self.visible and (self.vertOn or self.horizOn):
2030-
self._update()
2031-
2032-
def _update(self):
2024+
if not (self.visible and (self.vertOn or self.horizOn)):
2025+
return
2026+
# Redraw.
20332027
if self.useblit:
20342028
for canvas, info in self._canvas_infos.items():
20352029
if info["background"]:

0 commit comments

Comments
 (0)