Snap to grid?

Hi guys !

Do you know if there’s something in Juce at the component level to enable a kind of snap to grid behaviour ? I tried to find one but didn’t find anything. I guess i’s not very hard to implement but don’t wanna reinvent the wheel .

Any hints to get started ?


Reese Witherspoon can help you with the snap: Bend & Snap

What exactly are you trying to snap, a child Component being dragged? I think putting a ComponentBoundsConstrainer and then rounding to the nearest grid point in the constrainer is the way to go…I’m not sure though. This worked for me for top level windows.

Yep. It seems like the way to go. Thanks ! :slight_smile: