At 3:32 AM -0500 11/28/2000, Mark R. Jonkman wrote:
>Hi Roy
>
>I'm exceptionally tired and rather brain dead but I did some playing around
>with the script so laugh if you wish, I'm no mathematician, but this might
>do the trick, at present you tell it how many steps in it grows to fit the
>size requested. Really it doesn't matter about the target rect as the math
>is based on the new width.
>
Hi Mark-
thanks! I think I have it now - based on something Jim Collins posted
in the last century. Geez I hate getting stuck on something this rote.
on scaleRect sourceRect, targetRect
sourceWide = sourceRect.width
sourceTall = sourceRect.height
sourceAspect = sourceWide/float(sourceTall)
targetWide = targetRect.width
targetTall = targetRect.height
L = targetRect[1]
T = targetRect[2]
targetAspect = targetWide/float(targetTall)
if sourceAspect >= targetAspect then
resizeAspect = targetWide/float(sourceWide)
resizeWide = targetWide
resizeTall = sourceTall*resizeAspect
newRect = rect(L, T + (targetTall - resizeTall)/2, L+ resizeWide,
T + resizeTall + (targetTall - resizeTall)/2)
else
resizeAspect = targetTall/float(sourceTall)
resizeWide = sourceWide*resizeAspect
resizeTall = targetTall
newRect = rect(L + (targetWide - resizeWide)/2, T, L + resizeWide
+ (targetWide - resizeWide)/2, T + resizeTall)
end if
return newRect
end
--
Roy Pardi
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list,
email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo. Thanks!]