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