Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 25e24e7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/core/qgstemporalnavigationobject.cpp
Expand Up @@ -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();
}
Expand Down

0 comments on commit 25e24e7

Please sign in to comment.