[gnome-shell/gbsneto/icon-grid-dnd: 2/2] iconGrid: Apply delay to easing state
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/gbsneto/icon-grid-dnd: 2/2] iconGrid: Apply delay to easing state
- Date: Thu, 4 Jul 2019 22:51:44 +0000 (UTC)
commit c8ac78d6d70f940d459de8b028c44a9010f7c841
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 c8f99e68b..d5c2c0cb2 100644
--- a/js/ui/iconGrid.js
+++ b/js/ui/iconGrid.js
@@ -39,6 +39,8 @@ const NUDGE_RETURN_DURATION = 300;
const NUDGE_FACTOR = 0.33;
+const ICON_POSITION_DELAY = 25;
+
var DragLocation = {
DEFAULT: 0,
ON_ICON: 1,
@@ -352,6 +354,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);
@@ -362,8 +365,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();
}
@@ -1084,12 +1092,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]