diff --git a/src/Gui/Navigation/NavigationStyle.cpp b/src/Gui/Navigation/NavigationStyle.cpp index ca3d7c3887..7137011838 100644 --- a/src/Gui/Navigation/NavigationStyle.cpp +++ b/src/Gui/Navigation/NavigationStyle.cpp @@ -700,6 +700,19 @@ void NavigationStyle::reorientCamera(SoCamera* camera, const SbRotation& rotatio // Reposition camera so the rotation center stays in the same place camera->position = rotationCenter + newRotationCenterDistance; + if (camera->getTypeId().isDerivedFrom(SoOrthographicCamera::getClassTypeId())) { + // Adjust the camera position to keep the focal point in the same place while making sure + // the focal distance stays small. This increases rotation stability for small and large + // scenes + + SbVec3f direction; + camera->orientation.getValue().multVec(SbVec3f(0, 0, -1), direction); + + constexpr float orthographicFocalDistance = 1; + camera->position = getFocalPoint() - orthographicFocalDistance * direction; + camera->focalDistance = orthographicFocalDistance; + } + #if (COIN_MAJOR_VERSION * 100 + COIN_MINOR_VERSION * 10 + COIN_MICRO_VERSION < 403) // Fix issue with near clipping in orthogonal view if (camera->getTypeId().isDerivedFrom(SoOrthographicCamera::getClassTypeId())) {