Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 1x 1x 4x 4x 4x 4x 161x 161x 161x 161x 4x 4x 2x 4x | const {verticalMax, verticalMargin, lineSpacing} = require('../config')
module.exports = itemCount => {
const verticalTextStart = verticalMax - verticalMargin
let pageSize = 0
let pages = 1
for (let i = 0; i < itemCount; i++) {
const pageIndex = pageSize ? i % pageSize : i
const verticalOffset = lineSpacing * (pageIndex + 1)
const verticalLineStart = verticalTextStart - verticalOffset
if (verticalLineStart <= verticalMargin) {
pages++
if (!pageSize) {
pageSize = i + 1
}
}
}
return pages
}
|