Class: Box

algo.layout. Box

new Box(x, y, w, h)

axis aligned box
Parameters:
Name Type Description
x
y
w
h
Source:

Methods

<static> intersectWithBox(box)

return the intersection of this box with the other box
Parameters:
Name Type Description
box
Source:

<static> union()

return the union of the given boxes or an empty box if the list is empty
Source:

add(v) → {algo.layout.Box}

return a new box that is offset by the given vector
Parameters:
Name Type Description
v algo.layout.Vector
Source:
Returns:
Type
algo.layout.Box

center(other)

center ourselves in the given box
Parameters:
Name Type Description
other
Source:

clone()

return a cloned copy of this
Source:

halign(other, alignment)

horizontally align this box within another box using the given alignment [left, center, right]
Parameters:
Name Type Description
other algo.layout.Box the box which we are to be aligned in
alignment string one of left,center,right
Source:

inflate(inflateX, inflateY)

return a new Box inflated by the given signed amount
Parameters:
Name Type Description
inflateX
inflateY
Source:

isEmpty()

return true if the box have zero or negative extents in either axis
Source:

mul(v) → {algo.layout.Box}

return a new box that is this box multiplied by the given vector. This is useful for scaling boxes
Parameters:
Name Type Description
v algo.layout.Vector
Source:
Returns:
Type
algo.layout.Box

pointSet(n, callback)

return an array of points or objects within this box. If a callback is provided then the object returns is created by the callback which is invoked with the x/y position. If no callback is provided the resulting array elements are of type algo.layout.Vector
Parameters:
Name Type Argument Description
n number the number of objects to create
callback function <optional>
optional callback for creating the object
Source:

union(box)

return a new box that is the union of this box and some other box/rect like object
Parameters:
Name Type Description
box algo.layout.Box | algo.render.Rectangle | * anything with x,y,w,h properties
Source:
Returns:
algo.layout.Box - the union of this and box

valign(other, alignment)

vertically align this box within another box using the given alignment [top, center, bottom]
Parameters:
Name Type Description
other algo.layout.Box the box which we are to be aligned in
alignment string one of top, center, bottom
Source: