diff --git a/src/Gui/NavigationStyle.cpp b/src/Gui/NavigationStyle.cpp index f9bf75db2c..1c83ef22f2 100644 --- a/src/Gui/NavigationStyle.cpp +++ b/src/Gui/NavigationStyle.cpp @@ -257,6 +257,8 @@ void NavigationStyle::initialize() setRotationCenterMode(NavigationStyle::RotationCenterMode::ScenePointAtCursor | NavigationStyle::RotationCenterMode::BoundingBoxCenter); } + + this->hasPanned = false; } void NavigationStyle::finalize() @@ -583,6 +585,7 @@ void NavigationStyle::panCamera(SoCamera * cam, float aspectratio, const SbPlane // Reposition camera according to the vector difference between the // projected points. cam->position = cam->position.getValue() - (current_planept - old_planept); + hasPanned = true; } void NavigationStyle::pan(SoCamera* camera) @@ -1365,6 +1368,7 @@ void NavigationStyle::setViewingMode(const ViewerMode newmode) case PANNING: animator->stop(); pan(viewer->getSoRenderManager()->getCamera()); + hasPanned = false; this->interactiveCountInc(); break; @@ -1386,8 +1390,12 @@ void NavigationStyle::setViewingMode(const ViewerMode newmode) case SPINNING: case DRAGGING: viewer->showRotationCenter(false); - [[fallthrough]]; + this->interactiveCountDec(); + break; case PANNING: + hasPanned = false; + this->interactiveCountDec(); + break; case ZOOMING: case BOXZOOM: this->interactiveCountDec(); diff --git a/src/Gui/NavigationStyle.h b/src/Gui/NavigationStyle.h index e3e22e4761..54c04344c9 100644 --- a/src/Gui/NavigationStyle.h +++ b/src/Gui/NavigationStyle.h @@ -259,6 +259,7 @@ protected: SbBool invertZoom; SbBool zoomAtCursor; float zoomStep; + SbBool hasPanned; /** @name Mouse model */ //@{ diff --git a/src/Gui/OpenSCADNavigationStyle.cpp b/src/Gui/OpenSCADNavigationStyle.cpp index 3a9b183a8b..e03c9f8e3f 100644 --- a/src/Gui/OpenSCADNavigationStyle.cpp +++ b/src/Gui/OpenSCADNavigationStyle.cpp @@ -143,9 +143,10 @@ SbBool OpenSCADNavigationStyle::processSoEvent(const SoEvent * const ev) if (!viewer->isEditing()) { // If we are in zoom or pan mode ignore RMB events otherwise // the canvas doesn't get any release events - if (curmode != NavigationStyle::ZOOMING && + if ((curmode != NavigationStyle::ZOOMING && curmode != NavigationStyle::PANNING && - curmode != NavigationStyle::DRAGGING) { + curmode != NavigationStyle::DRAGGING) || + (curmode == NavigationStyle::PANNING && !hasPanned)) { if (this->isPopupMenuEnabled()) { if (!press) { // release right mouse button this->openPopupMenu(event->getPosition());