An extension of type-enforcer with UI related data types and enforcer functions
Allows the designation of a specific point relative to an object.
- DockPoint
- new DockPoint([value])
- instance
- .opposite ⇒
DockPoint
- .oppositePrimary ⇒
string
- .oppositeSecondary ⇒
string
- .has(value) ⇒
boolean
- .swapHorizontal()
- .swapVertical()
- .isSame(dockPoint) ⇒
boolean
- .toString() ⇒
string
- .primary([value]) ⇒
this
|string
- .secondary([value]) ⇒
this
|string
- .value([value]) ⇒
this
|string
- .opposite ⇒
- static
- .BASIC_POINTS :
Enum
- .POINTS :
Enum
- .isValid(value) ⇒
boolean
- .BASIC_POINTS :
Param | Type | Default | Description |
---|---|---|---|
[value] | string |
"DockPoint.POINTS.TOP_CENTER" |
Anything from DockPoint.POINTS |
Example
import { DockPoint } from 'type-enforcer-ui';
dockPoint.opposite ⇒ DockPoint
🔒 Read only
Get a new DockPoint with the opposite value.
Get the opposite of the current primary.
Returns: string
- DockPoint.BASIC_POINTS.
Get the opposite of the current secondary.
Returns: string
- DockPoint.BASIC_POINTS.
Determine either the primary or secondary is equivalent to a value.
Param | Type | Description |
---|---|---|
value | string |
DockPoint.BASIC_POINTS. |
Set the left or right value to the opposite, whether it's the primary or secondary.
Set the top or bottom value to the opposite, whether it's the primary or secondary.
Determine if another DockPoint is equivalent to this one.
Param | Type | Description |
---|---|---|
dockPoint | DockPoint , string |
A value to compare to this one. |
Get the current value as a string.
The primary value
Returns: this
| string
- DockPoint.BASIC_POINTS
Param | Type | Description |
---|---|---|
[value] | string |
DockPoint.BASIC_POINTS |
The secondary value
Returns: this
| string
- DockPoint.BASIC_POINTS
Param | Type | Description |
---|---|---|
[value] | string |
DockPoint.BASIC_POINTS |
The full value
Returns: this
| string
- DockPoint.POINTS
Param | Type | Description |
---|---|---|
[value] | string |
DockPoint.POINTS |
Determine if something is a valid dock point.
Param | Type | Description |
---|---|---|
value | unknown |
S value to check. |