"Snapping" method

Peter Bogdanoff bogdanoff at me.com
Sat Jan 25 03:10:21 EST 2014


Hi,

Before I go ahead and try to reinvent the wheel, does anyone know of a method for this:

I have 2 or more buttons separated on a card. I drag one around, or resize it. When the border of that button gets close to the border of another button (like within 5 pixels), the dragged button is magnetically attracted--snapped--to the second button, so that its border attaches to the border of the other button, their borders aligning--the right of one aligning with the left of the other. 

I see that there is a grid setting in the LiveCode preferences that controls this kind of motion when controls are moved with the mouse, but I don't want controls to align to an arbitrary grid but to each other. (The reason for this is that there is an image underneath that the buttons are being aligned over and that can be at any pixel on the card.)

Thanks for any advice...

Peter Bogdanoff
UCLA




More information about the use-livecode mailing list