ripples: Allow to specify whether the ripple is required

The ripples are used both for the "Hot Corner" animation and for the
"Locate Pointer" animation. The latter one is an accessibility feature
and should always work, even when animations are disabled. Take this
into account.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2986>
This commit is contained in:
Alessandro Bono 2023-10-20 22:00:55 +02:00 committed by Marge Bot
parent 8c7965f048
commit fc7e2bc65b

View File

@ -3,12 +3,13 @@ import St from 'gi://St';
// Shamelessly copied from the layout "hotcorner" ripples implementation
export class Ripples {
constructor(px, py, styleClass) {
constructor(px, py, styleClass, animationRequired = false) {
this._x = 0;
this._y = 0;
this._px = px;
this._py = py;
this._animationRequired = animationRequired;
this._ripple1 = new St.BoxLayout({
style_class: styleClass,
@ -58,11 +59,13 @@ export class Ripples {
ripple.opacity = 255 * Math.sqrt(startOpacity);
ripple.scale_x = ripple.scale_y = startScale;
ripple.set_translation(-this._px * ripple.width, -this._py * ripple.height, 0.0);
const animationRequired = this._animationRequired;
ripple.ease({
opacity: 0,
delay,
duration,
animationRequired,
mode: Clutter.AnimationMode.EASE_IN_QUAD,
});
ripple.ease({
@ -70,6 +73,7 @@ export class Ripples {
scale_y: finalScale,
delay,
duration,
animationRequired,
mode: Clutter.AnimationMode.LINEAR,
onComplete: () => (ripple.visible = false),
});