8000 Shorten wx _onMouseWheel. · matplotlib/matplotlib@8dcf80b · GitHub
[go: up one dir, main page]

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 8dcf80b

Browse files
committed
Shorten wx _onMouseWheel.
Just compress down the code a bit.
1 parent e70c9d2 commit 8dcf80b

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

lib/matplotlib/backends/backend_wx.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -811,22 +811,14 @@ def _onMouseButton(self, evt):
811811

812812
def _onMouseWheel(self, evt):
813813
"""Translate mouse wheel events into matplotlib events"""
814-
815814
# Determine mouse location
816815
x = evt.GetX()
817816
y = self.figure.bbox.height - evt.GetY()
818-
819817
# Convert delta/rotation/rate into a floating point step size
820-
delta = evt.GetWheelDelta()
821-
rotation = evt.GetWheelRotation()
822-
rate = evt.GetLinesPerAction()
823-
step = rate * rotation / delta
824-
818+
step = evt.LinesPerAction * evt.WheelRotation / evt.WheelDelta
825819
# Done handling event
826820
evt.Skip()
827-
828-
# Mac is giving two events for every wheel event
829-
# Need to skip every second one
821+
# Mac gives two events for every wheel event; skip every second one.
830822
if wx.Platform == '__WXMAC__':
831823
if not hasattr(self, '_skipwheelevent'):
832824
self._skipwheelevent = True
@@ -835,7 +827,6 @@ def _onMouseWheel(self, evt):
835827
return # Return without processing event
836828
else:
837829
self._skipwheelevent = True
838-
839830
FigureCanvasBase.scroll_event(self, x, y, step, guiEvent=evt)
840831

841832
def _onMotion(self, evt):

0 commit comments

Comments
 (0)
0