Skip to content
Permalink
Browse files

Tweak temporal playback behavior

If a non-looping animation is paused at the end and the user hits the play
button again, auto rewind and play the animation from the start
  • Loading branch information
nyalldawson committed May 22, 2020
1 parent fb8cd81 commit 25e24e7d2ab9267d0b2d0b3919ce2a4f05f8234f
Showing with 12 additions and 0 deletions.
  1. +12 −0 src/core/qgstemporalnavigationobject.cpp
@@ -218,12 +218,24 @@ void QgsTemporalNavigationObject::pause()

void QgsTemporalNavigationObject::playForward()
{
if ( mPlayBackMode == Idle && mCurrentFrameNumber >= totalFrameCount() - 1 )
{
// if we are paused at the end of the video, and the user hits play, we automatically rewind and play again
rewindToStart();
}

setAnimationState( AnimationState::Forward );
play();
}

void QgsTemporalNavigationObject::playBackward()
{
if ( mPlayBackMode == Idle && mCurrentFrameNumber <= 0 )
{
// if we are paused at the start of the video, and the user hits play, we automatically skip to end and play in reverse again
skipToEnd();
}

setAnimationState( AnimationState::Reverse );
play();
}

0 comments on commit 25e24e7

Please sign in to comment.
You can’t perform that action at this time.