Gui: Improve lookAtPoint (#13556)

* Gui: Rename NavigationStyle::pan to setupPanningPlane

* Gui: Replace duplicate code with NavigationStyle::setupPanningPlane

* Gui: Use panning plane when hit point not found in lookAtPoint

Also enables navigation animations when pressing MMB while the mouse is not over an object

* Gui: Remove unused methods
This commit is contained in:
Bas Ruigrok
2024-05-06 17:45:14 +02:00
committed by GitHub
parent f3590de466
commit 98320cc839
12 changed files with 67 additions and 109 deletions

View File

@@ -126,9 +126,7 @@ SbBool InventorNavigationStyle::processSoEvent(const SoEvent * const ev)
if (press && ev->wasShiftDown() &&
(this->currentmode != NavigationStyle::SELECTION)) {
this->centerTime = ev->getTime();
float ratio = vp.getViewportAspectRatio();
SbViewVolume vv = viewer->getSoRenderManager()->getCamera()->getViewVolume(ratio);
this->panningplane = vv.getPlane(viewer->getSoRenderManager()->getCamera()->focalDistance.getValue());
setupPanningPlane(getCamera());
this->lockrecenter = false;
}
else if (!press && ev->wasShiftDown() &&
@@ -137,10 +135,7 @@ SbBool InventorNavigationStyle::processSoEvent(const SoEvent * const ev)
float dci = (float)QApplication::doubleClickInterval()/1000.0f;
// is it just a left click?
if (tmp.getValue() < dci && !this->lockrecenter) {
if (!this->lookAtPoint(pos)) {
panToCenter(panningplane, posn);
this->interactiveCountDec();
}
lookAtPoint(pos);
processed = true;
}
}
@@ -191,9 +186,7 @@ SbBool InventorNavigationStyle::processSoEvent(const SoEvent * const ev)
case SoMouseButtonEvent::BUTTON3:
if (press) {
this->centerTime = ev->getTime();
float ratio = vp.getViewportAspectRatio();
SbViewVolume vv = viewer->getSoRenderManager()->getCamera()->getViewVolume(ratio);
this->panningplane = vv.getPlane(viewer->getSoRenderManager()->getCamera()->focalDistance.getValue());
setupPanningPlane(getCamera());
this->lockrecenter = false;
}
else {
@@ -201,10 +194,7 @@ SbBool InventorNavigationStyle::processSoEvent(const SoEvent * const ev)
float dci = (float)QApplication::doubleClickInterval()/1000.0f;
// is it just a middle click?
if (tmp.getValue() < dci && !this->lockrecenter) {
if (!this->lookAtPoint(pos)) {
panToCenter(panningplane, posn);
this->interactiveCountDec();
}
lookAtPoint(pos);
processed = true;
}
}