[gnome-shell/gnome-3-38] appDisplay/baseAppView: Cleanup animate()



commit 07a74ca9b0cfa4bfafc8b82293211a0687146cb4
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed Dec 2 18:02:46 2020 -0300

    appDisplay/baseAppView: Cleanup animate()
    
    Simplify the opacity dance to simply setting it to the initial value
    before animating (0 when animating in, and 255 when animating out),
    and to the final value after the spring animation is done (vice-versa).
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1518>

 js/ui/appDisplay.js | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 004be086e8..7850c4aabf 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -661,7 +661,6 @@ var BaseAppView = GObject.registerClass({
     }
 
     _doSpringAnimation(animationDirection) {
-        this._grid.opacity = 255;
         this._grid.animateSpring(
             animationDirection,
             Main.overview.dash.showAppsButton);
@@ -679,15 +678,16 @@ var BaseAppView = GObject.registerClass({
     }
 
     animate(animationDirection, onComplete) {
-        if (onComplete) {
-            let animationDoneId = this._grid.connect('animation-done', () => {
-                this._grid.disconnect(animationDoneId);
+        const animationDoneId = this._grid.connect('animation-done', () => {
+            this._grid.disconnect(animationDoneId);
+            this._grid.opacity =
+                animationDirection === IconGrid.AnimationDirection.IN
+                    ? 255 : 0;
+            if (onComplete)
                 onComplete();
-            });
-        }
+        });
 
         this._clearAnimateLater();
-        this._grid.opacity = 255;
 
         if (animationDirection == IconGrid.AnimationDirection.IN) {
             const doSpringAnimationLater = laterType => {
@@ -699,18 +699,18 @@ var BaseAppView = GObject.registerClass({
                     });
             };
 
+            this._grid.opacity = 0;
             if (this._viewIsReady) {
-                this._grid.opacity = 0;
                 doSpringAnimationLater(Meta.LaterType.IDLE);
             } else {
                 this._viewLoadedHandlerId = this.connect('view-loaded',
                     () => {
                         this._clearAnimateLater();
-                        this._grid.opacity = 255;
                         doSpringAnimationLater(Meta.LaterType.BEFORE_REDRAW);
                     });
             }
         } else {
+            this._grid.opacity = 255;
             this._doSpringAnimation(animationDirection);
         }
     }


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