[Use-revolution] RE: Constraining Movement
Chipp Walters
chipp at chipp.com
Tue Nov 27 14:30:00 EST 2001
Scott,
why do you need the mouseRelease handler? Just wondering.
-Chipp
-----Original Message-----
From: use-revolution-errors at www.runrev.com
[mailto:use-revolution-errors at www.runrev.com]On Behalf Of Scott Rossi
Sent: Tuesday, November 27, 2001 12:21 PM
To: use-revolution at www.runrev.com
Subject: Re: Constraining Movement
Recently, Mark MacKenzie (Shaw) wrote:
> I have a small graphic based group which upon "mousemove" etc. is grabbed
by
> the mouse cursor and moved. It is placed (originally and I would like it
to
> stay here too!) within the borders an image which is some 3 times the area
> of the moveable graphic. I have been unsuccessful in constraining the
> movement of the graphic group to within this image.
Here's another (simpler?) option that seems to work for me:
on mouseDown
set the uAllowDrag of me to true
end mouseDown
on mouseMove
if not the uAllowDrag of me then exit mouseMove
set the loc of me to \
min(max(the mouseH,left of img myImg + (width of me/2)),\
right of img myImg - (width of me/2)),\
min(max(the mouseV,top of img myImg + (height of me/2)),\
bottom of img myImg - (height of me/2))
end mouseMove
on mouseUp
set the uAllowDrag of me to false
end mouseUp
on mouseRelease
mouseUp
end mouseRelease
Regards,
Scott
_____________________________________________________________________
Scott Rossi Tactile Media - Multimedia & Design
Creative Director Email: scott at tactilemedia.com
Web: www.tactilemedia.com
More information about the use-livecode
mailing list