moving and scaling an image

J. Landman Gay jacque at hyperactivesw.com
Thu Feb 9 14:04:27 EST 2012


On 2/9/12 12:16 PM, Richmond wrote:
>
> I made a stack 1024x768 pixels and popped an image right in the middle
> of it, and
> put this in the script of the image:
>
> on mouseDown
> grab me
> end mouseDown
>
> on mouseStillDown
> set the idleRate to 1
> put the item 2 of the loc of me into LOK
> if LOK > 0 then
> set the width of me to LOK
> set the height of me to LOK
> end if
> set the loc of me to 512, LOK
> end mouseStillDown
>
> on mouseUp
> set the idleRate to 1
> put the item 2 of the loc of me into LOK
> if LOK > 0 then
> set the width of me to LOK
> set the height of me to LOK
> end if
> set the loc of me to 512, LOK
> end mouseUp
>
> certainly is achingly clunky on my P4, 3 GHz, 2 GB RAM running kinkified
> Ubuntu.

I'm not surprised. That's not a good way to do it.

You should ditch the "grab" command entirely and use a mousedown to 
store the object reference in a local script variable, a mousemove 
message to calculate the new rect of the object if the variable isn't 
empty, and a mouseup to empty the variable so that mousemove won't do 
anything any more. You'll get a smooth response this way.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the use-livecode mailing list