Show
Ignore:
Timestamp:
05/14/09 17:45:54 (6 years ago)
Author:
robert
Message:

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.
"

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/src/osgGA/TrackballManipulator.cpp

    r10002 r10209  
    257257    if (_ga_t0->getEventType()==GUIEventAdapter::SCROLL) 
    258258    { 
    259         dy = _ga_t0->getScrollingMotion() == osgGA::GUIEventAdapter::SCROLL_UP ? _zoomDelta : -_zoomDelta; 
     259        switch (_ga_t0->getScrollingMotion()) { 
     260        case osgGA::GUIEventAdapter::SCROLL_UP: 
     261            dy = _zoomDelta; 
     262            break; 
     263        case osgGA::GUIEventAdapter::SCROLL_DOWN: 
     264            dy = -_zoomDelta; 
     265            break; 
     266        case osgGA::GUIEventAdapter::SCROLL_LEFT: 
     267        case osgGA::GUIEventAdapter::SCROLL_RIGHT: 
     268            // pass 
     269            break; 
     270        case osgGA::GUIEventAdapter::SCROLL_2D: 
     271            // normalize scrolling delta 
     272            dx = _ga_t0->getScrollingDeltaX() / ((_ga_t0->getXmax()-_ga_t0->getXmin()) * 0.5f); 
     273            dy = _ga_t0->getScrollingDeltaY() / ((_ga_t0->getYmax()-_ga_t0->getYmin()) * 0.5f); 
     274 
     275            dx *= _zoomDelta; 
     276            dy *= _zoomDelta; 
     277            break; 
     278        default: 
     279            break; 
     280        } 
    260281        buttonMask=GUIEventAdapter::SCROLL; 
    261282    }