diff --git a/src/Gui/NavigationStyle.cpp b/src/Gui/NavigationStyle.cpp index bfde8185f3..c437ef4f40 100644 --- a/src/Gui/NavigationStyle.cpp +++ b/src/Gui/NavigationStyle.cpp @@ -1493,14 +1493,17 @@ SbBool NavigationStyle::processEvent(const SoEvent * const ev) SbBool NavigationStyle::processSoEvent(const SoEvent * const ev) { bool processed = false; + bool offeredtoViewerEventBase = false; //handle mouse wheel zoom if (ev->isOfType(SoMouseWheelEvent::getClassTypeId())) { const SoMouseWheelEvent * const event = static_cast(ev); processed = processWheelEvent(event); + viewer->processSoEventBase(ev); + offeredtoViewerEventBase = true; } - if (!processed) { + if (!processed && !offeredtoViewerEventBase) { processed = viewer->processSoEventBase(ev); } diff --git a/src/Gui/ViewProvider.cpp b/src/Gui/ViewProvider.cpp index 8afa9fbc8b..662609f5ce 100644 --- a/src/Gui/ViewProvider.cpp +++ b/src/Gui/ViewProvider.cpp @@ -41,6 +41,7 @@ #include #include +#include "SoMouseWheelEvent.h" #include "ViewProvider.h" #include "ActionFunction.h" #include "Application.h" @@ -217,7 +218,7 @@ void ViewProvider::eventCallback(void * ud, SoEventCallback * node) // Therefore, we shall ignore ESC while any mouse button is // pressed, until this Coin bug is fixed. if (!press) { - // react only on key release + // react only on key release // Let first selection mode terminate Gui::Document* doc = Gui::Application::Instance->activeDocument(); Gui::View3DInventor* view = static_cast(doc->getActiveView()); @@ -229,7 +230,7 @@ void ViewProvider::eventCallback(void * ud, SoEventCallback * node) return; } } - + Gui::TimerFunction* func = new Gui::TimerFunction(); func->setAutoDelete(true); func->setFunction(boost::bind(&Document::resetEdit, doc)); @@ -258,6 +259,12 @@ void ViewProvider::eventCallback(void * ud, SoEventCallback * node) if (self->mouseButtonPressed(button,press,ev->getPosition(),viewer)) node->setHandled(); } + else if (ev->getTypeId().isDerivedFrom(SoMouseWheelEvent::getClassTypeId())) { + const SoMouseWheelEvent * const event = (const SoMouseWheelEvent *) ev; + + if (self->mouseWheelEvent(event->getDelta(), event->getPosition(), viewer)) + node->setHandled(); + } // Mouse Movement handling else if (ev->getTypeId().isDerivedFrom(SoLocation2Event::getClassTypeId())) { if (self->mouseMove(ev->getPosition(),viewer)) @@ -670,6 +677,14 @@ bool ViewProvider::mouseButtonPressed(int button, bool pressed, return false; } +bool ViewProvider::mouseWheelEvent(int delta, const SbVec2s &cursorPos, const View3DInventorViewer* viewer) +{ + (void) delta; + (void) cursorPos; + (void) viewer; + return false; +} + void ViewProvider::setupContextMenu(QMenu* menu, QObject* receiver, const char* method) { auto vector = getExtensionsDerivedFromType(); diff --git a/src/Gui/ViewProvider.h b/src/Gui/ViewProvider.h index cca5f8e442..40f5707ae9 100644 --- a/src/Gui/ViewProvider.h +++ b/src/Gui/ViewProvider.h @@ -468,6 +468,8 @@ public: /// is called when the Provider is in edit and the mouse is clicked virtual bool mouseButtonPressed(int button, bool pressed, const SbVec2s &cursorPos, const View3DInventorViewer* viewer); + + virtual bool mouseWheelEvent(int delta, const SbVec2s &cursorPos, const View3DInventorViewer* viewer); /// set up the context-menu with the supported edit modes virtual void setupContextMenu(QMenu*, QObject*, const char*);