diff options
author | Thorsten Behrens <thorsten.behrens@allotropia.de> | 2022-04-14 12:01:50 +0200 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2022-04-20 12:07:34 +0200 |
commit | 007e21825ca4093f39bcdca8f5c2a0e6df0c205e (patch) | |
tree | d119f277b7751bec371e94295e44857007ef7989 | |
parent | 421abb60875e88432f5d0c6ad4d6dbd8e483647f (diff) |
Resolves: tdf#143615 clamp relative times to 1.0
User input permits zero-length animations, so whenever we calculate
relative position within the animation time frame, the case
mnMinSimpleDuration == 0.0 means: we're already at the end of the
animation, i.e. set relative time to 1.0
Change-Id: I0e8c1e29f47bd9fa16f04115cf52d3a176e13fb0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133005
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
(cherry picked from commit e1db8c27875eac73b1e619e4a23ecdb7a9924b61)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133038
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
(cherry picked from commit 01c5006db900e3911e6bf8cb7abc2935e8215ded)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133044
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Tested-by: Michael Stahl <michael.stahl@allotropia.de>
-rw-r--r-- | slideshow/source/engine/activities/simplecontinuousactivitybase.cxx | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/slideshow/source/engine/activities/simplecontinuousactivitybase.cxx b/slideshow/source/engine/activities/simplecontinuousactivitybase.cxx index 9e23fc2c76c8..01cb3b75007b 100644 --- a/slideshow/source/engine/activities/simplecontinuousactivitybase.cxx +++ b/slideshow/source/engine/activities/simplecontinuousactivitybase.cxx @@ -63,9 +63,12 @@ namespace slideshow::internal // perform will be called at least mnMinNumberOfTurns // times. - // fraction of time elapsed + // fraction of time elapsed (clamp to 1.0 for zero-length + // animations) const double nFractionElapsedTime( - nCurrElapsedTime / mnMinSimpleDuration ); + mnMinSimpleDuration != 0.0 ? + nCurrElapsedTime / mnMinSimpleDuration : + 1.0 ); // fraction of minimum calls performed const double nFractionRequiredCalls( @@ -115,7 +118,10 @@ namespace slideshow::internal // =============================== const double nCurrElapsedTime( maTimer.getElapsedTime() ); - double nT( nCurrElapsedTime / mnMinSimpleDuration ); + // clamp to 1.0 for zero animation duration + double nT( mnMinSimpleDuration != 0.0 ? + nCurrElapsedTime / mnMinSimpleDuration : + 1.0 ); // one of the stop criteria reached? |