Constructor
new Offset(xUnits, x, yUnits, y)
Constructs an offset instance given specified units and offsets.
Parameters:
Name | Type | Description |
---|---|---|
xUnits |
String | The type of units specified for the X dimension. May be one of the following:
|
x |
Number | The offset in the X dimension. |
yUnits |
String | The type of units specified for the Y dimension, assuming a lower-left Y origin.
May be one of the following:
|
y |
Number | The offset in the Y dimension. |
- Source:
Members
x :Number
The offset in the X dimension, interpreted according to this instance's xUnits argument.
Type:
- Number
- Source:
xUnits :String
The units of this instance's X offset. See this class' constructor description for a list of the
possible values.
Type:
- String
- Source:
y :Number
The offset in the Y dimension, interpreted according to this instance's yUnits argument.
Type:
- Number
- Source:
yUnits :String
The units of this instance's Y offset. See this class' constructor description for a list of the
possible values.
Type:
- String
- Source:
Methods
clone() → {Offset}
Creates a new copy of this offset with identical property values.
- Source:
Returns:
A new offset instance with its property values the same as this one's.
- Type
- Offset
offsetForSize(width, height) → {Vec2}
Returns this offset's absolute X and Y coordinates in pixels for a rectangle of a specified size in pixels.
The returned offset is in pixels relative to the rectangle's origin, and is defined in the coordinate
system used by the caller.
Parameters:
Name | Type | Description |
---|---|---|
width |
Number | The rectangle's width in pixels. |
height |
Number | The rectangles height in pixels. |
- Source:
Returns:
The computed offset relative to the rectangle's origin.
- Type
- Vec2
toString() → {String}
Returns a string representation of this object.
- Source:
Returns:
A string representation of this object.
- Type
- String