Gui: move handling of SoMouseWheelEvent to its own handler function
This commit is contained in:
@@ -72,6 +72,7 @@
|
||||
#include "GestureNavigationStyle.h"
|
||||
|
||||
#include <App/Application.h>
|
||||
#include <Base/Interpreter.h>
|
||||
#include <Base/Console.h>
|
||||
#include "View3DInventorViewer.h"
|
||||
#include "Application.h"
|
||||
|
||||
@@ -1495,24 +1495,19 @@ SbBool NavigationStyle::processEvent(const SoEvent * const ev)
|
||||
|
||||
SbBool NavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
{
|
||||
const SbVec2s pos(ev->getPosition());
|
||||
const SbVec2f posn = normalizePixelPos(pos);
|
||||
bool processed = false;
|
||||
|
||||
//handle mouse wheel zoom
|
||||
if(ev->isOfType(SoMouseWheelEvent::getClassTypeId())){
|
||||
doZoom(
|
||||
viewer->getSoRenderManager()->getCamera(),
|
||||
static_cast<const SoMouseWheelEvent*>(ev)->getDelta(),
|
||||
posn
|
||||
);
|
||||
processed = true;
|
||||
if (ev->isOfType(SoMouseWheelEvent::getClassTypeId())) {
|
||||
const SoMouseWheelEvent * const event = static_cast<const SoMouseWheelEvent *>(ev);
|
||||
processed = processWheelEvent(event);
|
||||
}
|
||||
|
||||
if (! processed)
|
||||
return viewer->processSoEventBase(ev);
|
||||
else
|
||||
return processed;
|
||||
if (!processed) {
|
||||
processed = viewer->processSoEventBase(ev);
|
||||
}
|
||||
|
||||
return processed;
|
||||
}
|
||||
|
||||
void NavigationStyle::syncWithEvent(const SoEvent * const ev)
|
||||
@@ -1692,6 +1687,17 @@ SbBool NavigationStyle::processClickEvent(const SoMouseButtonEvent * const event
|
||||
return processed;
|
||||
}
|
||||
|
||||
SbBool NavigationStyle::processWheelEvent(const SoMouseWheelEvent * const event)
|
||||
{
|
||||
const SbVec2s pos(event->getPosition());
|
||||
const SbVec2f posn = normalizePixelPos(pos);
|
||||
|
||||
//handle mouse wheel zoom
|
||||
doZoom(viewer->getSoRenderManager()->getCamera(),
|
||||
event->getDelta(), posn);
|
||||
return true;
|
||||
}
|
||||
|
||||
void NavigationStyle::setPopupMenuEnabled(const SbBool on)
|
||||
{
|
||||
this->menuenabled = on;
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
|
||||
// forward declarations
|
||||
class SoEvent;
|
||||
class SoMouseWheelEvent;
|
||||
class SoMotion3Event;
|
||||
class SoQtViewer;
|
||||
class SoCamera;
|
||||
@@ -154,6 +155,7 @@ public:
|
||||
virtual SbBool processMotionEvent(const SoMotion3Event * const ev);
|
||||
virtual SbBool processKeyboardEvent(const SoKeyboardEvent * const event);
|
||||
virtual SbBool processClickEvent(const SoMouseButtonEvent * const event);
|
||||
virtual SbBool processWheelEvent(const SoMouseWheelEvent * const event);
|
||||
|
||||
void setPopupMenuEnabled(const SbBool on);
|
||||
SbBool isPopupMenuEnabled() const;
|
||||
|
||||
Reference in New Issue
Block a user