[gnome-shell] iconGrid: Fix slowness on pulse animation for few items
- From: Carlos Soriano Sánchez <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] iconGrid: Fix slowness on pulse animation for few items
- Date: Thu, 9 Oct 2014 10:47:38 +0000 (UTC)
commit d0de411a59761273d3aab9fec864aa3c29a0dbc9
Author: Carlos Soriano <carlos soriano89 gmail com>
Date: Fri Sep 19 19:25:35 2014 +0200
iconGrid: Fix slowness on pulse animation for few items
Currently we use the same amount of total delay divided by all items,
but that makes the items animate slow if the amount of items is small.
To avoid that, use a smaller total amount delay for an amount of items
smaller than four.
https://bugzilla.gnome.org/show_bug.cgi?id=737017
js/ui/iconGrid.js | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js
index a35489b..8754501 100644
--- a/js/ui/iconGrid.js
+++ b/js/ui/iconGrid.js
@@ -20,6 +20,7 @@ const EXTRA_SPACE_ANIMATION_TIME = 0.25;
const ANIMATION_TIME_IN = 0.350;
const ANIMATION_TIME_OUT = 1/2 * ANIMATION_TIME_IN;
const ANIMATION_MAX_DELAY_FOR_ITEM = 2/3 * ANIMATION_TIME_IN;
+const ANIMATION_BASE_DELAY_FOR_ITEM = 1/4 * ANIMATION_MAX_DELAY_FOR_ITEM;
const ANIMATION_MAX_DELAY_OUT_FOR_ITEM = 2/3 * ANIMATION_TIME_OUT;
const ANIMATION_FADE_IN_TIME_FOR_ITEM = 1/4 * ANIMATION_TIME_IN;
@@ -429,13 +430,20 @@ const IconGrid = new Lang.Class({
return;
}
+ // For few items the animation can be slow, so use a smaller
+ // delay when there are less than 4 items
+ // (ANIMATION_BASE_DELAY_FOR_ITEM = 1/4 *
+ // ANIMATION_MAX_DELAY_FOR_ITEM)
+ let maxDelay = Math.min(ANIMATION_BASE_DELAY_FOR_ITEM * actors.length,
+ ANIMATION_MAX_DELAY_FOR_ITEM);
+
for (let index = 0; index < actors.length; index++) {
let actor = actors[index];
actor.reactive = false;
actor.set_scale(0, 0);
actor.set_pivot_point(0.5, 0.5);
- let delay = index / actors.length * ANIMATION_MAX_DELAY_FOR_ITEM;
+ let delay = index / actors.length * maxDelay;
let bounceUpTime = ANIMATION_TIME_IN / 4;
let isLastItem = index == actors.length - 1;
Tweener.addTween(actor,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]