getOffset

Commons
stable

Computes the vector difference between two 2-D points (a − b) and returns it as a TOffset {x, y}. Used internally for drag-and-drop and overlay positioning.

API

Signature

Signature TypeScript complète, extraite du fichier util.

typescript

API

Paramètres

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

a
requis
T
The origin point (minuend). Must have x and y numeric properties.
b
requis
T
The reference point (subtrahend). Must have x and y numeric properties.

API

Valeur de retour

La valeur retournée par cet util.

A TOffset object { x: a.x − b.x, y: a.y − b.y } describing the displacement from b to a.

Usage

Exemples

Extraits de code prêts à coller.

Compute drag delta between pointer events

typescript