Page 1 of 1

snap to grid

Posted: Thu Aug 11, 2011 12:50 am
by admin12
Now that I am working on Groove Blox, I need to implement a snap to grid system.
I am also utilizing tracks. I need to figure out how to add/delete tracks (right now, I am using a data grid - in form mode - have a check box and everything that would constitute a track grouped). I assume I just copy the group and delete the selected tracks? Each track needs to be a audio player so it can play back the groove blox.

So, the user will drag and drop a colored rectangle (that also needs to be figured out) into the track in question and I need the rectangle to SNAP to the previous rectangle, if any. If none exist, then it snaps to a placeholder rectangle I put in there. I will eventually hide the placeholder rectangle so all you see are the blocks.

How would I go about setting up the snap to grid?

Mike

Re: snap to grid

Posted: Thu Aug 11, 2011 3:33 pm
by admin12
Anyone?

Mike

Re: snap to grid

Posted: Thu Aug 11, 2011 6:30 pm
by bn
Hi Mike,

try this as one way of doing some sort of 'snap' in a button script. Obviously this could be adapted to a different location.

Code: Select all

on mouseDown
   grab me
end mouseDown

on mouseUp
   set the left of me to item 1 of the loc of this card
end mouseUp

on mouseRelease
   mouseUp
end mouseRelease
Kind regards

Bernd

Re: snap to grid

Posted: Thu Aug 11, 2011 6:55 pm
by admin12
Close.
I only want to grab ONE copy and have the user drag and drop it into place - into place means on one of the tracks. It should SNAP into place to the left of the previous block (unless there are no blocks. I can make a line to snap to so there is something to the left of the snap point.

Mike