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
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to