From 0bdcf2958f2a96a9407a9730e44fc9dd08c5e90d Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Thu, 4 Jul 2019 19:23:52 -0300 Subject: [PATCH] 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();