Thanks, Scott, for your ideas. After some experimentation, I came up with a solution that works smoothly:

Set the liveResizing of the stack to true. Include in the stack script:

on resizeStack pOldWdth,pOldHgt,pNewWdth,pNewHgt
  # maintain 4:3 ratio
  put the topLeft of this stack into tAnchorPnt
  if abs(pNewWdth - pOldWdth) > abs(pNewHgt - pOldHgt) then
    set the width of this stack to (pNewHgt * 4) div 3
  else
    set the height of this stack to (pNewWdth * 3) div 4
  end if
  set the topLeft of this stack to tAnchorPnt
end resizeStack

Devin

On Apr 4, 2006, at 9:23 AM, Devin Asay wrote:

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 Asay
Humanities Technology and Research Support Center
Brigham Young University

_______________________________________________
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

Reply via email to