From J.P. Delport, "simple addition to make the scroll wheel work in the example."
This commit is contained in:
parent
ec788e92f2
commit
1bc204a87f
@ -127,6 +127,7 @@ BEGIN_EVENT_TABLE(OSGCanvas, wxGLCanvas)
|
||||
EVT_MIDDLE_UP (OSGCanvas::OnMouseUp)
|
||||
EVT_RIGHT_UP (OSGCanvas::OnMouseUp)
|
||||
EVT_MOTION (OSGCanvas::OnMouseMotion)
|
||||
EVT_MOUSEWHEEL (OSGCanvas::OnMouseWheel)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
OSGCanvas::OSGCanvas(wxWindow *parent, wxWindowID id,
|
||||
@ -229,6 +230,18 @@ void OSGCanvas::OnMouseMotion(wxMouseEvent &event)
|
||||
_graphics_window->getEventQueue()->mouseMotion(event.GetX(), event.GetY());
|
||||
}
|
||||
|
||||
void OSGCanvas::OnMouseWheel(wxMouseEvent &event)
|
||||
{
|
||||
int delta = event.GetWheelRotation() / event.GetWheelDelta() * event.GetLinesPerAction();
|
||||
|
||||
if (_graphics_window.valid()) {
|
||||
_graphics_window->getEventQueue()->mouseScroll(
|
||||
delta>0 ?
|
||||
osgGA::GUIEventAdapter::SCROLL_UP :
|
||||
osgGA::GUIEventAdapter::SCROLL_DOWN);
|
||||
}
|
||||
}
|
||||
|
||||
void OSGCanvas::UseCursor(bool value)
|
||||
{
|
||||
if (value)
|
||||
|
@ -34,6 +34,7 @@ public:
|
||||
void OnMouseDown(wxMouseEvent &event);
|
||||
void OnMouseUp(wxMouseEvent &event);
|
||||
void OnMouseMotion(wxMouseEvent &event);
|
||||
void OnMouseWheel(wxMouseEvent &event);
|
||||
|
||||
void UseCursor(bool value);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user