Fixed an issue where zones do not fill up the whole screen (#1458)

* Fixed an issue where zones do not fill up the whole screen
* Fixup: Added comments, removed extra semicolons
This commit is contained in:
Ivan Stošić
2020-03-05 15:54:06 +01:00
committed by GitHub
parent db8472a6e5
commit 9860e2bc75
2 changed files with 44 additions and 32 deletions

View File

@@ -286,7 +286,11 @@ namespace FancyZonesEditor
{
_rowsModel.CellChildMap[i, 0] = i;
_columnsModel.CellChildMap[0, i] = i;
_rowsModel.RowPercents[i] = _multiplier / ZoneCount; // _columnsModel is sharing the same array
// Note: This is NOT equal to _multiplier / ZoneCount and is done like this to make
// the sum of all RowPercents exactly (_multiplier).
// _columnsModel is sharing the same array
_rowsModel.RowPercents[i] = ((_multiplier * (i + 1)) / ZoneCount) - ((_multiplier * i) / ZoneCount);
}
// Update the "Grid" Default Layout
@@ -313,14 +317,16 @@ namespace FancyZonesEditor
_gridModel.ColumnPercents = new int[cols];
_gridModel.CellChildMap = new int[rows, cols];
// Note: The following are NOT equal to _multiplier divided by rows or columns and is
// done like this to make the sum of all RowPercents exactly (_multiplier).
for (int row = 0; row < rows; row++)
{
_gridModel.RowPercents[row] = _multiplier / rows;
_gridModel.RowPercents[row] = ((_multiplier * (row + 1)) / rows) - ((_multiplier * row) / rows);
}
for (int col = 0; col < cols; col++)
{
_gridModel.ColumnPercents[col] = _multiplier / cols;
_gridModel.ColumnPercents[col] = ((_multiplier * (col + 1)) / cols) - ((_multiplier * col) / cols);
}
int index = 0;