[gnome-shell] appDisplay/baseAppView: Reinstate fade effect



commit aca61ad3eeef088132bf909c128a16c86ef839e1
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Thu Dec 3 14:16:16 2020 -0300

    appDisplay/baseAppView: Reinstate fade effect
    
    Bring back the fade effect that was dropped by commit 4e05bcd3b6784.
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1519>

 js/ui/appDisplay.js | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 2f82b97f40..d3593b31e9 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -167,6 +167,7 @@ var BaseAppView = GObject.registerClass({
         const scroll = vertical ?  this._scrollView.vscroll : this._scrollView.hscroll;
         this._adjustment = scroll.adjustment;
         this._adjustment.connect('notify::value', adj => {
+            this._updateFade();
             this._pageIndicators.setCurrentPosition(adj.value / adj.page_size);
         });
 
@@ -238,6 +239,31 @@ var BaseAppView = GObject.registerClass({
         this._disconnectDnD();
     }
 
+    _updateFade() {
+        const { pagePadding } = this._grid.layout_manager;
+
+        if (pagePadding.top === 0 &&
+            pagePadding.right === 0 &&
+            pagePadding.bottom === 0 &&
+            pagePadding.left === 0)
+            return;
+
+        let hOffset = 0;
+        let vOffset = 0;
+
+        if ((this._adjustment.value % this._adjustment.page_size) !== 0.0) {
+            const vertical = this._orientation === Clutter.Orientation.VERTICAL;
+
+            hOffset = vertical ? 0 : Math.max(pagePadding.left, pagePadding.right);
+            vOffset = vertical ? Math.max(pagePadding.top, pagePadding.bottom) : 0;
+
+            if (hOffset === 0 && vOffset === 0)
+                return;
+        }
+
+        this._scrollView.update_fade_effect(vOffset, hOffset);
+    }
+
     _createGrid() {
         return new IconGrid.IconGrid({ allow_incomplete_pages: true });
     }


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