mirror of
https://github.com/captbaritone/webamp.git
synced 2026-01-23 18:25:30 +00:00
18 lines
614 B
JavaScript
18 lines
614 B
JavaScript
export function double(boxes) {
|
|
const doubledBoxes = new Map();
|
|
// Find the top/left most box
|
|
// Update the width/height of the first box.
|
|
// Find any boxes that are touching the bottom of that box
|
|
// Move those boxes down
|
|
// Find any boxes that are touching the right of that box
|
|
// Move those boxes right
|
|
// Repeat for boxes that are touching
|
|
// Resize any remaining boxes
|
|
for (const [key, box] of boxes) {
|
|
const width = box.width * 2;
|
|
const height = box.height * 2;
|
|
const top = box.top * 2;
|
|
doubledBoxes.set(key, { ...box, top, width, height });
|
|
}
|
|
return doubledBoxes;
|
|
}
|