The wheel event is handled in NavigationStyle::processSoEvent
Code: Select all
SbBool NavigationStyle::processSoEvent(const SoEvent * const ev)
{
bool processed = false;
//handle mouse wheel zoom
if (ev->isOfType(SoMouseWheelEvent::getClassTypeId())) {
const SoMouseWheelEvent * const event = static_cast<const SoMouseWheelEvent *>(ev);
processed = processWheelEvent(event);
}
if (!processed) {
processed = viewer->processSoEventBase(ev);
}
return processed;
}
Here are the four steps to make it working:
Step 1:
To make sure that it's also passed to the scene graph make a small change:
Code: Select all
SbBool NavigationStyle::processSoEvent(const SoEvent * const ev)
{
bool processed = false;
//handle mouse wheel zoom
if (ev->isOfType(SoMouseWheelEvent::getClassTypeId())) {
const SoMouseWheelEvent * const event = static_cast<const SoMouseWheelEvent *>(ev);
processed = processWheelEvent(event);
viewer->processSoEventBase(ev); /// <<<< ============ Add this line
}
if (!processed) {
processed = viewer->processSoEventBase(ev);
}
return processed;
}
Hint: We can be sure that no standard Inventor node will handle this event because it's a custom event that DeepSOIC has added.
Step 2:
Add a new event handler to ViewProvider mouseWheelEvent() with the required information in its interface.
Step 3:
Adjust ViewProvider::eventCallback to handle the SoMouseWheelEvent
Step 4:
Override mouseWheelEvent() in ViewProviderSketch