Skip to content

Commit

Permalink
BUG: On the Mac wxPython's event.GetX, event.GetY return nonsense for
Browse files Browse the repository at this point in the history
the key events.  We work around the problem by getting the cached
interactor position in this case (which is set on other events like
mouse move, click etc.).
  • Loading branch information
prabhu committed Aug 16, 2008
1 parent 6055541 commit 614c242
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions enthought/tvtk/pyface/ui/wx/scene.py
Expand Up @@ -460,8 +460,11 @@ def OnKeyUp(self, event):
# Set camera focal point.
if key.lower() in ['f']:
if not modifiers:
x = event.GetX()
y = self._vtk_control.GetSize()[1] - event.GetY()
if sys.platform == 'darwin':
x, y = self._interactor.event_position
else:
x = event.GetX()
y = self._vtk_control.GetSize()[1] - event.GetY()
data = self.picker.pick_world(x, y)
coord = data.coordinate
if coord is not None:
Expand All @@ -471,8 +474,11 @@ def OnKeyUp(self, event):
# Handle picking.
if key.lower() in ['p']:
if not modifiers:
x = event.GetX()
y = self._vtk_control.GetSize()[1] - event.GetY()
if sys.platform == 'darwin':
x, y = self._interactor.event_position
else:
x = event.GetX()
y = self._vtk_control.GetSize()[1] - event.GetY()
self.picker.pick(x, y)
return
else:
Expand Down

0 comments on commit 614c242

Please sign in to comment.