From 25e24e7d2ab9267d0b2d0b3919ce2a4f05f8234f Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Fri, 22 May 2020 13:59:37 +1000 Subject: [PATCH] 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 --- src/core/qgstemporalnavigationobject.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/core/qgstemporalnavigationobject.cpp b/src/core/qgstemporalnavigationobject.cpp index 0cadd48399c2..f4fb4b343709 100644 --- a/src/core/qgstemporalnavigationobject.cpp +++ b/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(); }