Skip to content

Size

A 2D size with width and height.

Properties

Methods

  • copy

    Returns a copy of this object with the specified properties overridden.

  • from_height

    Creates a Size with the given height and an infinite width.

  • from_radius

    Creates a square Size whose width and height are twice the given radius.

  • from_width

    Creates a Size with the given width and an infinite height.

  • square

    Creates a square Size where width and height are the same.

  • zero

Properties#

aspect_ratio #

aspect_ratio: float

Returns the aspect ratio (width / height).

height #

height: Number

width #

width: Number

Methods#

copy #

copy(
    *,
    width: Number | None = None,
    height: Number | None = None,
) -> Size

Returns a copy of this object with the specified properties overridden.

from_height #

from_height(height: Number) -> Size

Creates a Size with the given height and an infinite width.

from_radius #

from_radius(radius: Number) -> Size

Creates a square Size whose width and height are twice the given radius.

from_width #

from_width(width: Number) -> Size

Creates a Size with the given width and an infinite height.

square #

square(dimension: Number) -> Size

Creates a square Size where width and height are the same.

zero #

zero()