Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9a21943

Browse files
committed
Add state handling to onmove
1 parent 8b35d33 commit 9a21943

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/matplotlib/widgets.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,6 +1248,15 @@ def _onmove(self, event):
12481248
"""Cursor move event handler and validator"""
12491249
if not self.ignore(event):
12501250
event = self._clean_event(event)
1251+
# update the state
1252+
if 'move' in self.state:
1253+
self.state = ['move']
1254+
else:
1255+
self.state = []
1256+
if 'shift' in event.key:
1257+
self.state.append('square')
1258+
if 'ctrl' in event.key or 'control' in event.key:
1259+
self.state.append('center')
12511260
self.onmove(event)
12521261

12531262
def onmove(self, event):

0 commit comments

Comments
 (0)