mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 18:31:55 -04:00
support mousewheel in WxPandaWindow, bugfix provided by Craig (LP bug 1210850)
This commit is contained in:
parent
2274f2e651
commit
1cfa19d473
@ -192,6 +192,7 @@ else:
|
|||||||
self.Bind(wx.EVT_RIGHT_DOWN, lambda event: self.__buttonDown(MouseButton.three()))
|
self.Bind(wx.EVT_RIGHT_DOWN, lambda event: self.__buttonDown(MouseButton.three()))
|
||||||
self.Bind(wx.EVT_RIGHT_UP, lambda event: self.__buttonUp(MouseButton.three()))
|
self.Bind(wx.EVT_RIGHT_UP, lambda event: self.__buttonUp(MouseButton.three()))
|
||||||
self.Bind(wx.EVT_MOTION, self.__mouseMotion)
|
self.Bind(wx.EVT_MOTION, self.__mouseMotion)
|
||||||
|
self.Bind(wx.EVT_MOUSEWHEEL, self.__mouseWheel)
|
||||||
self.Bind(wx.EVT_LEAVE_WINDOW, self.__mouseLeaveWindow)
|
self.Bind(wx.EVT_LEAVE_WINDOW, self.__mouseLeaveWindow)
|
||||||
self.Bind(wx.EVT_KEY_DOWN, self.__keyDown)
|
self.Bind(wx.EVT_KEY_DOWN, self.__keyDown)
|
||||||
self.Bind(wx.EVT_KEY_UP, self.__keyUp)
|
self.Bind(wx.EVT_KEY_UP, self.__keyUp)
|
||||||
@ -233,6 +234,15 @@ else:
|
|||||||
def __mouseMotion(self, event):
|
def __mouseMotion(self, event):
|
||||||
self.inputDevice.setPointerInWindow(*event.GetPosition())
|
self.inputDevice.setPointerInWindow(*event.GetPosition())
|
||||||
|
|
||||||
|
def __mouseWheel(self, event):
|
||||||
|
amount = event.GetWheelRotation()
|
||||||
|
if amount > 0.0:
|
||||||
|
self.inputDevice.buttonDown(MouseButton.wheelUp())
|
||||||
|
self.inputDevice.buttonUp(MouseButton.wheelUp())
|
||||||
|
elif amount < 0.0:
|
||||||
|
self.inputDevice.buttonDown(MouseButton.wheelDown())
|
||||||
|
self.inputDevice.buttonUp(MouseButton.wheelDown())
|
||||||
|
|
||||||
def __mouseLeaveWindow(self, event):
|
def __mouseLeaveWindow(self, event):
|
||||||
self.inputDevice.setPointerOutOfWindow()
|
self.inputDevice.setPointerOutOfWindow()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user