moving and scaling an image

Richmond richmondmathewson at gmail.com
Thu Feb 9 14:24:28 EST 2012


On 02/09/2012 09:04 PM, J. Landman Gay wrote:
> 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.

Nor am I; 15 minutes after a long day with absolutely no forethought 
whatsoever.

>
> 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.
>





More information about the use-livecode mailing list