* Initializes an array of empty columns * and calculates the leftover whitespace. * * @return {{cols: Array, wSpace: number}} * @private
()
| 112 | * @private |
| 113 | */ |
| 114 | setup () { |
| 115 | let width = this.container.getBoundingClientRect().width; |
| 116 | let colWidth = this.colWidth(); |
| 117 | let numCols = Math.floor(width/colWidth) || 1; |
| 118 | let cols = []; |
| 119 | |
| 120 | if (this.maxColumns && numCols > this.maxColumns) { |
| 121 | numCols = this.maxColumns; |
| 122 | } |
| 123 | |
| 124 | for (let i = 0; i < numCols; i++) { |
| 125 | cols[i] = {height: 0, index: i}; |
| 126 | } |
| 127 | |
| 128 | let wSpace = width - numCols * colWidth + this.gutter; |
| 129 | |
| 130 | return {cols, wSpace}; |
| 131 | } |
| 132 | |
| 133 | /** |
| 134 | * Gets the next available column. |