refactor: Move camera restore state animation to Camera
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
@@ -330,50 +330,14 @@ void ViewportWidget::onPlaneSelectionModeStarted()
|
||||
|
||||
void ViewportWidget::onSketchModeEnded()
|
||||
{
|
||||
auto* animGroup = new QParallelAnimationGroup(this);
|
||||
m_camera->animateRestoreState();
|
||||
}
|
||||
|
||||
auto* xRotAnim = new QPropertyAnimation(m_camera, "xRotation");
|
||||
xRotAnim->setDuration(300);
|
||||
xRotAnim->setStartValue(m_camera->xRotation());
|
||||
xRotAnim->setEndValue(m_camera->savedXRot());
|
||||
xRotAnim->setEasingCurve(QEasingCurve::InOutQuad);
|
||||
animGroup->addAnimation(xRotAnim);
|
||||
|
||||
auto* yRotAnim = new QPropertyAnimation(m_camera, "yRotation");
|
||||
yRotAnim->setDuration(300);
|
||||
yRotAnim->setStartValue(m_camera->yRotation());
|
||||
yRotAnim->setEndValue(m_camera->savedYRot());
|
||||
yRotAnim->setEasingCurve(QEasingCurve::InOutQuad);
|
||||
animGroup->addAnimation(yRotAnim);
|
||||
|
||||
auto* panXAnim = new QPropertyAnimation(m_camera, "panX");
|
||||
panXAnim->setDuration(300);
|
||||
panXAnim->setStartValue(m_camera->panX());
|
||||
panXAnim->setEndValue(m_camera->savedPanX());
|
||||
panXAnim->setEasingCurve(QEasingCurve::InOutQuad);
|
||||
animGroup->addAnimation(panXAnim);
|
||||
|
||||
auto* panYAnim = new QPropertyAnimation(m_camera, "panY");
|
||||
panYAnim->setDuration(300);
|
||||
panYAnim->setStartValue(m_camera->panY());
|
||||
panYAnim->setEndValue(m_camera->savedPanY());
|
||||
panYAnim->setEasingCurve(QEasingCurve::InOutQuad);
|
||||
animGroup->addAnimation(panYAnim);
|
||||
|
||||
auto* zoomAnim = new QPropertyAnimation(m_camera, "zoom");
|
||||
zoomAnim->setDuration(300);
|
||||
zoomAnim->setStartValue(m_camera->zoom());
|
||||
zoomAnim->setEndValue(m_camera->savedZoom());
|
||||
zoomAnim->setEasingCurve(QEasingCurve::InOutQuad);
|
||||
animGroup->addAnimation(zoomAnim);
|
||||
|
||||
connect(animGroup, &QParallelAnimationGroup::finished, this, [this]() {
|
||||
void ViewportWidget::onRestoreStateAnimationFinished()
|
||||
{
|
||||
// Return to showing the base XY grid when not in a sketch
|
||||
m_currentPlane = SketchPlane::XY;
|
||||
update();
|
||||
});
|
||||
|
||||
animGroup->start(QAbstractAnimation::DeleteWhenStopped);
|
||||
}
|
||||
|
||||
QVector3D ViewportWidget::project(const QVector3D& worldCoord, const QMatrix4x4& modelView, const QMatrix4x4& projection, const QRect& viewport)
|
||||
|
||||
Reference in New Issue
Block a user