On Thu Aug 14 Klaus Major klaus at major-k.de wrote:

Hi Tiemo,

> Hi Klaus,
> thanks for answering
>>
>> I always check what's necessary "on mouseup" in these cases.
>
> Hmm, works but not very "nice" if the user moved the image out of the
> boundaries of the window when dragging and it flips back into the > wanted > boundaries, by mouseUp. I would think there must be a more elegant > solution.

You did not mention that you wanted an elegant solution :-D

OK, elegant is possible, but also more elaborate.
You will have to use "mousemove" handler and check the objects location in that handler.



The script below works for me here sufficiently elegant:

"local 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 true into movedobject
end mouseDown

on mouseMove x,y
 if the mouseloc is within the rect of image "big" then
# assuming the "dragged" image is moved within a larger image,
# but - if not - you may remove the line above and the
# "end if" in this mousemove handler
   if not movedobject then exit mouseMove
   set loc of me to  x-cx,y-cY
   set the loc of img "hiliteframe" to the loc of me
# "hiliteframe" is a transparent image where only the borders are non-transparent
 end if
end mouseMove

on mouseUp
 put false into movedobject
end mouseUp

on mouseRelease
 mouseUp
end mouseRelease"


Best regards,

Wilhelm Sanke
<http://www.sanke.org/MetaMedia>

_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to