Proportional resizing of stack

Devin Asay devinasay at gmail.com
Tue Apr 4 11:23:16 EDT 2006


I have a stack that I want to constrain to a 4:3 ratio when resizing,  
with a minimum stack size of 800 X 600. A search of the archives  
didn't yield any relevant results.

If I do this (in the resizeStack handler):

   put the topLeft of this stack into tAnchorPnt
   set the height of this stack to (pNewWdth * 3) div 4
   set the topLeft of this stack to tAnchorPnt

it works as long as my drag on the resize gadget has a horizontal  
component.

Likewise, this works:

   put the topLeft of this stack into tAnchorPnt
   set the width of this stack to (pNewHgt * 4) div 3
   set the topLeft of this stack to tAnchorPnt

as long as there is a vertical component to the drag.

This:

   put the topLeft of this stack into tAnchorPnt
   if pNewWdth <> pOldWdth then
     set the height of this stack to (pNewWdth * 3) div 4
   else
     set the width of this stack to (pNewHgt * 4) div 3
   end if
   set the topLeft of this stack to tAnchorPnt

Just produces bizarre results.

Any suggestions for my humanities-addled, math-challenged brain?

Devin

Devin Asay
Humanities Technology and Research Support Center
Brigham Young University




More information about the use-livecode mailing list