Module: delite/place

delite/place

Place an Element relative to a point, rectangle, or another Element.

Show inherited

Type Definitions

ChosenPosition

Meta-data about the position chosen for a popup node. Specifies the corner of the anchor node and the corner of the popup node that touch each other, plus sizing data.

Type:
  • Object
Properties:
Name Type Description
aroundCorner string

Corner of the anchor node:

  • "BL" - bottom left
  • "BR" - bottom right
  • "TL" - top left
  • "TR" - top right
corner string

Corner of the popup node:

  • "BL" - bottom left
  • "BR" - bottom right
  • "TL" - top left
  • "TR" - top right
x number

Horizontal position of popup in pixels, relative to document body.

y number

Vertical position of popup in pixels, relative to document body.

w number

Width of popup in pixels.

h number

Height of popup in pixels.

spaceAvailable Object

{w: 30, h: 20} type object listing the amount of space that was available fot the popup in the chosen position.

Source:

LayoutFunc(node, aroundCorner, nodeCorner, size) → {number}

Function on popup widget to adjust it based on what position it's being displayed in, relative to anchor node.

Parameters:
Name Type Description
node Element

The DOM node for the popup widget.

aroundCorner string

Corner of the anchor node, one of:

  • "BL" - bottom left
  • "BR" - bottom right
  • "TL" - top left
  • "TR" - top right
nodeCorner string

Corner of the popup node, one of:

  • "BL" - bottom left
  • "BR" - bottom right
  • "TL" - top left
  • "TR" - top right
size Object

{w: 20, h: 30} type object specifying size of the popup.

Source:
Returns:

Optional. Amount that the popup needed to be modified to fit in the space provided. If no value is returned, it's assumed that the popup fit completely without modification.

Type
number

Position

Type:
  • Object
Properties:
Name Type Description
x number

Horizontal coordinate in pixels, relative to document body.

y number

Vertical coordinate in pixels, relative to document body.

Source:

Rectangle

Represents the position of the "anchor" node. Popup node will be placed adjacent to this rectangle.

Type:
  • Object
Properties:
Name Type Description
x number

Horizontal coordinate in pixels, relative to document body.

y number

Vertical coordinate in pixels, relative to document body.

w number

Width in pixels.

h number

Height in pixels.

Source: