diff --git a/src/osgViewer/Viewer.cpp b/src/osgViewer/Viewer.cpp index 1c612d823..ec4dbe093 100644 --- a/src/osgViewer/Viewer.cpp +++ b/src/osgViewer/Viewer.cpp @@ -798,6 +798,18 @@ void Viewer::eventTraversal() } } + // pass on the coorindates of the main camera to make sure the frame event is scaled appropriately. + if (getCamera()->getViewport()) + { + osg::Viewport* viewport = getCamera()->getViewport(); + eventState->setInputRange( viewport->x(), viewport->y(), viewport->x() + viewport->width(), viewport->y() + viewport->height()); + } + else + { + eventState->setInputRange(-1.0, -1.0, 1.0, 1.0); + } + + // create a frame event for the new frame. _eventQueue->frame( getFrameStamp()->getReferenceTime() ); // OSG_NOTICE<<"mouseEventState Xmin = "<getXmin()<<" Ymin="<getYmin()<<" xMax="<getXmax()<<" Ymax="<getYmax()<