0000712: Cad Navigation Zoom with Ctrl + causes shapes to pan off screen

This commit is contained in:
wmayer 2012-05-21 18:27:30 +02:00 committed by logari81
parent 87f1e93fea
commit 27de3f76f4
3 changed files with 15 additions and 13 deletions

View File

@ -59,6 +59,7 @@
#include "DemoMode.h"
#include "TextureMapping.h"
#include "Utilities.h"
#include "NavigationStyle.h"
#include <Base/Console.h>
#include <Base/Exception.h>
@ -1817,13 +1818,7 @@ void StdViewZoomIn::activated(int iMsg)
View3DInventor* view = qobject_cast<View3DInventor*>(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<View3DInventor*>(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();
}
}

View File

@ -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;

View File

@ -115,6 +115,8 @@ public:
void setZoomStep(float);
void setZoomAtCursor(SbBool);
SbBool isZoomAtCursor() const;
void zoomIn();
void zoomOut();
void updateAnimation();
void redraw();