mirror of
https://github.com/He4eT/oddkb.git
synced 2026-05-05 01:17:25 +00:00
Preview generator: generating a preview by layer number
This commit is contained in:
parent
5f6f7b47a9
commit
a5d894b84a
3 changed files with 31 additions and 10 deletions
|
|
@ -1,4 +1,5 @@
|
|||
const HALVES_GAP = 5
|
||||
const NUMBER_OF_ROWS = 8
|
||||
|
||||
const row = (keys, start, gapOffset) => [
|
||||
{x: start},
|
||||
|
|
@ -15,13 +16,22 @@ const row4 = (keys, rowIndex) => ({
|
|||
5: row(keys, 4, 0),
|
||||
6: row(keys, 6, -4),
|
||||
7: row(keys, 6, -4),
|
||||
}[rowIndex % 8])
|
||||
}[rowIndex % NUMBER_OF_ROWS])
|
||||
|
||||
const buildRow = (keys, rowIndex) => ({
|
||||
12: row12(keys),
|
||||
4: row4(keys, rowIndex)
|
||||
}[keys.length] || ['Oh no...'])
|
||||
|
||||
const layerRange = layerIndex =>
|
||||
layerIndex === -1
|
||||
? []
|
||||
: Array(2)
|
||||
.fill(layerIndex)
|
||||
.map((x, i) => x + i)
|
||||
.map(x => x * NUMBER_OF_ROWS)
|
||||
|
||||
module.exports = {
|
||||
layerRange,
|
||||
buildRow
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue