utils/anchor

Methods

(inner) translateAnchor(anchoropt, x, y, width, height) → {object}

Source:

Returns real x and y values from a relative positioning.

Parameters:
Name Type Attributes Default Description
anchor string <optional>
"top-left"

Position of the anchor. Can be one out of top-left, top, top-right, left, center, right, bottom-left, bottom or bottom-right or a percentual value like 25% 75% for x and y or 50% to set x and y to the same value.

x number

X position to translate.

y number

Y position to translate.

width number

Width of the element.

height number

Height of the element.

Returns:

Object with members x and y as numbers

Type
object