Hi Paulo, Possible the easiest way to do this would be modify the osgGA::TrackballManipulator itself (and see in the changes so we can all benefit :-), or subclass from it and override the handle method to add the handling of the mouse wheel events. Once you've done this you'd need to pass in the mouse wheel events via the osgGA::EventQueue.
Robert. On Thu, Feb 26, 2009 at 1:00 PM, Paulo Jnkml <paulo.jn...@gmail.com> wrote: > Hi, > I was writing an application using Qt and osg. > I would like to zoom in and out on mouse scroll. > I could not find a good way to do this, so I came up with: > > void osgWidget::wheelEvent(QWheelEvent *event) { > > const float delta(event->delta() / (8.0f * 15.0f)); > > const float x(event->x()); > > const float y(event->y()); > > const float ydy(y + delta); > > const int b(osgGA::GUIEventAdapter::LEFT_MOUSE_BUTTON > > | osgGA::GUIEventAdapter::MIDDLE_MOUSE_BUTTON); > > > _gw->getEventQueue()->mouseButtonPress(x, y, b); > > > _gw->getEventQueue()->mouseMotion(x, ydy); > > > _gw->getEventQueue()->mouseButtonRelease(x, ydy, b); > > } > > which actually works but it's not so elegant. > Is there a obj->zoom(0.9f); to get 10% closer or obj->zoom(1.1f); to get 10% > further for example? > > thank you. > > _______________________________________________ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org