From b9eb2fcdee186a3c6ff6ea46e62ca7f7db1a90ec Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 22 Feb 2007 10:31:09 +0000 Subject: [PATCH] Fixed calculation of inverted coordindates --- src/osgViewer/View.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/osgViewer/View.cpp b/src/osgViewer/View.cpp index b08c848bd..cc7ac01d9 100644 --- a/src/osgViewer/View.cpp +++ b/src/osgViewer/View.cpp @@ -350,9 +350,12 @@ const osg::Camera* View::getCameraContainingPosition(float x, float y, float& lo double new_x = static_cast(_camera->getGraphicsContext()->getTraits()->width) * (x - eventState->getXmin())/(eventState->getXmax()-eventState->getXmin()); double new_y = view_invert_y ? - static_cast(_camera->getGraphicsContext()->getTraits()->height) * (1.0 - (y- eventState->getYmin()))/(eventState->getYmax()-eventState->getYmin()) : + static_cast(_camera->getGraphicsContext()->getTraits()->height) * (1.0 - (y- eventState->getYmin())/(eventState->getYmax()-eventState->getYmin())) : static_cast(_camera->getGraphicsContext()->getTraits()->height) * (y - eventState->getYmin())/(eventState->getYmax()-eventState->getXmin()); + // osg::notify(osg::NOTICE)<<" new_x="<= (viewport->x()-epsilon) && new_y >= (viewport->y()-epsilon) && new_x < (viewport->x()+viewport->width()-1.0+epsilon) && new_y <= (viewport->y()+viewport->height()-1.0+epsilon) )