Constructor
new Selectable(baseElement, existingPosition)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
baseElement |
Element | The element that the selectable is using. | |
existingPosition |
Object | null | The existing position of the element. |
- Source:
Members
(private) center
Center of the box shape.
- Source:
(readonly) center :MenuVector
Return the full center from our element plus the CSS offsets.
Type:
- MenuVector
- Source:
(readonly) fullPos :MenuVector
Returns module:menulib~MenuVectorField#position plus the CSS offsets.
Type:
- MenuVector
- Source:
position
The current position of the Selectable in HTML space (CSS not included, that's added in module:menulib~MenuVectorField#fullPos)
- Source:
Methods
clearSelect()
Unselects this element.
- Source:
click()
Clicks this element.
- Source:
findPosition()
Calculate this element's position based on its current HTML offset and its parent's HTML offsets.
- Source:
isSelectable() → {boolean}
Returns whether or not this element is selectable.
- Source:
Returns:
- Type
- boolean
isSelectableWithinBounds(baseOffset) → {boolean}
Calculates the visibility of the Selectable given its current position within the frame, and returns true if it's visible within the HTML frame, and false otherwise.
Parameters:
Name | Type | Description |
---|---|---|
baseOffset |
MenuVector | How much the Selectable is offset from its given position (i.e., how do its parents offset it?). |
- Source:
Returns:
- Type
- boolean
select()
Selects this element.
- Source:
(static) generateSelectablesArr(element, position, selectableFunc, globalParentPos) → {Array:.<Selectable:>}
Generate an array of module:menulib~Selectable from the children of a given element. Recursively called.
Based on the stuff I did for the twine extension.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
element |
Element | Element's children to search. | |
position |
* | Offset of position to start from. | |
selectableFunc |
* | isSelectableWithinBounds | The module:menulib~Selectable function to call with a position to determine whether or not it's added to the array. |
globalParentPos |
* | null | The position of the current parent. |
- Source: