[Topic][Dumbfounded] Is there a way to resize and move a group without touching the inside objects

Scott Rossi scott at tactilemedia.com
Thu May 9 15:24:25 CDT 2013


[ tags on posts are starting to get scary ]

Hi Tom:

Here's some group scaling code I've been meaning to post for a while now.
All it does is scale objects proportionally to a (locked) parent group. If
objects extend beyond the boundaries of the group, their positions and
sizes should stay intact.  The script does NOT scale all the objects'
properties (that's another script that will come later).  Maybe you can
make use of this.

command scaleGroup pGroup, pScale
   put rect of pGroup into theGroupRect
   put width of pGroup into W
   put height of pGroup into H
   set boundingRect of pGroup to rect of pGroup
   repeat with N = 1 to number of controls of pGroup
      put long id of control  N of pGroup into theControl
      put rect of theControl into theRect
      put item 1 of theRect - item 1 of theGroupRect into L
      put item 2 of theRect - item 2 of theGroupRect into T
      put item 1 of theRect + round(width of theControl * pScale) into
item 3 of theRect
      put item 2 of theRect + round(height of theControl * pScale) into
item 4 of theRect
      set rect of theControl to theRect
      set topLeft of theControl to \
            item 1 of theGroupRect + round(L * pScale),item 2 of
theGroupRect + round(T * pScale)
   end repeat
   put margins of pGroup into theMargins
   repeat with N = 1 to number of items of theMargins
      put round (item N of theMargins * pScale) into item N of theMargins
   end repeat
   set margins of pGroup to theMargins
   set boundingRect of pGroup to empty
   set rect of pGroup to \
         item 1 of theGroupRect,item 2 of theGroupRect,item 1 of
theGroupRect + round(W * pScale),item 2 of theGroupRect + round(H * pScale)
end scaleGroup



Regards,

Scott Rossi
Creative Director
Tactile Media, UX/UI Design




On 5/9/13 12:23 PM, "Thomas McGrath III" <mcgrath3 at mac.com> wrote:

>Is there a way to resize and move a scrolling group without touching the
>inside contents of that group??? This is on mobile and I need to resize a
>scrolling group based on the position of the UI (navbar and toolbar when
>in portrait and landscape) when the UI changes and then after the
>scrolling group is right I then need to separately resize the contents
>for retina if needed -- to double their height, width and topleft -- or
>regular.
>
>If I resize the group first then it moves the content and then doubling
>the content makes it the right size but positioned wrong.
>If I resize the content and then move the group then it again correctly
>sizes the contents but positions them wrong.
>
>If the group moves then everything is in a different position from when I
>laid them out in the desktop so they are off.
>
>I want the scrolling group code to be separate from the resizing code if
>possible.
>
>
>Thanks,
>
>Tom
>
>-- Tom McGrath III
>http://lazyriver.on-rev.com
>mcgrath3 at mac.com
>
>
>_______________________________________________
>use-livecode mailing list
>use-livecode at lists.runrev.com
>Please visit this url to subscribe, unsubscribe and manage your
>subscription preferences:
>http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list