iconGrid: Move code around a bit
The scale passed to _updateChildrenScale is exclusively computed from properties, so it can be moved into the function itself - as the scale now becomes a mere detail, rename to a more appropriate _updateIconSizes at the same time.
This commit is contained in:
parent
6edcd82103
commit
9c008ab998
@ -524,12 +524,13 @@ const IconGrid = new Lang.Class({
|
|||||||
|
|
||||||
this._updateSpacingForSize(availWidth, availHeight);
|
this._updateSpacingForSize(availWidth, availHeight);
|
||||||
}
|
}
|
||||||
let scale = Math.min(this._fixedHItemSize, this._fixedVItemSize) / Math.max(this._hItemSize, this._vItemSize);
|
Meta.later_add(Meta.LaterType.BEFORE_REDRAW,
|
||||||
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this, function() { this._updateChildrenScale(scale); }));
|
Lang.bind(this, this._updateIconSizes));
|
||||||
},
|
},
|
||||||
|
|
||||||
// Note that this is ICON_SIZE as used by BaseIcon, not elsewhere in IconGrid; it's a bit messed up
|
// Note that this is ICON_SIZE as used by BaseIcon, not elsewhere in IconGrid; it's a bit messed up
|
||||||
_updateChildrenScale: function(scale) {
|
_updateIconSizes: function() {
|
||||||
|
let scale = Math.min(this._fixedHItemSize, this._fixedVItemSize) / Math.max(this._hItemSize, this._vItemSize);
|
||||||
let newIconSize = Math.floor(ICON_SIZE * scale);
|
let newIconSize = Math.floor(ICON_SIZE * scale);
|
||||||
for (let i in this._items) {
|
for (let i in this._items) {
|
||||||
this._items[i].icon.setIconSize(newIconSize);
|
this._items[i].icon.setIconSize(newIconSize);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user