This repository was archived by the owner on Jul 22, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change 4040 /* Do not edit these properties */
4141 position : absolute;
4242 z-index : 999 ;
43+ white-space : nowrap;
4344
4445}
4546
Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ class CtxMenuManagerClass {
6363
6464// Open the menu
6565menu . _elementClicked = elementClicked ;
66- menu . openMenu ( e . clientX , e . clientY ) ;
66+ menu . openMenu ( e . pageX , e . pageY ) ;
6767this . _currentMenuVisible = menu ;
6868
6969// Add event listeners to close the window
@@ -226,12 +226,14 @@ class CtxMenuClass {
226226// Set the screen position of the menu
227227
228228// Ensure the menu doesn't go outside of the widnow
229- if ( x + this . menuContainer . offsetWidth > document . documentElement . clientWidth ) {
230- x = document . documentElement . clientWidth - this . menuContainer . offsetWidth - 1 ;
229+ const PageWidth = ( document . documentElement . clientWidth + document . documentElement . scrollLeft ) ;
230+ const PageHeight = ( document . documentElement . clientHeight + document . documentElement . scrollTop ) ;
231+ if ( x + this . menuContainer . offsetWidth > PageWidth ) {
232+ x = PageWidth - this . menuContainer . offsetWidth - 1 ;
231233}
232234
233- if ( y + this . menuContainer . offsetHeight > document . documentElement . clientHeight ) {
234- y = document . documentElement . clientHeight - this . menuContainer . offsetHeight - 1 ;
235+ if ( y + this . menuContainer . offsetHeight > PageHeight ) {
236+ y = PageHeight - this . menuContainer . offsetHeight - 1 ;
235237}
236238
237239this . menuContainer . style . left = x + "px" ;
You can’t perform that action at this time.
0 commit comments