[gnome-shell/gbsneto/icon-grid-dnd: 7/13] paginatedIconGrid: Store extra space data



commit 5e119bcc1faac46bf9f112f89a568d9c2e90dc64
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Tue Jul 2 15:12:40 2019 -0300

    paginatedIconGrid: Store extra space data
    
    This will be used by future commits to calculate the correct
    drag row when hovering the icon grid.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/603

 js/ui/iconGrid.js | 11 +++++++++++
 1 file changed, 11 insertions(+)
---
diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js
index 07cbc3be5..070fb000a 100644
--- a/js/ui/iconGrid.js
+++ b/js/ui/iconGrid.js
@@ -784,6 +784,7 @@ var PaginatedIconGrid = GObject.registerClass({
         this._rowsPerPage = 0;
         this._spaceBetweenPages = 0;
         this._childrenPerPage = 0;
+        this._extraSpaceData = null;
     }
 
     vfunc_get_preferred_height(forWidth) {
@@ -820,6 +821,10 @@ var PaginatedIconGrid = GObject.registerClass({
             leftEmptySpace = availWidth - usedWidth;
         }
 
+        // Store some information about the allocated layout
+        this._leftPadding = leftEmptySpace;
+        this._allocatedColumns = nColumns;
+
         let x = box.x1 + leftEmptySpace + this.leftPadding;
         let y = box.y1 + this.topPadding;
         let columnIndex = 0;
@@ -944,6 +949,11 @@ var PaginatedIconGrid = GObject.registerClass({
         let childrenUp = children.splice(pageOffset,
                                          nRowsAbove * childrenPerRow);
 
+        // Store the resulting calculations so that we can properly take
+        // the open space when dragging icons over the icon grid from a
+        // folder popup.
+        this._extraSpaceData = [sourceRow, nRowsUp, nRowsDown];
+
         // Special case: On the last row with no rows below the icon,
         // there's no need to move any rows either up or down
         if (childrenDown.length == 0 && nRowsUp == 0) {
@@ -978,6 +988,7 @@ var PaginatedIconGrid = GObject.registerClass({
 
     closeExtraSpace() {
         if (!this._translatedChildren || !this._translatedChildren.length) {
+            this._extraSpaceData = null;
             this.emit('space-closed');
             return;
         }


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