File size: 1,101 Bytes
7ce353c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<script>

    function position_flyout(anchorId)  {{

        setTimeout(() => {{

            const anchorRow = document.getElementById(anchorId).closest('.fake-input-container');

            const flyoutElem = document.getElementById('flyout_panel');

            

            if (anchorRow && flyoutElem && flyoutElem.style.display !== 'none') {{

                const anchorRect = anchorRow.getBoundingClientRect();

                const containerRect = anchorRow.closest('.flyout-context-area').getBoundingClientRect();

                

                const flyoutWidth = flyoutElem.offsetWidth;

                const flyoutHeight = flyoutElem.offsetHeight;



                const topPosition = (anchorRect.top - containerRect.top) + (anchorRect.height / 2) - (flyoutHeight / 2);

                const leftPosition = (anchorRect.left - containerRect.left) + (anchorRect.width / 2) - (flyoutWidth / 2);



                flyoutElem.style.top = `${{topPosition}}px`;

                flyoutElem.style.left = `${{leftPosition}}px`;

            }}

        }}, 50);

    }};

</script>