selectElementPosition()
function selectElementPosition(element): PlainPoint;
Selects an element's top-left position { x, y }. A subscribed component
re-renders only when the element moves.
Parameters
| Parameter | Type | Description |
|---|---|---|
element | InternalElementRecord<unknown> | the resolved element record |
Returns
PlainPoint
Example
import { useCell, selectElementPosition } from '@joint/react';
const { x, y } = useCell(elementId, selectElementPosition);