Skip to content

Commit

Permalink
Fix error when reducing shown time-window while vline visible (mne-to…
Browse files Browse the repository at this point in the history
…ols#9414)

* Fix error when reducing shown time-window while vline visible

* fix comment

* no longer needed

Co-authored-by: Daniel McCloy <[email protected]>
  • Loading branch information
marsipu and drammock authored May 20, 2021
1 parent d8768e2 commit 0079f5b
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions mne/viz/_figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -710,8 +710,6 @@ def _keypress(self, event):
if self.mne.t_start + self.mne.duration > last_time:
self.mne.t_start = last_time - self.mne.duration
self._update_hscroll()
if key == 'end' and self.mne.vline_visible: # prevent flicker
self._show_vline(None)
self._redraw(annotations=True)
elif key == '?': # help window
self._toggle_help_fig(event)
Expand Down Expand Up @@ -2200,10 +2198,9 @@ def _recompute_epochs_vlines(self, xdata):
def _show_vline(self, xdata):
"""Show the vertical line(s)."""
if self.mne.is_epochs:
# special case: changed view duration w/ "home" or "end" key
# (no click event, hence no xdata)
# convert xdata to be epoch-relative (for the text)
rel_time = self._recompute_epochs_vlines(xdata)
xdata = rel_time + self.mne.inst.times[0] # for the text
xdata = rel_time + self.mne.inst.times[0]
else:
self.mne.vline.set_xdata(xdata)
self.mne.vline_hscroll.set_xdata(xdata)
Expand Down

0 comments on commit 0079f5b

Please sign in to comment.