Skip to content

BoxFit

Inherits: Enum

How a box should be inscribed into another box.

Properties

  • CONTAIN

    As large as possible while still containing the source entirely within the

  • COVER

    As small as possible while still covering the entire target box.

  • FILL

    Fill the target box by distorting the source's aspect ratio.

  • FIT_HEIGHT

    Make sure the full height of the source is shown, regardless of

  • FIT_WIDTH

    Make sure the full width of the source is shown, regardless of

  • NONE

    Align the source within the target box (by default, centering) and discard

  • SCALE_DOWN

    Align the source within the target box (by default, centering) and, if

Properties#

CONTAIN = 'contain' class-attribute instance-attribute #

As large as possible while still containing the source entirely within the target box.

COVER = 'cover' class-attribute instance-attribute #

As small as possible while still covering the entire target box.

FILL = 'fill' class-attribute instance-attribute #

Fill the target box by distorting the source's aspect ratio.

FIT_HEIGHT = 'fitHeight' class-attribute instance-attribute #

Make sure the full height of the source is shown, regardless of whether this means the source overflows the target box horizontally.

FIT_WIDTH = 'fitWidth' class-attribute instance-attribute #

Make sure the full width of the source is shown, regardless of whether this means the source overflows the target box vertically.

NONE = 'none' class-attribute instance-attribute #

Align the source within the target box (by default, centering) and discard any portions of the source that lie outside the box.

The source image is not resized.

SCALE_DOWN = 'scaleDown' class-attribute instance-attribute #

Align the source within the target box (by default, centering) and, if necessary, scale the source down to ensure that the source fits within the box.

This is the same as CONTAIN if that would shrink the image, otherwise it is the same as NONE.