Grid and Grab . . .
Jan Schenkel
janschenkel at yahoo.com
Wed Jun 9 16:28:35 EDT 2004
--- Roger Guay <rogerguay at centurytel.net> wrote:
> Hello List,
>
> Is there a way to have the grid feature work with
> the Grab command? I
> would like the user to be able to move objects
> constrained to a grid.
> Any suggestions?
>
> Thanks, 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
--
Hope this helped,
Jan Schenkel.
=====
"As we grow older, we grow both wiser and more foolish at the same time." (La Rochefoucauld)
__________________________________
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/
More information about the use-livecode
mailing list