(item, others)
| 36 | } |
| 37 | |
| 38 | function moveUp(item, others) { |
| 39 | let moved = { ...item }; |
| 40 | while (moved.y > 0) { |
| 41 | const test = { ...moved, y: moved.y - 1 }; |
| 42 | const collides = others.some((o) => rectanglesOverlap(test, o)); |
| 43 | if (collides) break; |
| 44 | moved = test; |
| 45 | } |
| 46 | return moved; |
| 47 | } |
| 48 | |
| 49 | function normalizeAndCompact(items, bpCols) { |
| 50 | const normalized = cloneItems(items).map((it) => clampItemToGrid(it, bpCols)); |
no test coverage detected