diff --git a/src/Gui/CommandView.cpp b/src/Gui/CommandView.cpp
index 712131d68b..33da94c7c1 100644
--- a/src/Gui/CommandView.cpp
+++ b/src/Gui/CommandView.cpp
@@ -59,6 +59,7 @@
#include "DemoMode.h"
#include "TextureMapping.h"
#include "Utilities.h"
+#include "NavigationStyle.h"
#include
#include
@@ -1817,13 +1818,7 @@ void StdViewZoomIn::activated(int iMsg)
View3DInventor* view = qobject_cast(getMainWindow()->activeWindow());
if ( view ) {
View3DInventorViewer* viewer = view->getViewer();
-
- // send an event to the GL widget to use the internal View3DInventorViewer::zoom() method
- // do only one step to zoom in
- SoMouseButtonEvent e;
- e.setButton(SoMouseButtonEvent::BUTTON5);
- e.setState(SoMouseButtonEvent::DOWN);
- viewer->sendSoEvent(&e);
+ viewer->navigationStyle()->zoomIn();
}
}
@@ -1857,12 +1852,7 @@ void StdViewZoomOut::activated(int iMsg)
View3DInventor* view = qobject_cast(getMainWindow()->activeWindow());
if (view) {
View3DInventorViewer* viewer = view->getViewer();
- // send an event to the GL widget to use the internal View3DInventorViewer::zoom() method
- // do only one step to zoom out
- SoMouseButtonEvent e;
- e.setButton(SoMouseButtonEvent::BUTTON4);
- e.setState(SoMouseButtonEvent::DOWN);
- viewer->sendSoEvent(&e);
+ viewer->navigationStyle()->zoomOut();
}
}
diff --git a/src/Gui/NavigationStyle.cpp b/src/Gui/NavigationStyle.cpp
index 192cb7ae5a..30f5ecf402 100644
--- a/src/Gui/NavigationStyle.cpp
+++ b/src/Gui/NavigationStyle.cpp
@@ -721,6 +721,16 @@ void NavigationStyle::zoomByCursor(const SbVec2f & thispos, const SbVec2f & prev
zoom(viewer->getCamera(), (thispos[1] - prevpos[1]) * 10.0f/*20.0f*/);
}
+void NavigationStyle::zoomIn()
+{
+ zoom(viewer->getCamera(), -this->zoomStep);
+}
+
+void NavigationStyle::zoomOut()
+{
+ zoom(viewer->getCamera(), this->zoomStep);
+}
+
void NavigationStyle::doZoom(SoCamera* camera, SbBool forward, const SbVec2f& pos)
{
SbBool zoomAtCur = this->zoomAtCursor;
diff --git a/src/Gui/NavigationStyle.h b/src/Gui/NavigationStyle.h
index 7644a73403..b6d4e20e66 100644
--- a/src/Gui/NavigationStyle.h
+++ b/src/Gui/NavigationStyle.h
@@ -115,6 +115,8 @@ public:
void setZoomStep(float);
void setZoomAtCursor(SbBool);
SbBool isZoomAtCursor() const;
+ void zoomIn();
+ void zoomOut();
void updateAnimation();
void redraw();