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 a8ad349

Browse filesBrowse files
authored
Merge pull request #6642 from blink1073/fix-rectangle-selector
FIX: rectangle selector release bug Close #6623.
2 parents 989aa06 + 27da912 commit a8ad349
Copy full SHA for a8ad349

File tree

Expand file treeCollapse file tree

1 file changed

+19
-18
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+19
-18
lines changed

‎lib/matplotlib/widgets.py

Copy file name to clipboardExpand all lines: lib/matplotlib/widgets.py
+19-18Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1833,6 +1833,18 @@ def _release(self, event):
18331833
if not self.interactive:
18341834
self.to_draw.set_visible(False)
18351835

1836+
# update the eventpress and eventrelease with the resulting extents
1837+
x1, x2, y1, y2 = self.extents
1838+
self.eventpress.xdata = x1
1839+
self.eventpress.ydata = y1
1840+
xy1 = self.ax.transData.transform_point([x1, y1])
1841+
self.eventpress.x, self.eventpress.y = xy1
1842+
1843+
self.eventrelease.xdata = x2
1844+
self.eventrelease.ydata = y2
1845+
xy2 = self.ax.transData.transform_point([x2, y2])
1846+
self.eventrelease.x, self.eventrelease.y = xy2
1847+
18361848
if self.spancoords == 'data':
18371849
xmin, ymin = self.eventpress.xdata, self.eventpress.ydata
18381850
xmax, ymax = self.eventrelease.xdata, self.eventrelease.ydata
@@ -1854,27 +1866,16 @@ def _release(self, event):
18541866
xproblems = self.minspanx is not None and spanx < self.minspanx
18551867
yproblems = self.minspany is not None and spany < self.minspany
18561868

1857-
if (((self.drawtype == 'box') or (self.drawtype == 'line')) and
1858-
(xproblems or yproblems)):
1859-
# check if drawn distance (if it exists) is not too small in
1860-
# neither x nor y-direction
1861-
self.extents = [0, 0, 0, 0]
1869+
# check if drawn distance (if it exists) is not too small in
1870+
# either x or y-direction
1871+
if self.drawtype != 'none' and (xproblems or yproblems):
1872+
for artist in self.artists:
1873+
artist.set_visible(False)
1874+
self.update()
18621875
return
18631876

1864-
# update the eventpress and eventrelease with the resulting extents
1865-
x1, x2, y1, y2 = self.extents
1866-
self.eventpress.xdata = x1
1867-
self.eventpress.ydata = y1
1868-
xy1 = self.ax.transData.transform_point([x1, y1])
1869-
self.eventpress.x, self.eventpress.y = xy1
1870-
1871-
self.eventrelease.xdata = x2
1872-
self.eventrelease.ydata = y2
1873-
xy2 = self.ax.transData.transform_point([x2, y2])
1874-
self.eventrelease.x, self.eventrelease.y = xy2
1875-
1877+
# call desired function
18761878
self.onselect(self.eventpress, self.eventrelease)
1877-
# call desired function
18781879
self.update()
18791880

18801881
return False

0 commit comments

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