Hi Julio,

The TrackballManipulator now has support for mouse wheel, but as it
was added in March you'll need to grab one of the 2.9.x dev release
series or svn/trunk to get access to it.  Potentially you could
backport it to the version of the OSG you are using if it's not one of
the above.

Robert.

On Mon, Apr 27, 2009 at 3:14 PM, Julio Campos Alvarez
<[email protected]> wrote:
> Hello,
>
> I'm trying to use the mouse scroll button as if it was the right mouse
> button. All I want to do is move the camera closer and further with the
> mouse scroll button...
> The problem is that I don't receive the events by just moving the
>
> scroll. In order to get the event I need to press a button (either
> keyboard or mouse), once a button is pressed I will get all the events
> in the queue.
>
> Has anyone done something like this?
>
> Here is the code from my modified trackball manipulator:
>
>
> bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& us)
>               {
>                       switch(ea.getEventType())
>                       {
>                               case(osgGA::GUIEventAdapter::FRAME):
>                                       if (_thrown)
>                                       {
>                                               if (calcMovement()) 
> us.requestRedraw();
>
>                                       }
>                                       return false;
>                               default:
>                                       break;
>                       }
>
>                       if (ea.getHandled()) return false;
>
>                       switch(ea.getEventType())
>                       {
>                               case(osgGA::GUIEventAdapter::PUSH):
>                               {
>                                       flushMouseEventStack();
>
>                                       addMouseEvent(ea);
>                                       if (calcMovement()) us.requestRedraw();
>                                       us.requestContinuousUpdate(false);
>                                       _thrown = false;
>                                       return true;
>                               }
>
>                               case(osgGA::GUIEventAdapter::SCROLL):
>
>                               {
>                                       int x = 0;
>                                         //Here I have a brakpoint  :)
>                                       //_distance += 100.0f;
>                                       return true;
>                               }
>                               //
>
>                               case(osgGA::GUIEventAdapter::KEYDOWN):
>                                       if (ea.getKey()== 
> osgGA::GUIEventAdapter::KEY_Space)
>                                       {
>                                               flushMouseEventStack();
>                                               _thrown = false;
>                                               home(ea,us);
>                                               return true;
>                                       }
>
>                                       return false;
>
>
> Thank you very much
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to