[gnome-shell/wip/paging-release: 42/85] Fixed bad calculations to rowsup and rowsdown at expanding collection view



commit bbc5fa8ba5ab749cf6ee39d1f5fe43e7a5156369
Author: Carlos Soriano <csoriano src gnome org>
Date:   Sat Jul 13 13:38:17 2013 +0200

    Fixed bad calculations to rowsup and rowsdown at expanding collection
    view

 js/ui/appDisplay.js |   10 +++++++---
 js/ui/iconGrid.js   |    2 +-
 2 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 2327750..d5c7b69 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -218,6 +218,7 @@ const AppPages = new Lang.Class({
         let rows = this._grid.pageRows(currentPage);
         this._translatedRows = rows;
         for(let rowIndex in rows) {
+            global.log("row " + rows[rowIndex]);
             isMainIconRow = mainIconYPosition == rows[rowIndex][0].y;
             if(isMainIconRow)
                 mainIconRowReached = true;
@@ -233,6 +234,8 @@ const AppPages = new Lang.Class({
                     rowsDown.push(rows[rowIndex]);
             }
         }
+        //The last page can have space without rows
+        let emptyRows = folderNVisibleRowsAtOnce + 1 - rows.length ;
         let panViewUpNRows = 0;
         let panViewDownNRows = 0;
         if(side == St.Side.BOTTOM) {
@@ -245,11 +248,12 @@ const AppPages = new Lang.Class({
             }
         } else {
             // There's not need to pan view up
-            if(rowsDown.length >= folderNVisibleRowsAtOnce)
+            if(rowsDown.length + emptyRows >= folderNVisibleRowsAtOnce){
                 panViewDownNRows = folderNVisibleRowsAtOnce;
+            }
             else {
-                panViewDownNRows = rowsDown.length;
-                panViewUpNRows = folderNVisibleRowsAtOnce - rowsDown.length;
+                panViewDownNRows = rowsDown.length + emptyRows;
+                panViewUpNRows = folderNVisibleRowsAtOnce - rowsDown.length - emptyRows;
             }
         }
         this._panViewForFolderView(rowsUp, rowsDown, panViewUpNRows, panViewDownNRows, iconActor);
diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js
index 1b2db7a..8679f37 100644
--- a/js/ui/iconGrid.js
+++ b/js/ui/iconGrid.js
@@ -589,7 +589,7 @@ const IconGrid = new Lang.Class({
         // Positioning to the first element of the page
         while(children[index] != this._firstPagesItems[pageNumber])
             index++;
-        for( let rowIndex = 0; rowIndex < this._rowsPerPage; rowIndex++) {
+        for( let rowIndex = 0; rowIndex < this._rowsPerPage && index < children.length; rowIndex++) {
             rows[rowIndex] = [];
             while(index < children.length && children[index].y == currentItem.y ) {
                 rows[rowIndex].push(children[index]);


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