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.
This commit is contained in:
Carlos Soriano 2014-09-06 12:47:33 +02:00
parent 04030f22a6
commit 2a59478b37

View File

@ -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);