@@ -286,16 +286,9 @@ function RemoteFunctions(config) {
286286 this . body . style . setProperty ( "z-index" , 2147483647 ) ;
287287 this . body . style . setProperty ( "position" , "fixed" ) ;
288288
289- // the more options box width
290- const boxWidth = 82 + 16 ; // 82px width + 8px padding on each side
291- let leftPos = elemBounds . left + ( elemBounds . width - 40 ) ; // the potential left position
292- // make sure that box wouldn't go out of the viewport
293- const viewportWidth = window . innerWidth || document . documentElement . clientWidth ;
294- if ( leftPos + boxWidth > viewportWidth ) {
295- leftPos = viewportWidth - boxWidth ;
296- }
289+ const boxWidth = 82 ;
297290
298- this . body . style . setProperty ( "left" , leftPos + "px" ) ;
291+ this . body . style . setProperty ( "left" , ( elemBounds . left + ( elemBounds . width - boxWidth ) ) + "px" ) ;
299292 this . body . style . setProperty (
300293 "top" ,
301294 // if there's not enough space to show the box above the element,
@@ -311,8 +304,7 @@ function RemoteFunctions(config) {
311304 this . body . style . setProperty ( "border-radius" , "3px" ) ;
312305 this . body . style . setProperty ( "padding" , "5px 8px" ) ;
313306 this . body . style . setProperty ( "box-shadow" , "0 2px 5px rgba(0,0,0,0.2)" ) ;
314- this . body . style . setProperty ( "max-width" , "82px" ) ;
315- this . body . style . setProperty ( "width" , "82px" ) ; // if changing this, also update the boxWidth variable
307+ this . body . style . setProperty ( "width" , boxWidth + "px" ) ;
316308
317309 const ICONS = {
318310 arrowUp : `<svg viewBox="0 0 24 24" fill="currentColor">
@@ -409,20 +401,13 @@ function RemoteFunctions(config) {
409401 pushBoxUp += 17 ;
410402 }
411403
412- // compute the position on screen
413- var offset = _screenOffset ( this . element ) ,
414- x = offset . left ,
415- y = offset . top - 30 ; // Position above the element
416-
417404 let elemBounds = this . element . getBoundingClientRect ( ) ;
418405
419- console . log ( "elemBounds: " , elemBounds ) ;
420-
421406 // create the container
422407 this . body = window . document . createElement ( "div" ) ;
423408 this . body . style . setProperty ( "z-index" , 2147483647 ) ;
424409 this . body . style . setProperty ( "position" , "fixed" ) ;
425- this . body . style . setProperty ( "left" , ( offset . left ) + "px" ) ;
410+ this . body . style . setProperty ( "left" , elemBounds . left + "px" ) ;
426411 this . body . style . setProperty (
427412 "top" ,
428413 // if there's not enough space to show the box above the element,
0 commit comments