Grid and Grab . . .
Roger Guay
rogerguay at centurytel.net
Thu Jun 10 09:53:25 EDT 2004
Thanks, Jan. I came up with a similar solution about 5 minutes after I
posted my question (Don't you hate when that happens?). I kept the
Grab command on mouseDown and wrote a script on mouseUp that does the
kind of math you propose. Works OK but results in a slightly different
user experience.
Cheers, Roger
> Hi Roger,
>
> As you know from trying, the 'grab' command doesn't
> take the grid settings into account, so you could
> either enter an enhancement request in Bugzilla ; or
> you could roll your own grab command, based on the
> following quick-and-dirty example :
> --
> local sDragging
> on mouseDown
> put true into sDragging
> end mouseDown
> on mouseUp
> put false into sDragging
> end mouseUp
> on mouseRelease
> put false into sDragging
> end mouseRelease
> on mouseMove x,y
> ## only react while we're dragging
> if sDragging is not "true" then pass mouseMove
> ## suppose we have a 10x10 grid, recalc x and y
> put (x DIV 10) * 10 into tX
> put (y DIV 10) * 10 into tY
> ## update the location
> set the location of me to tX,tY
> end mouseMove
More information about the use-livecode
mailing list