iconGrid.js: Animate icon spring using translation
Animating the icon spring using the `translation-x/y` properties instead of the `x/y` properties avoids relayouts. There are still other non-icon actors moving, but it's a big improvement. Before: 595 relayouts per spring After: 94 relayouts per spring Reducing relayouts reduces reallocation, which reduces CPU-intensive JavaScript execution. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/926
This commit is contained in:
parent
8064f4498e
commit
76961927d5
@ -557,14 +557,14 @@ var IconGrid = GObject.registerClass({
|
|||||||
|
|
||||||
actorClone.opacity = 0;
|
actorClone.opacity = 0;
|
||||||
actorClone.set_scale(scaleX, scaleY);
|
actorClone.set_scale(scaleX, scaleY);
|
||||||
|
actorClone.set_translation(
|
||||||
actorClone.set_position(adjustedSourcePositionX, adjustedSourcePositionY);
|
adjustedSourcePositionX, adjustedSourcePositionY, 0);
|
||||||
|
|
||||||
let delay = (1 - (actor._distance - minDist) / normalization) * ANIMATION_MAX_DELAY_FOR_ITEM;
|
let delay = (1 - (actor._distance - minDist) / normalization) * ANIMATION_MAX_DELAY_FOR_ITEM;
|
||||||
let [finalX, finalY] = actor._transformedPosition;
|
let [finalX, finalY] = actor._transformedPosition;
|
||||||
movementParams = {
|
movementParams = {
|
||||||
x: finalX,
|
translation_x: finalX,
|
||||||
y: finalY,
|
translation_y: finalY,
|
||||||
scale_x: 1,
|
scale_x: 1,
|
||||||
scale_y: 1,
|
scale_y: 1,
|
||||||
duration: ANIMATION_TIME_IN,
|
duration: ANIMATION_TIME_IN,
|
||||||
@ -585,12 +585,12 @@ var IconGrid = GObject.registerClass({
|
|||||||
let isLastItem = actor._distance == maxDist;
|
let isLastItem = actor._distance == maxDist;
|
||||||
|
|
||||||
let [startX, startY] = actor._transformedPosition;
|
let [startX, startY] = actor._transformedPosition;
|
||||||
actorClone.set_position(startX, startY);
|
actorClone.set_translation(startX, startY, 0);
|
||||||
|
|
||||||
let delay = (actor._distance - minDist) / normalization * ANIMATION_MAX_DELAY_OUT_FOR_ITEM;
|
let delay = (actor._distance - minDist) / normalization * ANIMATION_MAX_DELAY_OUT_FOR_ITEM;
|
||||||
movementParams = {
|
movementParams = {
|
||||||
x: adjustedSourcePositionX,
|
translation_x: adjustedSourcePositionX,
|
||||||
y: adjustedSourcePositionY,
|
translation_y: adjustedSourcePositionY,
|
||||||
scale_x: scaleX,
|
scale_x: scaleX,
|
||||||
scale_y: scaleY,
|
scale_y: scaleY,
|
||||||
duration: ANIMATION_TIME_OUT,
|
duration: ANIMATION_TIME_OUT,
|
||||||
|
Loading…
Reference in New Issue
Block a user