A better tape measurement script, please

Michael Kristensen michael-kristensen at dsa-net.dk
Sat Jun 12 05:21:17 EDT 2010


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