File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
src/LiveDevelopment/BrowserScripts Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -730,11 +730,22 @@ function RemoteFunctions(config) {
730730
731731 if ( overlap ) {
732732 topPos = offset . top + 2 ;
733- leftPos = offset . left + elemBounds . width + 6 ;
733+ leftPos = offset . left + elemBounds . width + 6 ; // positioning at the right side
734734
735735 // Check if overlap position would go off the right of the viewport
736736 if ( leftPos + boxDimensions . width > window . innerWidth ) {
737- leftPos = offset . left - boxDimensions . width - 6 ;
737+ leftPos = offset . left - boxDimensions . width - 6 ; // positioning at the left side
738+
739+ if ( leftPos < 0 ) { // if left positioning not perfect, position at bottom
740+ topPos = offset . top + elemBounds . height + 6 ;
741+ leftPos = offset . left ;
742+
743+ // if bottom position not perfect, move at top above the more options box
744+ if ( elemBounds . bottom + 6 + boxDimensions . height > window . innerHeight ) {
745+ topPos = offset . top - boxDimensions . height - 34 ; // 34 is for moreOptions box height
746+ leftPos = offset . left ;
747+ }
748+ }
738749 }
739750 } else {
740751 topPos = offset . top - boxDimensions . height - 6 ; // 6 for just some little space to breathe
You can’t perform that action at this time.
0 commit comments