Skip to content

Commit 25e24e7

Browse files
committedMay 22, 2020
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
1 parent fb8cd81 commit 25e24e7

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
 

‎src/core/qgstemporalnavigationobject.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,24 @@ void QgsTemporalNavigationObject::pause()
218218

219219
void QgsTemporalNavigationObject::playForward()
220220
{
221+
if ( mPlayBackMode == Idle && mCurrentFrameNumber >= totalFrameCount() - 1 )
222+
{
223+
// if we are paused at the end of the video, and the user hits play, we automatically rewind and play again
224+
rewindToStart();
225+
}
226+
221227
setAnimationState( AnimationState::Forward );
222228
play();
223229
}
224230

225231
void QgsTemporalNavigationObject::playBackward()
226232
{
233+
if ( mPlayBackMode == Idle && mCurrentFrameNumber <= 0 )
234+
{
235+
// 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
236+
skipToEnd();
237+
}
238+
227239
setAnimationState( AnimationState::Reverse );
228240
play();
229241
}

0 commit comments

Comments
 (0)
Please sign in to comment.