Changeset 9896

Show
Ignore:
Timestamp:
03/11/09 11:50:03 (4 years ago)
Author:
robert
Message:

From Martin Beckett, added get/setScrollWheelZoomDelta() support for controlling the mouse scroll wheel zoom delta.

Location:
OpenSceneGraph/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/include/osgGA/TrackballManipulator

    r7648 r9896  
    7979        double getMinimumZoomScale() const { return _minimumZoomScale; } 
    8080 
     81        /** set the mouse scroll wheel zoom delta. 
     82          * Range -1.0 to +1.0,  -ve value inverts wheel direction and zero switches off scroll wheel. */ 
     83        void setScroolWheelZoomDelta(double zoomDelta) { _zoomDelta = zoomDelta; } 
     84 
     85        /** get the mouse scroll wheel zoom delta. */ 
     86        double getScroolWheelZoomDelta() const { return _zoomDelta; } 
     87 
    8188        /** Set the center of the trackball. */ 
    8289        void setCenter(const osg::Vec3d& center) { _center = center; } 
     
    140147        double       _distance; 
    141148        float        _trackballSize; 
     149        float        _zoomDelta; 
    142150 
    143151}; 
  • OpenSceneGraph/trunk/src/osgGA/TrackballManipulator.cpp

    r9891 r9896  
    1515    _distance = 1.0f; 
    1616    _trackballSize = 0.8f; 
     17    _zoomDelta = 0.1f; 
    1718} 
    1819 
     
    246247bool TrackballManipulator::calcMovement() 
    247248{ 
    248     // mosue scroll is only a single event 
     249    // mouse scroll is only a single event 
    249250    if (_ga_t0.get()==NULL) return false; 
    250251 
     
    255256    if (_ga_t0->getEventType()==GUIEventAdapter::SCROLL) 
    256257    { 
    257         dy = _ga_t0->getScrollingMotion() == osgGA::GUIEventAdapter::SCROLL_DOWN ? -0.1 : 0.1; 
     258        dy = _ga_t0->getScrollingMotion() == osgGA::GUIEventAdapter::SCROLL_UP ? _zoomDelta : -_zoomDelta; 
    258259        buttonMask=GUIEventAdapter::SCROLL; 
    259260    }