From 45efe61d44b98a83ce254ad5e887fdcb7887da41 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 6 Aug 2009 10:06:20 +0000 Subject: [PATCH] Fixed custom cursor support --- applications/present3D/present3D.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/applications/present3D/present3D.cpp b/applications/present3D/present3D.cpp index 730f79bbc..db606c30b 100644 --- a/applications/present3D/present3D.cpp +++ b/applications/present3D/present3D.cpp @@ -98,15 +98,19 @@ class FollowMouseCallback: public osgGA::GUIEventHandler virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&, osg::Object* object, osg::NodeVisitor*) { + switch(ea.getEventType()) { case(osgGA::GUIEventAdapter::MOVE): case(osgGA::GUIEventAdapter::DRAG): { - osg::CameraNode* camera = dynamic_cast(object); + osg::Camera* camera = dynamic_cast(object); if (camera) { - camera->setViewMatrix(osg::Matrixd::translate(ea.getX(),ea.getY(),0.0)); + double x = ea.getXnormalized(); + double y = ea.getYnormalized(); + + camera->setViewMatrix(osg::Matrixd::translate(x,y,0.0)); } break; } @@ -114,7 +118,7 @@ class FollowMouseCallback: public osgGA::GUIEventHandler { if (ea.getKey()=='c') { - osg::CameraNode* camera = dynamic_cast(object); + osg::Camera* camera = dynamic_cast(object); if (camera) { for(unsigned int i=0; i< camera->getNumChildren(); ++i) @@ -124,7 +128,6 @@ class FollowMouseCallback: public osgGA::GUIEventHandler node->getNodeMask()!=0 ? 0 : 0xffffff); - } } } @@ -453,7 +456,7 @@ int main( int argc, char **argv ) // any option left unread are converted into errors to write out later. //arguments.reportRemainingOptionsAsUnrecognized(); - // report any errors if they have occured when parsing the program aguments. + // report any errors if they have ocured when parsing the program aguments. if (arguments.errors()) { arguments.writeErrorMessages(osg::notify(osg::INFO));