import {iAllRects, iPlainPopperConfig} from "./type.base"; export function getArrowTop({ rects, config }: { rects: iAllRects, config: iPlainPopperConfig }) { const topStart = Math.max(rects.reference.top, rects.body.top); const topEnd = Math.min(rects.reference.top + rects.reference.height, rects.body.top + rects.body.height); let top = (topEnd - topStart) / 2 - (config.arrowSize / config.arrowScale) / 2 + (rects.body.top > rects.reference.top ? 0 : Math.abs(rects.reference.top - rects.body.top)); return Math.max(0, Math.min(rects.body.height - config.arrowSize * 2, top)); }