Gui: Show context menu on right click in OpenSCAD navigation style if not panned

This commit is contained in:
Rexbas
2023-12-26 12:00:20 +01:00
parent 2c8ba7f2c3
commit be09701e8b
3 changed files with 13 additions and 3 deletions

View File

@@ -257,6 +257,8 @@ void NavigationStyle::initialize()
setRotationCenterMode(NavigationStyle::RotationCenterMode::ScenePointAtCursor |
NavigationStyle::RotationCenterMode::BoundingBoxCenter);
}
this->hasPanned = false;
}
void NavigationStyle::finalize()
@@ -583,6 +585,7 @@ void NavigationStyle::panCamera(SoCamera * cam, float aspectratio, const SbPlane
// Reposition camera according to the vector difference between the
// projected points.
cam->position = cam->position.getValue() - (current_planept - old_planept);
hasPanned = true;
}
void NavigationStyle::pan(SoCamera* camera)
@@ -1365,6 +1368,7 @@ void NavigationStyle::setViewingMode(const ViewerMode newmode)
case PANNING:
animator->stop();
pan(viewer->getSoRenderManager()->getCamera());
hasPanned = false;
this->interactiveCountInc();
break;
@@ -1386,8 +1390,12 @@ void NavigationStyle::setViewingMode(const ViewerMode newmode)
case SPINNING:
case DRAGGING:
viewer->showRotationCenter(false);
[[fallthrough]];
this->interactiveCountDec();
break;
case PANNING:
hasPanned = false;
this->interactiveCountDec();
break;
case ZOOMING:
case BOXZOOM:
this->interactiveCountDec();