[gnome-shell] iconGrid: Restore grid actors when cancelling animations



commit b499ca47a331e24752bb9f7d0408b52b3e8f6a60
Author: Jonas Dreßler <verdre v0yd nl>
Date:   Fri Aug 9 00:15:48 2019 +0200

    iconGrid: Restore grid actors when cancelling animations
    
    When cancelling the animations of the icon grid, right now we simply
    destroy all the clones without resetting the opacity and making the
    actor reactive again. So if the spring animation to show the grid is
    cancelled by pressing a key to start a search, the icon clones would be
    destroyed, but the icon-opacity would still be set to 0. Now if the
    Escape key is pressed, viewSelector will show the last active page (ie.
    the iconGrid) without a custom animation and only fade in the page, and
    because the icons still have an opacity of 0, they will be invisible.
    
    Fix this by always restoring the opacity and reactive property of the
    original actors if the animation is cancelled instead of only destroying
    the clones.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/678

 js/ui/iconGrid.js | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)
---
diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js
index bb6829673e..1fbf416c5f 100644
--- a/js/ui/iconGrid.js
+++ b/js/ui/iconGrid.js
@@ -226,7 +226,7 @@ var IconGrid = GObject.registerClass({
         // swarming into the void ...
         this.connect('notify::mapped', () => {
             if (!this.mapped)
-                this._cancelAnimation();
+                this._resetAnimationActors();
         });
 
         this.connect('actor-added', this._childAdded.bind(this));
@@ -417,18 +417,17 @@ var IconGrid = GObject.registerClass({
         return this._getVisibleChildren();
     }
 
-    _cancelAnimation() {
-        this._clonesAnimating.forEach(clone => clone.destroy());
-        this._clonesAnimating = [];
-    }
-
-    _animationDone() {
+    _resetAnimationActors() {
         this._clonesAnimating.forEach(clone => {
             clone.source.reactive = true;
             clone.source.opacity = 255;
             clone.destroy();
         });
         this._clonesAnimating = [];
+    }
+
+    _animationDone() {
+        this._resetAnimationActors();
         this.emit('animation-done');
     }
 
@@ -437,7 +436,7 @@ var IconGrid = GObject.registerClass({
             throw new GObject.NotImplementedError("Pulse animation only implements " +
                                                   "'in' animation direction");
 
-        this._cancelAnimation();
+        this._resetAnimationActors();
 
         let actors = this._getChildrenToAnimate();
         if (actors.length == 0) {
@@ -485,7 +484,7 @@ var IconGrid = GObject.registerClass({
     }
 
     animateSpring(animationDirection, sourceActor) {
-        this._cancelAnimation();
+        this._resetAnimationActors();
 
         let actors = this._getChildrenToAnimate();
         if (actors.length == 0) {


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