diff --git a/src/Gui/NavigationStyle.cpp b/src/Gui/NavigationStyle.cpp index 0d03e51d29..9618b78fa7 100644 --- a/src/Gui/NavigationStyle.cpp +++ b/src/Gui/NavigationStyle.cpp @@ -739,6 +739,13 @@ void NavigationStyle::doZoom(SoCamera* camera, float logfactor, const SbVec2f& p SbViewVolume vv = camera->getViewVolume(vp.getViewportAspectRatio()); SbPlane panplane = vv.getPlane(camera->focalDistance.getValue()); panCamera(viewer->getSoRenderManager()->getCamera(), ratio, panplane, pos, SbVec2f(0.5,0.5)); + + // Change the position of the rotation center indicator after zooming at cursor + // Rotation mode is WindowCenter + if (!rotationCenterMode) { + viewer->changeRotationCenterPosition(getFocalPoint()); + findBoundingSphere(); + } } } diff --git a/src/Gui/View3DInventorViewer.cpp b/src/Gui/View3DInventorViewer.cpp index fc4ff34ad1..734a4f51fe 100644 --- a/src/Gui/View3DInventorViewer.cpp +++ b/src/Gui/View3DInventorViewer.cpp @@ -1407,6 +1407,7 @@ void View3DInventorViewer::showRotationCenter(bool show) material->transparency = 1.0F - float(color.alphaF()); auto translation = new SoTranslation(); + translation->setName("translation"); translation->translation.setValue(center); auto annotation = new SoAnnotation(); @@ -1433,6 +1434,20 @@ void View3DInventorViewer::showRotationCenter(bool show) } } +// Changes the position of the rotation center indicator +void View3DInventorViewer::changeRotationCenterPosition(const SbVec3f& newCenter) { + if (!rotationCenterGroup) { + return; + } + + SoTranslation* translation = dynamic_cast(rotationCenterGroup->getByName("translation")); + if (!translation) { + return; + } + + translation->translation = newCenter; +} + void View3DInventorViewer::setNavigationType(Base::Type type) { if (this->navigation && this->navigation->getTypeId() == type) { diff --git a/src/Gui/View3DInventorViewer.h b/src/Gui/View3DInventorViewer.h index cb00008924..5d30e65523 100644 --- a/src/Gui/View3DInventorViewer.h +++ b/src/Gui/View3DInventorViewer.h @@ -416,6 +416,7 @@ public: bool hasAxisCross(); void showRotationCenter(bool show); + void changeRotationCenterPosition(const SbVec3f& newCenter); void setEnabledFPSCounter(bool on); void setEnabledNaviCube(bool on);