[Q][ETOYS] Constrained dragging?
w.jacobs at gmx.de
Thu Apr 29 16:49:17 UTC 2004
> Ned Konz wrote:
> > On Sunday 25 April 2004 12:33 am, Lothar Schenk wrote:
> > > How can I restrict the path of an eToy that's in the process of being
> > > dragged to an allowed region, or alternatively to avoid conflict with
> > > other eToys as obstacles?
> > First, you have to avoid having the morph dragged around by the hand,
> > because it's much harder to control its position if the hand is dragging
> > it.
> I see. :)
> > Turn on "resist being picked up" from the menu.
> > Now if you make a script that is triggered on mouse down you could check
> > the world's mouseX and mouseY.
> > You can also put a morph in a container and constrain its bounds that
> > (you can use obtrudes to test), or use overlaps to test whether it's
> > another.
> > The attached image is one way to do something like this:
> > the blue Rectangle is locked in place. It could be transparent to make
> > invisible if you want.
> > the roundRectangle has two scripts (shown). It's got "resist being
> > up" turned on.
> > The result is that you can mouse down on the roundRectangle if its
> > is inside the Rectangle, and you can drag the roundRectangle as long as
> > mouse is within the bounds of the Rectangle.
> > Avoiding other morphs can be done with overlaps, colorSees, or touchesA
> > (and probably other ways too).
> Thank you. This example already goes a long way toward what I want to
wj at skripz.de
"Sie haben neue Mails!" - Die GMX Toolbar informiert Sie beim Surfen!
Jetzt aktivieren unter http://www.gmx.net/info
More information about the Squeak-dev