export function rectRelativeToElement()

in src/lib/helpers/boundingRect.js [1:10]


export function rectRelativeToElement(rect, element) {
    const boundingRect = element.getBoundingClientRect();

    return {
        x: rect.x - boundingRect.x,
        y: rect.y - boundingRect.y,
        width: rect.width,
        height: rect.height,
    }
}