Restrict display ...

Wilhelm Sanke sanke at hrz.uni-kassel.de
Tue Apr 17 12:31:16 EDT 2007


On Tue Apr 17, 2007, Jean-Pierre jean-pierre.soto at wanadoo.fr wrote:

> Is there a way to restrict the display of a moving object in the screen?
>
> I use white rectangle to mask some aera but it is not easy to handle...
>
>                                                                          
>                                 thank ...



 Here is another rather short script example that lets you drag around a 
rectangle within the bounds of an image.

"local Bstop,Tstop,LStop,RStop,cY,cX,movedobject

on mouseDown
  put (the mouseH - item 1 of the loc of me) into cX
  put (the mouseV - item 2 of the loc of me) into cY
  put (the left of image 2)+(the width of me/2)+cX +1 into Lstop
  put (the right of image 2)-(the width of me/2)+cX -2 into Rstop
  put (the bottom of image 2)-(the height of me/2)+cY -2 into Bstop
  put (the top of image 2)+(the height of me/2)+cY  into Tstop
  put true into movedobject
end mouseDown

on mouseMove x,y
  if the mouseloc is within the rect of image 2 then
    if not movedobject then exit mouseMove
    put min(Bstop,max(Tstop,y)) into yLoc
    put min(Rstop,max(Lstop,x)) into xLoc
    set loc of me to xLoc-cx,yLoc-cY
  end if
end mouseMove

on mouseUp
  put false into movedobject
end mouseUp

on mouseRelease
  mouseUp
end mouseRelease"

This is a slight modification of a script someone has made public on 
this list a while ago, sorry, I forget who it was.

I use this script in the dragged rectangle to selects portions of the 
image to be mirrored, duplicated, or simply selected/cut out in my stacks

<http://www.sanke.org/Software/SeamlessTiles.zip> and
<http://www.sanke.org/Software/ImagedataToolkitPreview3.zip>

Regards,

Wilhelm Sanke




More information about the use-livecode mailing list