Stupid Question Again - Proportional Scaling

J. Landman Gay jacque at hyperactivesw.com
Sun Mar 18 19:55:45 CET 2018


Very nice. :)

On 3/18/18 1:29 PM, hh via use-livecode wrote:
> @Peter
> You could try the following (doesn't need a shiftkey down).
> Put the following into the stack's script and drag anywhere the
> image to resize it and the stack proportionally (topLeft fixed).
> 
> -- 1. Don't use any resize stack handler
> -- 2. set resizable of the stack to FALSE
> 
> local l0, t0, ew, eh
> 
> on mouseDown
>    put the long id of the target into tgt
>    if not tgt begins with "image " then exit mouseDown
>    put the left of this stack into l0
>    put the top of this stack into t0
>    put the formattedWidth of tgt into ew
>    put the formattedHeight of tgt into eh
>    put the right of tgt - the clickH into dx
>    setRects dx,tgt
> end mouseDown
> 
> on setRects dx,tgt
>    lock screen; lock messages
>    put dx+the mouseH into w0; put eh/ew * w0 into h0
>    set the rect of this stack to (l0,t0,l0+w0,t0+h0)
>    set the rect of tgt to (0,0,w0,h0)
>    if the mouse is down --> TMHO, polling the mouse is here OK
>    then send "setRects dx,tgt" to me in 8 millisecs --> 8-16 millisecs
> 
> 
> 
> end setRects


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



More information about the use-livecode mailing list