From Ulrich Hertlein, "please find attached a patch for TrackballManipulator to fix zooming using the MBP touchpad. The old code would always zoom-in even when using the gesture to zoom-out.

Also attached are some code and documentation cleanups for GUIEventAdapter that collect related values (e.g. scrolling, tablet pen) in a struct.
"
This commit is contained in:
Robert Osfield
2009-05-14 15:45:54 +00:00
parent 6a269e24e5
commit 2cefc5f71a

View File

@@ -256,7 +256,28 @@ bool TrackballManipulator::calcMovement()
if (_ga_t0->getEventType()==GUIEventAdapter::SCROLL)
{
dy = _ga_t0->getScrollingMotion() == osgGA::GUIEventAdapter::SCROLL_UP ? _zoomDelta : -_zoomDelta;
switch (_ga_t0->getScrollingMotion()) {
case osgGA::GUIEventAdapter::SCROLL_UP:
dy = _zoomDelta;
break;
case osgGA::GUIEventAdapter::SCROLL_DOWN:
dy = -_zoomDelta;
break;
case osgGA::GUIEventAdapter::SCROLL_LEFT:
case osgGA::GUIEventAdapter::SCROLL_RIGHT:
// pass
break;
case osgGA::GUIEventAdapter::SCROLL_2D:
// normalize scrolling delta
dx = _ga_t0->getScrollingDeltaX() / ((_ga_t0->getXmax()-_ga_t0->getXmin()) * 0.5f);
dy = _ga_t0->getScrollingDeltaY() / ((_ga_t0->getYmax()-_ga_t0->getYmin()) * 0.5f);
dx *= _zoomDelta;
dy *= _zoomDelta;
break;
default:
break;
}
buttonMask=GUIEventAdapter::SCROLL;
}
else