From Eric Sokolowsky, support for mouse scroll wheel in osgGA/osgProducer.
This commit is contained in:
parent
aa0d5fc52e
commit
ba8bf1e94c
@ -39,6 +39,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
enum EventType {
|
enum EventType {
|
||||||
|
NONE=0,
|
||||||
PUSH,
|
PUSH,
|
||||||
RELEASE,
|
RELEASE,
|
||||||
DOUBLECLICK,
|
DOUBLECLICK,
|
||||||
@ -48,7 +49,10 @@ public:
|
|||||||
KEYUP,
|
KEYUP,
|
||||||
FRAME,
|
FRAME,
|
||||||
RESIZE,
|
RESIZE,
|
||||||
NONE
|
SCROLLUP,
|
||||||
|
SCROLLDOWN,
|
||||||
|
SCROLLLEFT,
|
||||||
|
SCROLLRIGHT
|
||||||
};
|
};
|
||||||
|
|
||||||
enum KeySymbol
|
enum KeySymbol
|
||||||
|
@ -75,6 +75,9 @@ class OSGPRODUCER_EXPORT EventAdapter : public osgGA::GUIEventAdapter
|
|||||||
/** method for adapting resize events. */
|
/** method for adapting resize events. */
|
||||||
void adaptResize(double t, float Xmin, float Ymin, float Xmax, float Ymax);
|
void adaptResize(double t, float Xmin, float Ymin, float Xmax, float Ymax);
|
||||||
|
|
||||||
|
/** method for adapting mouse scroll wheel events. */
|
||||||
|
void adaptMouseScroll(double t, Producer::KeyboardMouseCallback::ScrollingMotion sm);
|
||||||
|
|
||||||
/** method for adapting mouse motion events whilst mouse buttons are pressed.*/
|
/** method for adapting mouse motion events whilst mouse buttons are pressed.*/
|
||||||
void adaptMouseMotion(double t, float x, float y);
|
void adaptMouseMotion(double t, float x, float y);
|
||||||
|
|
||||||
|
@ -41,6 +41,7 @@ class OSGPRODUCER_EXPORT KeyboardMouseCallback : public Producer::KeyboardMouseC
|
|||||||
virtual ~KeyboardMouseCallback() {}
|
virtual ~KeyboardMouseCallback() {}
|
||||||
|
|
||||||
// override KeyboardMouseCallback methods.
|
// override KeyboardMouseCallback methods.
|
||||||
|
virtual void mouseScroll( Producer::KeyboardMouseCallback::ScrollingMotion sm );
|
||||||
virtual void mouseMotion( float mx, float my);
|
virtual void mouseMotion( float mx, float my);
|
||||||
virtual void passiveMouseMotion( float mx, float my);
|
virtual void passiveMouseMotion( float mx, float my);
|
||||||
|
|
||||||
|
@ -68,6 +68,20 @@ void EventAdapter::adaptResize(double time, float Xmin, float Ymin, float Xmax,
|
|||||||
copyStaticVariables();
|
copyStaticVariables();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EventAdapter::adaptMouseScroll(double time, Producer::KeyboardMouseCallback::ScrollingMotion sm)
|
||||||
|
{
|
||||||
|
_time = time;
|
||||||
|
|
||||||
|
if (sm == Producer::KeyboardMouseCallback::ScrollUp)
|
||||||
|
_eventType = SCROLLUP;
|
||||||
|
else if (sm == Producer::KeyboardMouseCallback::ScrollDown)
|
||||||
|
_eventType = SCROLLDOWN;
|
||||||
|
else
|
||||||
|
_eventType = NONE;
|
||||||
|
|
||||||
|
copyStaticVariables();
|
||||||
|
}
|
||||||
|
|
||||||
void EventAdapter::adaptButtonPress(double time,float x, float y, unsigned int button)
|
void EventAdapter::adaptButtonPress(double time,float x, float y, unsigned int button)
|
||||||
{
|
{
|
||||||
_time = time;
|
_time = time;
|
||||||
|
@ -5,6 +5,16 @@
|
|||||||
|
|
||||||
using namespace osgProducer;
|
using namespace osgProducer;
|
||||||
|
|
||||||
|
void KeyboardMouseCallback::mouseScroll( Producer::KeyboardMouseCallback::ScrollingMotion sm )
|
||||||
|
{
|
||||||
|
osg::ref_ptr<EventAdapter> event = createEventAdapter();
|
||||||
|
event->adaptMouseScroll(getTime(), sm);
|
||||||
|
|
||||||
|
_eventQueueMutex.lock();
|
||||||
|
_eventQueue.push_back(event);
|
||||||
|
_eventQueueMutex.unlock();
|
||||||
|
}
|
||||||
|
|
||||||
void KeyboardMouseCallback::buttonPress( float mx, float my, unsigned int mbutton )
|
void KeyboardMouseCallback::buttonPress( float mx, float my, unsigned int mbutton )
|
||||||
{
|
{
|
||||||
_mx = mx;
|
_mx = mx;
|
||||||
|
Loading…
Reference in New Issue
Block a user