Snapping To A Grid of TopLefts?

Martin Koob mkoob at rogers.com
Sun Oct 19 14:34:24 EDT 2014


I never use passing params by reference.  I have modified my script to use
passing by reference and constants as Ali did.

constant kHDist = 100 // horizontal distance between points 
constant kVDist = 75 // vertical distance between points 

on mouseUp
   put the top of me into tTop
   put the left of me into tLeft
   locToSnap tTop, tLeft
   lock screen
   set the top of me to tTop
   set the left of me to tLeft
   unlock screen
   put the topLeft of me
end mouseUp

on mouseDown
   grab me
end mouseDown


on locToSnap @xTop, @xLeft
   put round(xTop / kVDist) * kVDist into xTop
   put round(xLeft /kHDist) * kHDist into xLeft
end locToSnap



--
View this message in context: http://runtime-revolution.278305.n4.nabble.com/Snapping-To-A-Grid-of-TopLefts-tp4684742p4684746.html
Sent from the Revolution - User mailing list archive at Nabble.com.




More information about the use-livecode mailing list