Fix layout of newly added Widgets

This commit is contained in:
Daniel S. Hansen
2025-08-11 14:53:17 -07:00
parent 77bba49dc8
commit cab0fe3a0b
2 changed files with 9 additions and 4 deletions
+8 -3
View File
@@ -40,7 +40,10 @@ export default function Home({...props}) {
beginEditIfNeeded(); // Save state before anything else
const newID = uuid(); // could be replaced with something else like guid
const COLS = 16;
const W = w ?? 3;
const H = h ?? 3;
setWidgetArray([ // updating widget array containing info on the types of widgets
...widgetArray,
{i: newID, widget: name }
@@ -51,8 +54,10 @@ export default function Home({...props}) {
...prev,
{
i: newID,
x: (prev.length * 3) % 12,
y: Infinity,
// x: (prev.length * 3) % 12,
// y: Infinity,
x: (prev.length * W) % COLS,
y: 0,
w: w,
h: h,
minW: minw,