Merge pull request #11519 from Rexbas/rotation-center-zoom
Gui: Update rotation center indicator after zoom
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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<SoTranslation*>(rotationCenterGroup->getByName("translation"));
|
||||
if (!translation) {
|
||||
return;
|
||||
}
|
||||
|
||||
translation->translation = newCenter;
|
||||
}
|
||||
|
||||
void View3DInventorViewer::setNavigationType(Base::Type type)
|
||||
{
|
||||
if (this->navigation && this->navigation->getTypeId() == type) {
|
||||
|
||||
@@ -416,6 +416,7 @@ public:
|
||||
bool hasAxisCross();
|
||||
|
||||
void showRotationCenter(bool show);
|
||||
void changeRotationCenterPosition(const SbVec3f& newCenter);
|
||||
|
||||
void setEnabledFPSCounter(bool on);
|
||||
void setEnabledNaviCube(bool on);
|
||||
|
||||
Reference in New Issue
Block a user