Gui: Set exact orientation when animation is finished

This commit is contained in:
Rexbas
2023-10-22 18:27:19 +02:00
committed by wwmayer
parent 990e4a2677
commit fd007dcfd6
2 changed files with 21 additions and 0 deletions

View File

@@ -97,6 +97,23 @@ void FixedTimeAnimation::update(const QVariant& value)
prevTranslation = translation;
}
/**
* @param finished True when the animation is finished, false when interrupted
*/
void FixedTimeAnimation::onStop(bool finished)
{
if (finished) {
SoCamera* camera = navigation->getCamera();
if (!camera) {
return;
}
// Set exact target orientation
camera->orientation = targetOrientation;
camera->position = camera->position.getValue() + targetTranslation - prevTranslation;
}
}
/**
* @param navigation The navigation style
* @param axis The rotation axis in screen coordinates
@@ -137,6 +154,9 @@ void SpinningAnimation::update(const QVariant& value)
prevAngle = value.toFloat();
}
/**
* @param finished True when the animation is finished, false when interrupted
*/
void SpinningAnimation::onStop(bool finished)
{
if (navigation->getViewingMode() != NavigationStyle::SPINNING) {