UNPKG

@zohodesk/hooks

Version:

Unified Component Library - Hooks

19 lines (18 loc) 611 B
import frameRelativeRects from "./frameRelativeRects"; export default function getArrowAdjustments(el, relativeBox, customFrame) { if (!el) { return; } const elRects = frameRelativeRects(el, customFrame); const { rectGap } = elRects; const relativeBoxRects = frameRelativeRects(relativeBox, customFrame); const relativeBoxGap = relativeBoxRects.rectGap; return { left: relativeBoxGap.center.left - rectGap.left, right: relativeBoxGap.center.right - rectGap.right, top: relativeBoxGap.center.top - rectGap.top, bottom: relativeBoxGap.center.bottom - rectGap.bottom }; }