Merge pull request #518 from emminizer/fix-scroll-event

CompositeViewer: SCROLL event now only goes to view with focus.  Incl…
This commit is contained in:
OpenSceneGraph git repository 2018-04-03 17:17:59 +01:00 committed by GitHub
commit 23c3ea4ecc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1006,18 +1006,18 @@ void CompositeViewer::eventTraversal()
EVENT_FOR_ALL_VIEWS EVENT_FOR_ALL_VIEWS
}; };
EventClassification classifaction = EVENT_FOR_ALL_VIEWS; EventClassification classification = EVENT_FOR_ALL_VIEWS;
switch(event->getEventType()) switch(event->getEventType())
{ {
case(osgGA::GUIEventAdapter::CLOSE_WINDOW): case(osgGA::GUIEventAdapter::CLOSE_WINDOW):
case(osgGA::GUIEventAdapter::RESIZE): case(osgGA::GUIEventAdapter::RESIZE):
classifaction = EVENT_FOR_VIEWS_ASSOCIATED_WITH_WINDOW; classification = EVENT_FOR_VIEWS_ASSOCIATED_WITH_WINDOW;
break; break;
case(osgGA::GUIEventAdapter::QUIT_APPLICATION): case(osgGA::GUIEventAdapter::QUIT_APPLICATION):
case(osgGA::GUIEventAdapter::USER): case(osgGA::GUIEventAdapter::USER):
classifaction = EVENT_FOR_ALL_VIEWS; classification = EVENT_FOR_ALL_VIEWS;
break; break;
case(osgGA::GUIEventAdapter::PUSH): case(osgGA::GUIEventAdapter::PUSH):
@ -1025,6 +1025,7 @@ void CompositeViewer::eventTraversal()
case(osgGA::GUIEventAdapter::DOUBLECLICK): case(osgGA::GUIEventAdapter::DOUBLECLICK):
case(osgGA::GUIEventAdapter::MOVE): case(osgGA::GUIEventAdapter::MOVE):
case(osgGA::GUIEventAdapter::DRAG): case(osgGA::GUIEventAdapter::DRAG):
case(osgGA::GUIEventAdapter::SCROLL):
{ {
if ((event->getEventType()!=osgGA::GUIEventAdapter::DRAG && event->getEventType()!=osgGA::GUIEventAdapter::RELEASE) || if ((event->getEventType()!=osgGA::GUIEventAdapter::DRAG && event->getEventType()!=osgGA::GUIEventAdapter::RELEASE) ||
!_previousEvent || !_previousEvent ||
@ -1040,7 +1041,7 @@ void CompositeViewer::eventTraversal()
_previousEvent = event; _previousEvent = event;
classifaction = EVENT_FOR_VIEW_ASSOCIATED_WITH_FOCUS; classification = EVENT_FOR_VIEW_ASSOCIATED_WITH_FOCUS;
break; break;
} }
@ -1071,7 +1072,7 @@ void CompositeViewer::eventTraversal()
// reassign view with focus // reassign view with focus
if (_viewWithFocus != view) _viewWithFocus = view; if (_viewWithFocus != view) _viewWithFocus = view;
switch(classifaction) switch(classification)
{ {
case(EVENT_FOR_VIEW_ASSOCIATED_WITH_FOCUS): case(EVENT_FOR_VIEW_ASSOCIATED_WITH_FOCUS):
{ {