Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions lib/matplotlib/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1886,23 +1886,19 @@ def onmove(self, event):
if not self.ax.contains(event)[0]:
self.linev.set_visible(False)
self.lineh.set_visible(False)

if self.needclear:
self.canvas.draw()
self.needclear = False
return
self.needclear = True

xdata, ydata = self._get_data_coords(event)
self.linev.set_xdata((xdata, xdata))
self.linev.set_visible(self.visible and self.vertOn)
self.lineh.set_ydata((ydata, ydata))
self.lineh.set_visible(self.visible and self.horizOn)

if self.visible and (self.vertOn or self.horizOn):
self._update()

def _update(self):
if not (self.visible and (self.vertOn or self.horizOn)):
return
# Redraw.
if self.useblit:
if self.background is not None:
self.canvas.restore_region(self.background)
Expand All @@ -1911,7 +1907,6 @@ def _update(self):
self.canvas.blit(self.ax.bbox)
else:
self.canvas.draw_idle()
return False


class MultiCursor(Widget):
Expand Down Expand Up @@ -2026,10 +2021,9 @@ def onmove(self, event):
for line in self.hlines:
line.set_ydata((ydata, ydata))
line.set_visible(self.visible and self.horizOn)
if self.visible and (self.vertOn or self.horizOn):
self._update()

def _update(self):
if not (self.visible and (self.vertOn or self.horizOn)):
return
# Redraw.
if self.useblit:
for canvas, info in self._canvas_infos.items():
if info["background"]:
Expand Down