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

Signature TypeScript complète, extraite du fichier util.

typescript

API

Paramètres

Paramètres d'entrée acceptés par cet util.

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

API

Valeur de retour

La valeur retournée par cet util.

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

Usage

Exemples

Extraits de code prêts à coller.

Get bounding box from element and from coordinates

typescript