On Dec 11, 2009, at 12:10 PM, dfepst...@comcast.net wrote: > Before I go off and try to reinvent the wheel, does anyone have a script > > that will proportionally scale objects within a group relative to each > > other? > > Scott Rossi has answered his own question, but FWIW here's my similar > approach to the same problem. It does not assume that the scaled group stays > in the same location, but it does require that the intended new rectangle of > the group (not just a scaling factor) be specified--e.g., "set the groupRect > of pGroup to 100,100,400,400"
I have a similar approach. Because I much of my work involves resizable stacks, I almost always have ResizeStack handlers on every card. To make sure that card objects are appropriately resized when going to a new card, I put all the resizing code in "DoResize newW, newH" handlers on cards and call it from the resizeStack and also from the preOpenCard handler. If there are groups on the card, I put DoResize handlers in the group script and call it from the card DoResize script, like so: ------------------------------------------ -- in card script: on preOpenCard … DoResize the width of me, the height of me end preOpenCard on ResizeStack nW, nH DoResize nW, nH pass ResizeStack end ResizeStack on DoResize nW, nH --resize/reposition card objects … -- including groups -- calculate any way that's appropriate set the rect of grp tGrp of me to nW*.75 ,nH*.25, nw*.93, nH*.6 send "Doresize the width of grp tGrp, the height of grp tGrp" to grp tGrp … end DoResize ------------------------------------------ -- in grp tGrp: on DoResize nW, nH -- set rects of objects in grp, based on rect of grp -- another way to do it get the rect of btn "go" of me set item 4 of it to item 2 of it + nH/4 -- or whatever set the rect of btn "go" of me to it end DoResize ------------------------------------------ I add these handlers as a matter of course whenever I have a resizable stack, as soon as my layout starts to jell. I do have custom properties and utility scripts that work with them to resize and reposition special objects in special ways, but most of the time that's overkill. Rather than take the time to relearn the intricacies of my own resize API, I just go ahead and script it out, one object at a time. Tedious, but once it's done, it's done. The important thing is to keep a group's resize code within the group: let the card treat the groups objects as a black box. t _______________________________________________ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution