Snapping To A Grid of TopLefts?

JOHN PATTEN johnpatten at me.com
Sun Oct 19 14:26:16 EDT 2014


Thanks Martin and Ali,

I figured I was making it more difficult than it needed to be :)

I’ll give those a try.

Thanks again!

John Patten
SUSD
On Oct 19, 2014, at 11:21 AM, Martin Koob <mkoob at rogers.com> wrote:

> This will snap to a 100 X 75 grid anywhere on the card.  It does not restrict
> the bounds i.e. left from 50 to 275, but that could be added.
> 
> on mouseUp
>   put the top of me into tTop
>   put the left of me into tLeft
>   put round(tTop / 75) * 75 into tNewTop
>   put round(tLeft /100) * 100 into tNewLeft
>   lock screen
>   set the top of me to tNewTop
>   set the left of me to tNewLeft
>   unlock screen
>   put the topLeft of me
> end mouseUp
> 
> on mouseDown
>   grab me
> end mouseDown
> 
> 
> 
> 
> 
> --
> View this message in context: http://runtime-revolution.278305.n4.nabble.com/Snapping-To-A-Grid-of-TopLefts-tp4684742p4684744.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list