Gold872 / elastic-dashboard

A simple and modern dashboard for FRC
MIT License
71 stars 13 forks source link

Changing grid size un-aligns widgets #20

Closed oh-yes-0-fps closed 6 months ago

oh-yes-0-fps commented 9 months ago

If you go from let's say 128 to 140 grid size the grid moves but the widgets don't.

Proposed solution: the widgets x, y, width, and height should be proportionally scaled. var * (newGridSize/oldGridSize)

Gold872 commented 9 months ago

The proposed solution will work, but there is an issue it will cause. Most widgets have a minimum size to prevent it from overflowing, but if someone scales the grid size down it could cause widgets to go below their minimum size. Shifting the position won't be an issue, but the size could mess up the rendering because widgets would overflow into other widgets

Gold872 commented 6 months ago

I added a feature that solves this issue, but not in the proposed way. Instead of scaling the sizes of the widgets down, it keeps them in the same spot and size on the screen, but snaps them to fit the new grid size.