Scaling Groups?

Dick Kriesel dick.kriesel at mail.com
Fri Dec 11 02:16:24 EST 2009


Thanks, Scott.  Since you still have almost ninety percent of the time left,
what do you think of scaling the content of fields using tPercent? That
could be good when the text is too small for the old reading glasses.

-- Dick


On 12/10/09 9:00 PM, "Scott Rossi" <scott at tactilemedia.com> wrote:

> Thanks to all who replied about my scaling groups question.
> As it turns out, I was able to come up with a solution in about a tenth of
> the time
> I thought it would take (and I was dreading it).
> 
> The biggest issue for me is Rev¹s reliance on integers for object
> positioning --
> this is a serious limitation when it comes to scaling because object
> dimensions can get heavily distorted when the objects are repeatedly scaled.
> I needed a way to keep object dimensions from getting too messed up if the
> user wants
> to size a group up and down repeatedly.  The only way I know how to do this
> is to store the original dimensions and refer to those whenever an object is
> scaled.
> The following code does this, called from a scrollbar whose start/end values
> are 50 and 200 (equates to 50% and 200%).  Objects are initialized with
> their
> ³starting² specs, and since those specs are always used in the code, scaling
> is as
> distortion-free as possible:
> 
> on scrollbarDrag pValue
>    scaleGroup long id of grp ³my great group²,pValue
> end scrollbarDrag
> 
> on scaleGroup pGroup,pValue
>    initObjSpecs pGroup
>    put pValue/100 into tPercent
>    put loc of pGroup into masterLoc
>    lock screen
>    set width of pGroup to the uDefaultWidth of pGroup * tPercent
>    set height of pGroup to the uDefaultHeight of pGroup * tPercent
>    set loc of pGroup to masterLoc
>    repeat with N = 1 to number of controls of pGroup
>       put long id of control N of pGroup into tObj
>       set width of tObj to (item 1 of the uOrigDimensions of tObj *
> tPercent)
>       set height of tObj to (item 2 of the uOrigDimensions of tObj *
> tPercent)
>       put item 1 of masterLoc - (item 1 of the uOrigOffset of tObj *
> tPercent) into X
>       put item 2 of masterLoc - (item 2 of the uOrigOffset of tObj *
> tPercent) into Y
>       set loc of tObj to X,Y
>    end repeat
>    set loc of pGroup to masterLoc
>    unlock screen
> end scaleGroup
> 
> on initObjSpecs pGroup
>    put loc of pGroup into masterLoc
>    if the uDefaultWidth of pGroup = "" then set the uDefaultWidth of pGroup
> to width of pGroup
>    if the uDefaultHeight of pGroup = "" then set the uDefaultHeight of
> pGroup to height of pGroup
>    put the number of controls of pGroup into objCount
>    repeat with N = 1 to objCount
>       put long id of control N of pGroup into tObj
>       if the uOrigOffset of tObj <> "" and the uOrigDimensions of tObj <> ""
> then next repeat
>       put loc of tObj into objLoc
>       set the uOrigOffset of tObj to item 1 of masterLoc - item 1 of
> objLoc,item 2 of masterLoc - item 2 of objLoc
>       set the uOrigDimensions of tObj to width of tObj,height of tObj
>    end repeat
> end initObjSpecs
> 
> 
> Maybe other folks will find this useful.
> 
> Regards,
> 
> Scott Rossi
> Creative Director
> Tactile Media, Multimedia & Design
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution





More information about the use-livecode mailing list