(rowHeights, minimumFillHeight)
| 154 | } |
| 155 | |
| 156 | function makeAnchorToRowBlock(rowHeights, minimumFillHeight) { |
| 157 | var anchorToRowBlock = {}; |
| 158 | var currentRowHeight; |
| 159 | var currentAnchor = 0; |
| 160 | var currentBlockHeight = 0; |
| 161 | var currentBlock = makeIdentity(); |
| 162 | var currentFirstRowIndex = 0; |
| 163 | var blockCounter = 0; |
| 164 | for(var i = 0; i < rowHeights.length; i++) { |
| 165 | currentRowHeight = rowHeights[i]; |
| 166 | currentBlock.rows.push({ |
| 167 | rowIndex: i, |
| 168 | rowHeight: currentRowHeight |
| 169 | }); |
| 170 | currentBlockHeight += currentRowHeight; |
| 171 | if(currentBlockHeight >= minimumFillHeight || i === rowHeights.length - 1) { |
| 172 | anchorToRowBlock[currentAnchor] = currentBlock; |
| 173 | currentBlock.key = blockCounter++; |
| 174 | currentBlock.firstRowIndex = currentFirstRowIndex; |
| 175 | currentBlock.lastRowIndex = i; |
| 176 | currentBlock = makeIdentity(); |
| 177 | currentAnchor += currentBlockHeight; |
| 178 | currentFirstRowIndex = i + 1; |
| 179 | currentBlockHeight = 0; |
| 180 | } |
| 181 | } |
| 182 | |
| 183 | return anchorToRowBlock; |
| 184 | } |
| 185 | |
| 186 | function makeIdentity() { |
| 187 | return { |
no test coverage detected
searching dependent graphs…