appDisplay: Add API to animate launch at given position

Add a `animateLaunchAtPos()` method to the AppIcon class to animate the
launch of an app at a given position. This allows for a visual
indication of whether dropping an app icon using DnD was successful at
the position the drop happened in a later commit.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/121
This commit is contained in:
Jonas Dreßler 2019-09-15 11:40:27 +02:00 committed by Florian Müllner
parent 259874d731
commit daa5452af2
2 changed files with 14 additions and 1 deletions

View File

@ -2208,6 +2208,10 @@ var AppIcon = class AppIcon {
this.icon.animateZoomOut();
}
animateLaunchAtPos(x, y) {
this.icon.animateZoomOutAtPos(x, y);
}
scaleIn() {
this.actor.scale_x = 0;
this.actor.scale_y = 0;

View File

@ -142,6 +142,10 @@ class BaseIcon extends St.Bin {
zoomOutActor(this.child);
}
animateZoomOutAtPos(x, y) {
zoomOutActorAtPos(this.child, x, y);
}
update() {
this._createIconTexture(this.iconSize);
}
@ -152,10 +156,15 @@ function clamp(value, min, max) {
}
function zoomOutActor(actor) {
let [x, y] = actor.get_transformed_position();
zoomOutActorAtPos(actor, x, y);
}
function zoomOutActorAtPos(actor, x, y) {
let actorClone = new Clutter.Clone({ source: actor,
reactive: false });
let [width, height] = actor.get_transformed_size();
let [x, y] = actor.get_transformed_position();
actorClone.set_size(width, height);
actorClone.set_position(x, y);
actorClone.opacity = 255;