Size Object

A Size object describes a two-dimensional (graphical) size on screen. The unit used by the dimensions is dependent upon the context, but most often will be in points.

Size Type Commands

Size.new [width], [height] v2.0

Returns a new size with the given width and height. If either is not provided the property will be set to zero.

Size Object Properties

.width v2.0

The width of the size. The unit of this width depends on the context, but is usually points. Fractional widths are allowed (they are stored as floating point numbers).

.height v2.0

Just like width, but the height of the size.

Size Object Commands

.isEqualWithTolerance otherSize, [tolerance] v2.0

Because sizes allow fractional widths/heights they may often not be exactly equal. This command returns @true only if the difference between the size’s width is less than the given tolerance and the difference between the size’s height is also less than the given tolerance. If a tolerance value is not provided, the default is 1.0 (in whatever units the size describes).

.ensurePositive v2.0

Ensures this size is positive. If either the width or height properties are currently negative, sets them to be zero.

.ensureMinimums width, height v2.0

Ensures this size’s width is not less than the given width. If the current width is less than the given width, then the given width is used. Likewise for this size’s height.


Previous Chapter
Shadow Object
<<  index  >>
 
Next Chapter
Sound Object