Use a grid pattern in overlay if more than 6 windows
The diagonal arrangement currently used in the overlay when there are more than 6 windows is hard to read and hides most of the previews. Both of these issues are fixed by arranging the windows in a grid pattern. http://bugzilla.gnome.org/show_bug.cgi?id=576269
This commit is contained in:
parent
5fbc0d4a56
commit
a074ef5d7c
@ -696,16 +696,14 @@ Workspace.prototype = {
|
|||||||
return POSITIONS[numberOfWindows][windowIndex];
|
return POSITIONS[numberOfWindows][windowIndex];
|
||||||
|
|
||||||
// If we don't have a predefined scheme for this window count,
|
// If we don't have a predefined scheme for this window count,
|
||||||
// overlap the windows along the diagonal of the workspace
|
// arrange the windows in a grid pattern.
|
||||||
// (improve this!)
|
let gridWidth = Math.ceil(Math.sqrt(numberOfWindows));
|
||||||
let fraction = Math.sqrt(1/numberOfWindows);
|
let gridHeight = Math.ceil(numberOfWindows / gridWidth);
|
||||||
|
|
||||||
// The top window goes at the lower right - this is different from the
|
let fraction = Math.sqrt(.5/(gridWidth * gridHeight));
|
||||||
// fixed position schemes where the windows are in "reading order"
|
|
||||||
// and the top window goes at the upper left.
|
let xCenter = (.5 / gridWidth) + ((windowIndex) % gridWidth) / gridWidth;
|
||||||
let pos = (numberOfWindows - windowIndex - 1) / (numberOfWindows - 1);
|
let yCenter = (.5 / gridHeight) + Math.floor((windowIndex / gridWidth)) / gridHeight;
|
||||||
let xCenter = (fraction / 2) + (1 - fraction) * pos;
|
|
||||||
let yCenter = xCenter;
|
|
||||||
|
|
||||||
return [xCenter, yCenter, fraction];
|
return [xCenter, yCenter, fraction];
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user