Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5e22976

Browse filesBrowse files
authored
Merge pull request #10107 from lkjell/fix_selector_widget_stay_span
Fix stay_span to reset onclick in SpanSelector.
2 parents 5cb2205 + c825652 commit 5e22976
Copy full SHA for 5e22976

File tree

Expand file treeCollapse file tree

1 file changed

+22
-15
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+22
-15
lines changed

‎lib/matplotlib/widgets.py

Copy file name to clipboardExpand all lines: lib/matplotlib/widgets.py
+22-15Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1802,6 +1802,8 @@ def _press(self, event):
18021802
self.pressv = xdata
18031803
else:
18041804
self.pressv = ydata
1805+
1806+
self._set_span_xy(event)
18051807
return False
18061808

18071809
def _release(self, event):
@@ -1840,6 +1842,26 @@ def _onmove(self, event):
18401842
"""on motion notify event"""
18411843
if self.pressv is None:
18421844
return
1845+
1846+
self._set_span_xy(event)
1847+
1848+
if self.onmove_callback is not None:
1849+
vmin = self.pressv
1850+
xdata, ydata = self._get_data(event)
1851+
if self.direction == 'horizontal':
1852+
vmax = xdata or self.prev[0]
1853+
else:
1854+
vmax = ydata or self.prev[1]
1855+
1856+
if vmin > vmax:
1857+
vmin, vmax = vmax, vmin
1858+
self.onmove_callback(vmin, vmax)
1859+
1860+
self.update()
1861+
return False
1862+
1863+
def _set_span_xy(self, event):
1864+
"""Setting the span coordinates"""
18431865
x, y = self._get_data(event)
18441866
if x is None:
18451867
return
@@ -1860,21 +1882,6 @@ def _onmove(self, event):
18601882
self.rect.set_y(minv)
18611883
self.rect.set_height(maxv - minv)
18621884

1863-
if self.onmove_callback is not None:
1864-
vmin = self.pressv
1865-
xdata, ydata = self._get_data(event)
1866-
if self.direction == 'horizontal':
1867-
vmax = xdata or self.prev[0]
1868-
else:
1869-
vmax = ydata or self.prev[1]
1870-
1871-
if vmin > vmax:
1872-
vmin, vmax = vmax, vmin
1873-
self.onmove_callback(vmin, vmax)
1874-
1875-
self.update()
1876-
return False
1877-
18781885

18791886
class ToolHandles(object):
18801887
"""Control handles for canvas tools.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.