[gnome-shell/wip/jimmac/dash-icon-spacing: 63/72] overviewControls: Make AppDisplay rise from the bottom




commit f6042ec4b5e8d957d62dc875ebf76083e26a1c57
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed Jan 20 19:25:13 2021 -0300

    overviewControls: Make AppDisplay rise from the bottom
    
    It makes more sense in a spatial overview that the app grid
    comes and goes to somewhere in the screen, instead of fading
    in and out into the void.
    
    Make the app grid rise from the bottom of the screen.

 js/ui/overviewControls.js | 45 ++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 38 insertions(+), 7 deletions(-)
---
diff --git a/js/ui/overviewControls.js b/js/ui/overviewControls.js
index bf379bab49..7a415cb4dc 100644
--- a/js/ui/overviewControls.js
+++ b/js/ui/overviewControls.js
@@ -96,6 +96,31 @@ class ControlsManagerLayout extends Clutter.BinLayout {
         return workspaceBox;
     }
 
+    _getAppDisplayBoxForState(state, params, appGridBox) {
+        const { box, searchHeight, dashHeight, spacing } = params;
+        const [width, height] = box.get_size();
+        const appDisplayBox = new Clutter.ActorBox();
+
+        switch (state) {
+        case ControlsState.HIDDEN:
+        case ControlsState.WINDOW_PICKER:
+            appDisplayBox.set_origin(0, box.y2);
+            break;
+        case ControlsState.APP_GRID:
+            appDisplayBox.set_origin(0,
+                searchHeight + spacing + appGridBox.get_height());
+            break;
+        }
+
+        appDisplayBox.set_size(width,
+            height -
+            searchHeight - spacing -
+            appGridBox.get_height() - spacing -
+            dashHeight);
+
+        return appDisplayBox;
+    }
+
     vfunc_set_container(container) {
         this._container = container;
     }
@@ -149,15 +174,21 @@ class ControlsManagerLayout extends Clutter.BinLayout {
 
         // AppDisplay
         const appGridBox = workspaceBoxes[ControlsState.APP_GRID];
+        const appDisplayBoxes = [
+            this._getAppDisplayBoxForState(ControlsState.HIDDEN, params, appGridBox),
+            this._getAppDisplayBoxForState(ControlsState.WINDOW_PICKER, params, appGridBox),
+            this._getAppDisplayBoxForState(ControlsState.APP_GRID, params, appGridBox),
+        ];
 
-        childBox.set_origin(0, searchHeight + spacing + appGridBox.get_height());
-        childBox.set_size(width,
-            height -
-            searchHeight - spacing -
-            appGridBox.get_height() - spacing -
-            dashHeight);
+        if (initialState === finalState) {
+            const appDisplayBox = appDisplayBoxes[state];
+            this._appDisplay.allocate(appDisplayBox);
+        } else {
+            const initialBox = appDisplayBoxes[initialState];
+            const finalBox = appDisplayBoxes[finalState];
 
-        this._appDisplay.allocate(childBox);
+            this._appDisplay.allocate(initialBox.interpolate(finalBox, progress));
+        }
 
         // ViewSelector
         childBox.set_origin(0, searchHeight + spacing);


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