Gui: Only show context menu if not dragged in TinkerCAD navigation style

This commit is contained in:
Rexbas
2023-12-26 12:16:50 +01:00
parent 8588335c7f
commit 286ebec851
3 changed files with 18 additions and 24 deletions

View File

@@ -258,6 +258,7 @@ void NavigationStyle::initialize()
NavigationStyle::RotationCenterMode::BoundingBoxCenter);
}
this->hasDragged = false;
this->hasPanned = false;
}
@@ -898,6 +899,8 @@ void NavigationStyle::spin(const SbVec2f & pointerpos)
// when the user quickly trigger (as in "click-drag-release") a spin
// animation.
if (this->spinsamplecounter > 3) this->spinsamplecounter = 3;
hasDragged = true;
}
/*!
@@ -932,6 +935,7 @@ void NavigationStyle::spin_simplified(SoCamera* cam, SbVec2f curpos, SbVec2f pre
r.invert();
this->reorientCamera(cam, r);
hasDragged = true;
}
SbBool NavigationStyle::doSpin()
@@ -1348,6 +1352,11 @@ void NavigationStyle::setViewingMode(const ViewerMode newmode)
return;
}
if (newmode != NavigationStyle::IDLE) {
hasPanned = false;
hasDragged = false;
}
switch (newmode) {
case DRAGGING:
// Set up initial projection point for the projector object when
@@ -1368,7 +1377,6 @@ void NavigationStyle::setViewingMode(const ViewerMode newmode)
case PANNING:
animator->stop();
pan(viewer->getSoRenderManager()->getCamera());
hasPanned = false;
this->interactiveCountInc();
break;
@@ -1390,12 +1398,8 @@ void NavigationStyle::setViewingMode(const ViewerMode newmode)
case SPINNING:
case DRAGGING:
viewer->showRotationCenter(false);
this->interactiveCountDec();
break;
[[fallthrough]];
case PANNING:
hasPanned = false;
this->interactiveCountDec();
break;
case ZOOMING:
case BOXZOOM:
this->interactiveCountDec();