vtkInteractorStyle.cxx uses outdated EventPosition
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
In this code from vtkInteractorStyle.cxx: case 'f' : case 'F' : { if(this->CurrentRenderer!=0) { this->AnimState = VTKIS_ANIM_ON; vtkAssemblyPath *path = NULL; this->FindPokedRenderer(rwi->GetEventPosition()[0], rwi->GetEventPosition()[1]);
The InteractorStyle is responding to a key press, and is using "EventPosition" to determine the poked renderer and the pick coordinate.
However, in QVTKInteractorAdapter.cxx (and also likely in the equivalent for MFC, Cocoa, etc) this is what is done in response to a key press:
iren->SetKeyEventInformation( (e2->modifiers() & Qt::ControlModifier), (e2->modifiers() & Qt::ShiftModifier), ascii_key, e2->count(), keysym);
SetKeyEventInformation() does everything except set EventPosition. So the interactor style is using an EventPosition that was set during the last MouseMove or other mouse event.
That is normally ok, unless the mouse is moved outside the widget. The widget still has the focus and receives key presses, but EventPosition is left at the last known mouse position (at the point it left the window).
Fixes: a) Instead, the key event should call SetEventInformation() with the current mouse cursor position (from QCursor::pos(), converted to widget coords).
b) The InteractorStyle should not use EventPosition, but instead use a mechanism to query the current mouse position.