Make the knob mouse-wheel direction configurable.
Add a global setting to control the mouse-wheel direction of the knob; a future commit will expose this in the FG GUI.
This commit is contained in:
parent
0870407f65
commit
235c29913a
@ -361,6 +361,8 @@ static void readOptionalBindingList(const SGPropertyNode* aNode, SGPropertyNode*
|
||||
|
||||
}
|
||||
|
||||
static bool static_knobMouseWheelAlternateDirection = false;
|
||||
|
||||
class SGKnobAnimation::KnobPickCallback : public SGPickCallback {
|
||||
public:
|
||||
KnobPickCallback(const SGPropertyNode* configNode,
|
||||
@ -401,10 +403,13 @@ public:
|
||||
button = 1;
|
||||
}
|
||||
|
||||
int increaseMouseWheel = static_knobMouseWheelAlternateDirection ? 3 : 4;
|
||||
int decreaseMouseWheel = static_knobMouseWheelAlternateDirection ? 4 : 3;
|
||||
|
||||
_direction = DIRECTION_NONE;
|
||||
if ((button == 0) || (button == 4)) {
|
||||
if ((button == 0) || (button == increaseMouseWheel)) {
|
||||
_direction = DIRECTION_CLOCKWISE;
|
||||
} else if ((button == 1) || (button == 3)) {
|
||||
} else if ((button == 1) || (button == decreaseMouseWheel)) {
|
||||
_direction = DIRECTION_ANTICLOCKWISE;
|
||||
} else {
|
||||
return false;
|
||||
@ -518,3 +523,8 @@ SGKnobAnimation::createAnimationGroup(osg::Group& parent)
|
||||
return transform;
|
||||
}
|
||||
|
||||
void SGKnobAnimation::setAlternateMouseWheelDirection(bool aToggle)
|
||||
{
|
||||
static_knobMouseWheelAlternateDirection = aToggle;
|
||||
}
|
||||
|
||||
|
@ -54,6 +54,12 @@ public:
|
||||
SGPropertyNode* modelRoot);
|
||||
virtual osg::Group* createAnimationGroup(osg::Group& parent);
|
||||
|
||||
/**
|
||||
* by default mouse wheel up corresponds to increment (CW)
|
||||
* and mouse-wheel down corresponds to decrement (CCW).
|
||||
* Since no one can agree on that, make it a global toggle.
|
||||
*/
|
||||
static void setAlternateMouseWheelDirection(bool aToggle);
|
||||
private:
|
||||
class KnobPickCallback;
|
||||
class UpdateCallback;
|
||||
|
Loading…
Reference in New Issue
Block a user