Class: Toybox.Graphics.BoundingBox

Overview

An object representing a bounding box in the UI

Since:

API Level 3.2.7

Instance Member Summary collapse

Instance Method Summary collapse

Instance Attribute Details

var height as Lang.Number

Represents the height of the bounding box

Since:

API Level 3.2.7

var width as Lang.Number

Represents the width of the bounding box

Since:

API Level 3.2.7

var x as Lang.Number or Null

Represents the x coordinate for the origin of the bounding box

Since:

API Level 3.2.7

var y as Lang.Number or Null

Represents the y coordinate for the origin of the bounding box

Since:

API Level 3.2.7

Instance Method Details

addBoundingBox(box as Graphics.BoundingBox) as Void

Expand self to include a bounding box

Update self to include the full bounding box specified. If self is not valid, sets self to box.

Parameters:

Since:

API Level 5.1.0

addCircle(x as Lang.Number, y as Lang.Number, radius as Lang.Number) as Void

Expand self to include a circle

Update self to include the circle specified. If self is not valid, sets self to the bounding box that contains the given circle.

Parameters:

  • x(Lang.Number)

    The x coordinate of the circle to add.

  • y(Lang.Number)

    The y coordinate of the circle to add.

  • radius(Lang.Number)

    The radius of the circle to add.

Since:

API Level 5.1.0

Throws:

addEllipse(x as Lang.Number, y as Lang.Number, a as Lang.Number, b as Lang.Number) as Void

Expand self to include an ellipse

Update self to include the ellipse specified. If self is not valid, sets self to the bounding box that contains the given ellipse.

Parameters:

  • x(Lang.Number)

    The x coordinate of the ellipse to add.

  • y(Lang.Number)

    The y coordinate of the ellipse to add.

  • a(Lang.Number)

    The radius of the ellipse to add along the x axis

  • b(Lang.Number)

    The radius of the ellipse to add along the y axis

Since:

API Level 5.1.0

Throws:

addPoint(x as Lang.Number, y as Lang.Number) as Void

Add a point to the bounding box

Update self to include the point specified. If self is not valid, sets self to the bounding box that contains the given point.

Parameters:

  • x(Lang.Number)

    The x coordinate of the point to add.

  • y(Lang.Number)

    The y coordinate of the point to add.

Since:

API Level 5.1.0

Throws:

addPoints(points as Lang.Array<[ Lang.Number, Lang.Number ]>) as Void

Add one or more points to a bounding box

Update self to include all of the points specified. If self is not valid, sets self to the bounding box that contains all of the given points.

Parameters:

  • points(Lang.Array)

    The array of points to add.

Since:

API Level 5.1.0

Throws:

addRectangle(x as Lang.Number, y as Lang.Number, width as Lang.Number, height as Lang.Number) as Void

Expand self to include a rectangle

Update self to include the rectangle specified. If self is not valid, sets self to the bounding box that contains the given rectangle.

Parameters:

  • x(Lang.Number)

    The x coordinate of the rectangle to add.

  • y(Lang.Number)

    The y coordinate of the rectangle to add.

  • width(Lang.Number)

    The width of the box to rectangle.

  • height(Lang.Number)

    The height of the box to rectangle.

Since:

API Level 5.1.0

Throws:

expand(dx as Lang.Number, dy as Lang.Number) as Void

Expand self by the given offsets

Expand self by the x and y offsets specified. Use negative values to contract self.

Parameters:

  • dx(Lang.Number)

    The amount to expand along the x axis.

  • dy(Lang.Number)

    The amount to expand along the y axis.

Since:

API Level 5.1.0

Throws:

includesPoint(x as Lang.Number, y as Lang.Number) as Lang.Boolean

Determine if self includes a point

Points on the edge of a box are considered to be included since the box would not expand if such a point were added to the box.

Parameters:

  • x(Lang.Number)

    The x coordinate of the point to check.

  • y(Lang.Number)

    The y coordinate of the point to check.

Returns:

  • Lang.Boolean

    true if this box includes the given point.

Since:

API Level 5.1.0

Throws:

normalize() as Void

Update self to ensure non-negative width and height values

Repair self to so that width and height are non-negative, updating the x and y coordinates as appropriate. If self is not valid or is already normalized, has no effect.

Since:

API Level 5.1.0

reset() as Void

Reset self to an invalid state

Since:

API Level 5.1.0

valid() as Lang.Boolean

Check box is valid

Returns:

  • Lang.Boolean

    true if self describes a valid bounding box.

Since:

API Level 5.1.0


Generated Mar 4, 2025, 4:09:52 PM