From 2a59478b3711f779fc1c5a3d2c4e9ca01b634147 Mon Sep 17 00:00:00 2001 From: Carlos Soriano Date: Sat, 6 Sep 2014 12:47:33 +0200 Subject: [PATCH] iconGrid: Fix last item check on spring animation Currently we consider the last item animating being the last actor of the list, but that's wrong since the last item animating depends on the distance between the source actor and the original position of the animated actor. Take that into account to check the last item of the animation. --- js/ui/iconGrid.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js index 0fc628ec2..d90cda4a7 100644 --- a/js/ui/iconGrid.js +++ b/js/ui/iconGrid.js @@ -521,11 +521,10 @@ const IconGrid = new Lang.Class({ let scaleY = sourceScaledHeight / height; let [adjustedSourcePositionX, adjustedSourcePositionY] = [sourceCenterX - sourceScaledWidth / 2, sourceCenterY - sourceScaledHeight / 2]; - // Defeat onComplete anonymous function closure - let isLastItem = index == actors.length - 1; - let movementParams, fadeParams; if (animationDirection == AnimationDirection.IN) { + let isLastItem = actor._distance == minDist; + actorClone.opacity = 0; actorClone.set_scale(scaleX, scaleY); @@ -553,6 +552,8 @@ const IconGrid = new Lang.Class({ delay: delay, opacity: 255 }; } else { + let isLastItem = actor._distance == minDist; + let [startX, startY] = actor._transformedPosition; actorClone.set_position(startX, startY);