Dimension2¶
Overview¶
Dimension2 is a basic width and height, like a Bounds2 but without the position defined.
@author Jonathan Olson <jonathan.olson@colorado.edu>
Class Dimension2¶
Constructor¶
new Dimension2( width : number, height : number )¶
Instance Methods¶
toString() : string¶
Debugging string for the dimension.
set( dimension : Dimension2 ) : Dimension2¶
Sets this dimension to be a copy of another dimension. This is the mutable form of the function copy(). This will mutate (change) this dimension, in addition to returning this dimension itself.
setWidth( width : number ) : Dimension2¶
Sets the width of the dimension, returning this.
setHeight( height : number ) : Dimension2¶
Sets the height of the dimension, returning this.
copy( dimension? : Dimension2 ) : Dimension2¶
Creates a copy of this dimension, or if a dimension is passed in, set that dimension's values to ours. This is the immutable form of the function set(), if a dimension is provided. This will return a new dimension, and will not modify this dimension.
@param [dimension] - If not provided, creates a new Dimension2 with filled in values. Otherwise, fills in the values of the provided dimension so that it equals this dimension.
swapped() : Dimension2¶
Swap width and height and return a new Dimension2
toBounds( x? : number, y? : number ) : Bounds2¶
Creates a Bounds2 from this dimension based on passing in the minimum (top-left) corner as (x,y). @param [x] - Minimum x coordinate of the bounds, or 0 if not provided. @param [y] - Minimum y coordinate of the bounds, or 0 if not provided.
equals( that : Dimension2 ) : boolean¶
Exact equality comparison between this dimension and another dimension.
equalsEpsilon( that : Dimension2, epsilon ) : boolean¶
Exact equality comparison between this dimension and another dimension.
Whether difference between the two dimensions has no component with an absolute value greater than epsilon.
toStateObject() : Dimension2StateObject¶
Instance Properties¶
width : number¶
Width of the dimension
height : number¶
Height of the dimension
Static Methods¶
fromStateObject( stateObject : Dimension2StateObject ) : Dimension2¶
Static Properties¶
Dimension2IO : IOType¶
Type Dimension2StateObject¶
StateObject<typeof STATE_SCHEMA>
Source Code¶
See the source for Dimension2.ts in the dot repository.