Gui: Prevent showing the context menu after dragging, panning or zooming

This commit is contained in:
Rexbas
2024-01-20 16:27:25 +01:00
parent 62c3836c97
commit dfa20b4648
10 changed files with 76 additions and 71 deletions

View File

@@ -260,6 +260,7 @@ void NavigationStyle::initialize()
this->hasDragged = false;
this->hasPanned = false;
this->hasZoomed = false;
}
void NavigationStyle::finalize()
@@ -586,7 +587,10 @@ 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;
if (this->currentmode != NavigationStyle::IDLE) {
hasPanned = true;
}
}
void NavigationStyle::pan(SoCamera* camera)
@@ -695,6 +699,10 @@ void NavigationStyle::zoom(SoCamera * cam, float diffvalue)
cam->focalDistance = newfocaldist;
}
}
if (this->currentmode != NavigationStyle::IDLE) {
hasZoomed = true;
}
}
// Calculate a zoom/dolly factor from the difference of the current
@@ -900,7 +908,9 @@ void NavigationStyle::spin(const SbVec2f & pointerpos)
// animation.
if (this->spinsamplecounter > 3) this->spinsamplecounter = 3;
hasDragged = true;
if (this->currentmode != NavigationStyle::IDLE) {
hasDragged = true;
}
}
/*!
@@ -1352,9 +1362,10 @@ void NavigationStyle::setViewingMode(const ViewerMode newmode)
return;
}
if (newmode != NavigationStyle::IDLE) {
if (newmode == NavigationStyle::IDLE) {
hasPanned = false;
hasDragged = false;
hasZoomed = false;
}
switch (newmode) {