Bounds.js

  • Bounds()

    Bounds's constructor

  • extend()

    Extends the current bounds with the given point

  • intersect()

    Intersects the current bounds with the given bounds without modifying the current bounds

  • center()

    Returns the center of the bounds

  • topLeft()

    Returns the top left point of the bounds

  • topRight()

    Returns the top right point of the bounds

  • bottomLeft()

    Returns the bottom left point of the bounds

  • bottomRight()

    Returns the bottom right point of the bounds

  • width()

    Returns the width of the bounds

  • height()

    Returns the height of the bounds

Bounds()


constructor

Bounds class is used to define a boundary based on bottom left and top right points

Parameter Type Description
a Point The bottom left point
b Point The top right point

extend()


method

Extends the current bounds with the given point

Parameter Type Description
point Point The point used to extend the bounds
returns
Bounds - The modified bounds

intersect()


method

Intersects the current bounds with the given bounds without modifying the current bounds

Parameter Type Description
bounds Bounds The bounds used to intersect the current bounds
returns
Bounds - The intersection of the two bounds

center()


method

Returns the center of the bounds

returns
Point - The center of the bounds

topLeft()


method

Returns the top left point of the bounds

returns
Point - The top left point of the bounds

topRight()


method

Returns the top right point of the bounds

returns
Point - The top right point of the bounds

bottomLeft()


method

Returns the bottom left point of the bounds

returns
Point - The bottom left point of the bounds

bottomRight()


method

Returns the bottom right point of the bounds

returns
Point - The bottom right point of the bounds

width()


method

Returns the width of the bounds

returns
Number - The width of the bounds

height()


method

Returns the height of the bounds

returns
Number - The height of the bounds