MCPcopy Create free account
hub / github.com/chartbrew/chartbrew / moveUp

Function moveUp

client/src/modules/autoLayout.js:38–47  ·  view source on GitHub ↗
(item, others)

Source from the content-addressed store, hash-verified

36}
37
38function 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
49function normalizeAndCompact(items, bpCols) {
50 const normalized = cloneItems(items).map((it) => clampItemToGrid(it, bpCols));

Callers 1

placeGreedyFunction · 0.85

Calls 1

rectanglesOverlapFunction · 0.70

Tested by

no test coverage detected