[gnome-shell/eos3.8: 54/255] Don't animate the icons when entering/leaving the icon grid



commit 0cd347bf45eae9d7f4eb233d56ab4840270d3cba
Author: Mario Sanchez Prada <mario endlessm com>
Date:   Thu Jun 15 15:34:18 2017 +0100

    Don't animate the icons when entering/leaving the icon grid

 js/ui/appDisplay.js |   8 ++--
 js/ui/iconGrid.js   | 121 ++--------------------------------------------------
 2 files changed, 9 insertions(+), 120 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 94cf9346e1..9d65b99832 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -232,9 +232,11 @@ var BaseAppView = GObject.registerClass({
 
     _doSpringAnimation(animationDirection) {
         this._grid.opacity = 255;
-        this._grid.animateSpring(
-            animationDirection,
-            Main.overview.dash.showAppsButton);
+
+        // We don't do the icon grid animations on Endless, but we still need
+        // to call this method so that the animation-done signal gets emitted,
+        // in order not to break the transitoins.
+        this._grid.animateSpring();
     }
 
     animate(animationDirection, onComplete) {
diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js
index 25cd140992..c849110373 100644
--- a/js/ui/iconGrid.js
+++ b/js/ui/iconGrid.js
@@ -1,5 +1,5 @@
 // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
-/* exported BaseIcon, IconGrid, PaginatedIconGrid */
+/* exported BaseIcon, IconGrid, PaginatedIconGrid, ANIMATION_MAX_DELAY_OUT_FOR_ITEM */
 
 const { Clutter, GLib, GObject, Graphene, Meta, St } = imports.gi;
 
@@ -14,7 +14,6 @@ var ANIMATION_TIME_OUT = 1 / 2 * ANIMATION_TIME_IN;
 var ANIMATION_MAX_DELAY_FOR_ITEM = 2 / 3 * ANIMATION_TIME_IN;
 var ANIMATION_BASE_DELAY_FOR_ITEM = 1 / 4 * ANIMATION_MAX_DELAY_FOR_ITEM;
 var ANIMATION_MAX_DELAY_OUT_FOR_ITEM = 2 / 3 * ANIMATION_TIME_OUT;
-var ANIMATION_FADE_IN_TIME_FOR_ITEM = 1 / 4 * ANIMATION_TIME_IN;
 
 var ANIMATION_BOUNCE_ICON_SCALE = 1.1;
 
@@ -527,121 +526,9 @@ var IconGrid = GObject.registerClass({
         }
     }
 
-    animateSpring(animationDirection, sourceActor) {
-        this._resetAnimationActors();
-
-        let actors = this._getChildrenToAnimate();
-        if (actors.length == 0) {
-            this._animationDone();
-            return;
-        }
-
-        let [sourceX, sourceY] = sourceActor.get_transformed_position();
-        let [sourceWidth, sourceHeight] = sourceActor.get_size();
-        // Get the center
-        let [sourceCenterX, sourceCenterY] = [sourceX + sourceWidth / 2, sourceY + sourceHeight / 2];
-        // Design decision, 1/2 of the source actor size.
-        let [sourceScaledWidth, sourceScaledHeight] = [sourceWidth / 2, sourceHeight / 2];
-
-        actors.forEach(actor => {
-            let [actorX, actorY] = actor._transformedPosition = actor.get_transformed_position();
-            let [x, y] = [actorX - sourceX, actorY - sourceY];
-            actor._distance = Math.sqrt(x * x + y * y);
-        });
-        let maxDist = actors.reduce((prev, cur) => {
-            return Math.max(prev, cur._distance);
-        }, 0);
-        let minDist = actors.reduce((prev, cur) => {
-            return Math.min(prev, cur._distance);
-        }, Infinity);
-        let normalization = maxDist - minDist;
-
-        actors.forEach(actor => {
-            let clone = new Clutter.Clone({ source: actor });
-            this._clonesAnimating.push(clone);
-            Main.uiGroup.add_actor(clone);
-        });
-
-        /*
-         * ^
-         * | These need to be separate loops because Main.uiGroup.add_actor
-         * | is excessively slow if done inside the below loop and we want the
-         * | below loop to complete within one frame interval (#2065, !1002).
-         * v
-         */
-
-        this._clonesAnimating.forEach(actorClone => {
-            let actor = actorClone.source;
-            actor.opacity = 0;
-            actor.reactive = false;
-
-            let [width, height] = this._getAllocatedChildSizeAndSpacing(actor);
-            actorClone.set_size(width, height);
-            let scaleX = sourceScaledWidth / width;
-            let scaleY = sourceScaledHeight / height;
-            let [adjustedSourcePositionX, adjustedSourcePositionY] = [sourceCenterX - sourceScaledWidth / 2, 
sourceCenterY - sourceScaledHeight / 2];
-
-            let movementParams, fadeParams;
-            if (animationDirection == AnimationDirection.IN) {
-                let isLastItem = actor._distance == minDist;
-
-                actorClone.opacity = 0;
-                actorClone.set_scale(scaleX, scaleY);
-                actorClone.set_translation(
-                    adjustedSourcePositionX, adjustedSourcePositionY, 0);
-
-                let delay = (1 - (actor._distance - minDist) / normalization) * ANIMATION_MAX_DELAY_FOR_ITEM;
-                let [finalX, finalY]  = actor._transformedPosition;
-                movementParams = {
-                    translation_x: finalX,
-                    translation_y: finalY,
-                    scale_x: 1,
-                    scale_y: 1,
-                    duration: ANIMATION_TIME_IN,
-                    mode: Clutter.AnimationMode.EASE_IN_OUT_QUAD,
-                    delay,
-                };
-
-                if (isLastItem)
-                    movementParams.onComplete = this._animationDone.bind(this);
-
-                fadeParams = {
-                    opacity: 255,
-                    duration: ANIMATION_FADE_IN_TIME_FOR_ITEM,
-                    mode: Clutter.AnimationMode.EASE_IN_OUT_QUAD,
-                    delay,
-                };
-            } else {
-                let isLastItem = actor._distance == maxDist;
-
-                let [startX, startY]  = actor._transformedPosition;
-                actorClone.set_translation(startX, startY, 0);
-
-                let delay = (actor._distance - minDist) / normalization * ANIMATION_MAX_DELAY_OUT_FOR_ITEM;
-                movementParams = {
-                    translation_x: adjustedSourcePositionX,
-                    translation_y: adjustedSourcePositionY,
-                    scale_x: scaleX,
-                    scale_y: scaleY,
-                    duration: ANIMATION_TIME_OUT,
-                    mode: Clutter.AnimationMode.EASE_IN_OUT_QUAD,
-                    delay,
-                };
-
-                if (isLastItem)
-                    movementParams.onComplete = this._animationDone.bind(this);
-
-                fadeParams = {
-                    opacity: 0,
-                    duration: ANIMATION_FADE_IN_TIME_FOR_ITEM,
-                    mode: Clutter.AnimationMode.EASE_IN_OUT_QUAD,
-                    delay: ANIMATION_TIME_OUT + delay - ANIMATION_FADE_IN_TIME_FOR_ITEM,
-                };
-            }
-
-            actorClone.ease(movementParams);
-            actorClone.ease(fadeParams);
-        });
+    animateSpring() {
+        // We don't do the icon grid animations on Endless
+        this._animationDone();
     }
 
     _getAllocatedChildSizeAndSpacing(child) {


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