[gnome-shell] appDisplay: Add API to animate launch at given position



commit daa5452af2956bb8c7896ecda85dd0ca1581aa3a
Author: Jonas Dreßler <verdre v0yd nl>
Date:   Sun Sep 15 11:40:27 2019 +0200

    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

 js/ui/appDisplay.js |  4 ++++
 js/ui/iconGrid.js   | 11 ++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 9b61d4e26f..8571d86b90 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -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;
diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js
index ca23bccdb8..ffddd11bdf 100644
--- a/js/ui/iconGrid.js
+++ b/js/ui/iconGrid.js
@@ -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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]