From 27878aa0965f2dfc503bac4e0a12a8a2fac3e548 Mon Sep 17 00:00:00 2001 From: Alessandro Bono Date: Fri, 20 Oct 2023 22:00:40 +0200 Subject: [PATCH] animationUtils: Allow marking animations as required There are cases when we want to mark an animation as required. For example, we want the "Locate Pointer" animation to work even when the animation is marked as disabled. Take this into account when adjusting the animation time. Part-of: --- js/misc/animationUtils.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/js/misc/animationUtils.js b/js/misc/animationUtils.js index a7a0ea8b0..cf6889609 100644 --- a/js/misc/animationUtils.js +++ b/js/misc/animationUtils.js @@ -13,14 +13,20 @@ const N_WIGGLES = 3; * adjustAnimationTime: * * @param {number} msecs - time in milliseconds + * @param {object} params - optional parameters + * @param {boolean=} params.animationRequired - whether to ignore the enable-animations setting * * Adjust `msecs` to account for St's enable-animations * and slow-down-factor settings */ -export function adjustAnimationTime(msecs) { +export function adjustAnimationTime(msecs, params) { + params = Params.parse(params, { + animationRequired: false, + }); + const settings = St.Settings.get(); - if (!settings.enable_animations) + if (!settings.enable_animations && !params.animationRequired) return 0; return settings.slow_down_factor * msecs; }