getTargetBox

Commons
stable

Returns a bounding-box descriptor for an activator. For an HTMLElement it delegates to getBoundingClientRect(); for an [x, y] coordinate pair it returns a zero-size IBox centred on that point.

API

Signature

Full TypeScript signature sourced from the util file.

typescript

API

Parameters

Input parameters accepted by this util.

target
required
HTMLElement | [x: number, y: number]
An HTMLElement whose DOMRect is retrieved, or a numeric [x, y] pair for virtual/cursor-based positioning.

API

Return value

The value returned by this util.

A DOMRect for real elements, or a zero-size IBox with the given x/y for coordinate pairs.

Usage

Examples

Ready-to-paste usage snippets.

Get bounding box from element and from coordinates

typescript