Class: Toybox.Graphics.BoundingBox
- Inherits:
-
Toybox.Lang.Object
Overview
An object representing a bounding box in the UI
Instance Member Summary collapse
-
height as Lang.Number
Represents the height of the bounding box.
-
width as Lang.Number
Represents the width of the bounding box.
-
x as Lang.Number or Null
Represents the x coordinate for the origin of the bounding box.
-
y as Lang.Number or Null
Represents the y coordinate for the origin of the bounding box.
Instance Method Summary collapse
-
addBoundingBox(box as Graphics.BoundingBox) as Void
Expand self to include a bounding box Update
self
to include the full bounding box specified. -
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. -
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. -
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. -
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. -
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. -
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. -
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.
-
normalize() as Void
Update self to ensure non-negative width and height values Repair
self
to so thatwidth
andheight
are non-negative, updating thex
andy
coordinates as appropriate. -
reset() as Void
Reset self to an invalid state.
-
valid() as Lang.Boolean
Check box is valid.
Instance Attribute Details
var height as Lang.Number
Represents the height of the bounding box
var width as Lang.Number
Represents the width of the bounding box
var x as Lang.Number or Null
Represents the x coordinate for the origin of the bounding box
var y as Lang.Number or Null
Represents the y coordinate for the origin of the bounding box
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
.
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.
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.
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.
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.
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.
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.
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.
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.
reset() as Void
Reset self to an invalid state
valid() as Lang.Boolean
Check box is valid