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:
@@ -361,6 +361,8 @@ static void readOptionalBindingList(const SGPropertyNode* aNode, SGPropertyNode*
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool static_knobMouseWheelAlternateDirection = false;
|
||||||
|
|
||||||
class SGKnobAnimation::KnobPickCallback : public SGPickCallback {
|
class SGKnobAnimation::KnobPickCallback : public SGPickCallback {
|
||||||
public:
|
public:
|
||||||
KnobPickCallback(const SGPropertyNode* configNode,
|
KnobPickCallback(const SGPropertyNode* configNode,
|
||||||
@@ -401,10 +403,13 @@ public:
|
|||||||
button = 1;
|
button = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int increaseMouseWheel = static_knobMouseWheelAlternateDirection ? 3 : 4;
|
||||||
|
int decreaseMouseWheel = static_knobMouseWheelAlternateDirection ? 4 : 3;
|
||||||
|
|
||||||
_direction = DIRECTION_NONE;
|
_direction = DIRECTION_NONE;
|
||||||
if ((button == 0) || (button == 4)) {
|
if ((button == 0) || (button == increaseMouseWheel)) {
|
||||||
_direction = DIRECTION_CLOCKWISE;
|
_direction = DIRECTION_CLOCKWISE;
|
||||||
} else if ((button == 1) || (button == 3)) {
|
} else if ((button == 1) || (button == decreaseMouseWheel)) {
|
||||||
_direction = DIRECTION_ANTICLOCKWISE;
|
_direction = DIRECTION_ANTICLOCKWISE;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@@ -518,3 +523,8 @@ SGKnobAnimation::createAnimationGroup(osg::Group& parent)
|
|||||||
return transform;
|
return transform;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SGKnobAnimation::setAlternateMouseWheelDirection(bool aToggle)
|
||||||
|
{
|
||||||
|
static_knobMouseWheelAlternateDirection = aToggle;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,6 +54,12 @@ public:
|
|||||||
SGPropertyNode* modelRoot);
|
SGPropertyNode* modelRoot);
|
||||||
virtual osg::Group* createAnimationGroup(osg::Group& parent);
|
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:
|
private:
|
||||||
class KnobPickCallback;
|
class KnobPickCallback;
|
||||||
class UpdateCallback;
|
class UpdateCallback;
|
||||||
|
|||||||
Reference in New Issue
Block a user