Class: Cursor

Cursor

Helper class for checking if element will fit at the desired side of cursor.

Methods

fitsAbove(element){Boolean}

Checks if element can be placed above the cursor.

Parameters:
Name Type Description
element HTMLElement

Element to check if it's size will fit above the cursor.

Returns: {Boolean}

fitsBelow(element, viewportHeight){Boolean}

Checks if element can be placed below the cursor.

Parameters:
Name Type Description
element HTMLElement

Element to check if it's size will fit below the cursor.

viewportHeight Number optional

The viewport height.

Returns: {Boolean}

fitsOnLeft(element){Boolean}

Checks if element can be placed on the left on the cursor.

Parameters:
Name Type Description
element HTMLElement

Element to check if it's size will fit on the left of the cursor.

Returns: {Boolean}

fitsOnRight(element, viewportWidth){Boolean}

Checks if element can be placed on the right of the cursor.

Parameters:
Name Type Description
element HTMLElement

Element to check if it's size will fit on the right of the cursor.

viewportWidth Number optional

The viewport width.

Returns: {Boolean}

getSourceType(object){String}

Get source type name.

Parameters:
Name Type Description
object *

Event or Object with coordinates.

Returns: {String} Returns one of this values: 'literal', 'event'.