Skip to content

Commit 6da3707

Browse files
Toddpeircej
authored andcommitted
BF: Allow mouse wheel scrolling in Routine canvas
1 parent af518c7 commit 6da3707

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

psychopy/app/builder/builder.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1514,6 +1514,7 @@ def __init__(self, notebook, id=wx.ID_ANY, routine=None):
15141514
self.Bind(wx.EVT_PAINT, self.OnPaint)
15151515
self.Bind(wx.EVT_ERASE_BACKGROUND, lambda x: None)
15161516
self.Bind(wx.EVT_MOUSE_EVENTS, self.OnMouse)
1517+
self.Bind(wx.EVT_MOUSEWHEEL, self.OnScroll)
15171518
self.Bind(wx.EVT_SIZE, self.onResize)
15181519
# crashes if drop on OSX:
15191520
# self.SetDropTarget(FileDropTarget(builder = self.frame))
@@ -1574,6 +1575,11 @@ def OnMouse(self, event):
15741575
except IndexError:
15751576
self.frame.SetStatusText("")
15761577

1578+
def OnScroll(self, event):
1579+
xy = self.GetViewStart()
1580+
multiplier = self.dpi / 1600
1581+
self.Scroll(xy[0], xy[1] - event.WheelRotation*multiplier)
1582+
15771583
def showContextMenu(self, component, xy):
15781584
menu = wx.Menu()
15791585
for item in self.contextMenuItems:

0 commit comments

Comments
 (0)