[gnome-shell/gnome-3-34] animation: Add parameter for hiding stopped Spinner actor



commit e257be64d0dca0b25f35b8969eb893742d6f624a
Author: Joonas Henriksson <joonas henriksson gmail com>
Date:   Mon Nov 18 22:24:05 2019 +0200

    animation: Add parameter for hiding stopped Spinner actor
    
    Not hiding leaves the empty actor space visible, which may have an
    undesirable effect on the parent element's size or spacing/padding.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/834

 js/ui/animation.js | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/animation.js b/js/ui/animation.js
index ed4637b720..cae0b5fecb 100644
--- a/js/ui/animation.js
+++ b/js/ui/animation.js
@@ -140,12 +140,15 @@ var Spinner = class extends AnimatedIcon {
 
         params = Params.parse(params, {
             animate: false,
+            hideOnStop: false,
         });
         let file = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/process-working.svg');
         super(file, size);
 
         this.actor.opacity = 0;
         this._animate = params.animate;
+        this._hideOnStop = params.hideOnStop;
+        this.actor.visible = !this._hideOnStop;
     }
 
     _onDestroy() {
@@ -155,6 +158,7 @@ var Spinner = class extends AnimatedIcon {
 
     play() {
         this.actor.remove_all_transitions();
+        this.actor.show();
 
         if (this._animate) {
             super.play();
@@ -178,11 +182,18 @@ var Spinner = class extends AnimatedIcon {
                 opacity: 0,
                 duration: SPINNER_ANIMATION_TIME,
                 mode: Clutter.AnimationMode.LINEAR,
-                onComplete: () => super.stop()
+                onComplete: () => {
+                    super.stop();
+                    if (this._hideOnStop)
+                        this.actor.hide();
+                },
             });
         } else {
             this.actor.opacity = 0;
             super.stop();
+
+            if (this._hideOnStop)
+                this.actor.hide();
         }
     }
 };


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]