let PositionHelper = {
    setDrawerPosition(positionRectTop) {
        let positionTop = positionRectTop + document.documentElement.scrollTop;

        let brickBuilderApp = document.querySelector('#brick-builder-app');
        let brickBuilderAppTop = brickBuilderApp.getBoundingClientRect().top;
        let brickBuilderAppHeight = brickBuilderApp.getBoundingClientRect().height;
        let brickBuilderAppPosition = brickBuilderAppTop + document.documentElement.scrollTop;

        let position = positionTop;
        position -= brickBuilderAppPosition;
        position += 50;

        if (brickBuilderAppHeight < position + 500) {
            position -= (position + 500) - brickBuilderAppHeight + 30;
        }

        return position;
    }
};

export default PositionHelper;