[gnome-shell/gbsneto/icon-grid-dnd: 112/117] iconGrid: Apply delay to easing state



commit a2ee1a19e056ac1148880df4b26c80367cf0dc9e
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Thu Jul 4 19:23:52 2019 -0300

    iconGrid: Apply delay to easing state
    
    Also following design suggestion, add a small delay to the icons
    moving so as to give the impression that they're moving in order.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/603

 js/ui/iconGrid.js | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
---
diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js
index 3cf84f65b..435cdf697 100644
--- a/js/ui/iconGrid.js
+++ b/js/ui/iconGrid.js
@@ -40,6 +40,8 @@ const NUDGE_RETURN_DURATION = 300;
 
 const NUDGE_FACTOR = 0.33;
 
+const ICON_POSITION_DELAY = 25;
+
 var DragLocation = {
     DEFAULT: 0,
     ON_ICON: 1,
@@ -365,6 +367,7 @@ var IconGrid = GObject.registerClass({
         let y = box.y1 + this.topPadding;
         let columnIndex = 0;
         let rowIndex = 0;
+        let nChanged = 0;
         for (let i = 0; i < children.length; i++) {
             let childBox = this._calculateChildBox(children[i], x, y, box);
 
@@ -375,8 +378,13 @@ var IconGrid = GObject.registerClass({
                 if (!animating)
                     children[i].opacity = 255;
 
+                // Figure out how much delay to apply
+                if (!childBox.equal(children[i].get_allocation_box()))
+                    nChanged++;
+
                 children[i].save_easing_state();
                 children[i].set_easing_mode(Clutter.AnimationMode.EASE_OUT_QUAD);
+                children[i].set_easing_delay(ICON_POSITION_DELAY * nChanged);
                 children[i].allocate(childBox, flags);
                 children[i].restore_easing_state();
             }
@@ -1099,12 +1107,18 @@ var PaginatedIconGrid = GObject.registerClass({
         let x = box.x1 + leftEmptySpace + this.leftPadding;
         let y = box.y1 + this.topPadding;
         let columnIndex = 0;
+        let nChanged = 0;
 
         for (let i = 0; i < children.length; i++) {
             let childBox = this._calculateChildBox(children[i], x, y, box);
 
+            // Figure out how much delay to apply
+            if (!childBox.equal(children[i].get_allocation_box()))
+                nChanged++;
+
             children[i].save_easing_state();
             children[i].set_easing_mode(Clutter.AnimationMode.EASE_OUT_QUAD);
+            children[i].set_easing_delay(ICON_POSITION_DELAY * nChanged);
             children[i].allocate(childBox, flags);
             children[i].restore_easing_state();
 


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