FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Cursor widget now uses widgetlock; closes Issue #156 by efiring · Pull Request #1320 · matplotlib/matplotlib · GitHub

Repository navigation

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
20 changes: 14 additions & 6 deletions lib/matplotlib/widgets.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -841,6 +841,8 @@ def onmove(self, event):
'on mouse motion draw the cursor if visible'
if self.ignore(event):
return
if not self.canvas.widgetlock.available(self):
return
if event.inaxes != self.ax:
self.linev.set_visible(False)
self.lineh.set_visible(False)
Expand Down Expand Up @@ -907,7 +909,8 @@ def __init__(self, canvas, axes, useblit=True, **lineprops):
if useblit:
lineprops['animated'] = True

self.lines = [ax.axvline(xmid, visible=False, **lineprops) for ax in axes]
self.lines = [ax.axvline(xmid, visible=False, **lineprops)
for ax in axes]

self.visible = True
self.useblit = useblit
Expand All @@ -921,15 +924,20 @@ def __init__(self, canvas, axes, useblit=True, **lineprops):
def clear(self, event):
'clear the cursor'
if self.useblit:
self.background = self.canvas.copy_from_bbox(self.canvas.figure.bbox)
for line in self.lines: line.set_visible(False)
self.background = self.canvas.copy_from_bbox(
self.canvas.figure.bbox)
for line in self.lines:
line.set_visible(False)


def onmove(self, event):
if event.inaxes is None: return
if not self.canvas.widgetlock.available(self): return
if event.inaxes is None:
return
if not self.canvas.widgetlock.available(self):
return
self.needclear = True
if not self.visible: return
if not self.visible:
return

for line in self.lines:
line.set_xdata((event.xdata, event.xdata))
Expand Down

Back | FazBrowse Home | New Git URL