Enforce cell dimensions on auto-layout cells

Previously, the calculation of cells which are in autoflow layouts was
incorrect since it needed to be multiplied by the cellHeight. To have
this, we also need to have a fixed cellHeight for these cells. This
overrides any cell width and height set on autoflowed layouts and forces
it to 4x4
pull/10616/head
Tim Raymond 2016-11-15 13:59:17 -05:00
parent 1d509bf220
commit 23889951be
1 changed files with 4 additions and 1 deletions

View File

@ -74,12 +74,15 @@ export const HostPage = React.createClass({
let autoflowCells = [];
const cellWidth = 4;
const cellHeight = 4;
const pageWidth = 12;
autoflowLayouts.forEach((layout, i) => {
layout.cells.forEach((cell, j) => {
cell.w = cellWidth;
cell.h = cellHeight;
cell.x = ((i + j) * cellWidth % pageWidth);
cell.y = Math.floor(((i + j) * cellWidth / pageWidth));
cell.y = Math.floor(((i + j) * cellWidth / pageWidth)) * cellHeight;
autoflowCells = autoflowCells.concat(cell);
});
});