A better tape measurement script, please

Michael Kristensen michael-kristensen at dsa-net.dk
Mon Jun 14 13:32:38 EDT 2010


Hi there

Thanks for testing the script

What happens:

If the mouse goes down in an empty space of the window, then when the  
cursor is moved over the graphics the "Tape" freezes at some point and  
does not follow the cursor.

It might be a hardware problem simce my mac is a somewhat old  
powerbook G4 1.6 mhz.

Mic


Den 12/06/2010 kl. 11.21 skrev Michael Kristensen:

> Hi there
>
> Please improve on this screen tape measurement script
>
> Its not very effective when there is a lot of object/graphics in the  
> stack. The tape cant follow the cursor
>
> It goes like this:
>
> User click on btn named Measure
> When the user push and hold the mouse down again a red tapeline  
> apears and follow the crosscursor
> When the user release the mouse the distance is calculated and put  
> in a field
>
> Here is what I have:
>
> on mouseUp
>    set the cursor to cross
>
>    wait until the mouse is down
>    put the mouseH into x1
>    put the mouseV into y1
>
>    put the mouseLoc into line 1 of mStart
>    show grc Tape
>
>    repeat while the mouse is down
>       put the mouseLoc into line 2 of mStart
>       set the points of grc Tape to mStart
>    end repeat
>
>    hide grc Tape
>
>    put the mouseH into x2
>    put the mouseV into y2
>
>    put abs(x2-x1) into dx
>    put abs(y2-y1) into dy
>
>    put 72/2.54 into Q
>
>    put sqrt (dx^2 + dy^2) into xPix
>
>    put xPix/Q into xCm
>
>    set the numberFormat to "#.0"
>
>    put xCm && "cm" into fld Distance
> end mouseUp
>
>
> Thanks
> Mic
>




More information about the use-livecode mailing list