iconGrid: Exclude hidden children from the layout
As all children were considered for the grid's layout, hidden items showed up as empty space. Instead, exclude hidden children from the layout, so that the grid is only made up of visible items. https://bugzilla.gnome.org/show_bug.cgi?id=631537
This commit is contained in:
@@ -165,8 +165,16 @@ IconGrid.prototype = {
|
|||||||
alloc.natural_size = nColumns * this._item_size + totalSpacing;
|
alloc.natural_size = nColumns * this._item_size + totalSpacing;
|
||||||
},
|
},
|
||||||
|
|
||||||
_getPreferredHeight: function (grid, forWidth, alloc) {
|
_getVisibleChildren: function() {
|
||||||
let children = this._grid.get_children();
|
let children = this._grid.get_children();
|
||||||
|
children = children.filter(function(actor) {
|
||||||
|
return actor.visible;
|
||||||
|
});
|
||||||
|
return children;
|
||||||
|
},
|
||||||
|
|
||||||
|
_getPreferredHeight: function (grid, forWidth, alloc) {
|
||||||
|
let children = this._getVisibleChildren();
|
||||||
let [nColumns, usedWidth] = this._computeLayout(forWidth);
|
let [nColumns, usedWidth] = this._computeLayout(forWidth);
|
||||||
let nRows;
|
let nRows;
|
||||||
if (nColumns > 0)
|
if (nColumns > 0)
|
||||||
@@ -182,7 +190,7 @@ IconGrid.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_allocate: function (grid, box, flags) {
|
_allocate: function (grid, box, flags) {
|
||||||
let children = this._grid.get_children();
|
let children = this._getVisibleChildren();
|
||||||
let availWidth = box.x2 - box.x1;
|
let availWidth = box.x2 - box.x1;
|
||||||
let availHeight = box.y2 - box.y1;
|
let availHeight = box.y2 - box.y1;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user