bestfitrectangle(
BOUNDARY
,
THERECTANGLE
)

The bestfitrectangle( function fits a rectangle within a boundary rectangle, enlarging or reducing as necessary to produce the best fit without changing the proportions.


Parameters

This function has two parameters:

boundary – boundary rectangle.

therectangle – original rectangle.


Description

This function fits a rectangle within a boundary rectangle, enlarging or reducing as necessary to produce the best fit without changing the proportions.

This example assumes that the current form contains an object named Photo. This code will modify the size of this object so that it is as big as possible within the window, but without changing the aspect ratio of the photo object.

local imageRect, adjustedImageRect
imageRect = objectinfo("Photo")
adjustedImageRect = bestfitrectangle(info("windowrectangle"),imageRect)
changeobject "Photo","rectangle",adjustedImageRect

See Also


History

VersionStatusNotes
10.0No ChangeCarried over from Panorama 6.0.