diff --git a/src/js/components/ContextMenu.js b/src/js/components/ContextMenu.js index 9dbb5828..1b84976b 100755 --- a/src/js/components/ContextMenu.js +++ b/src/js/components/ContextMenu.js @@ -514,14 +514,19 @@ class ContextMenu extends React.Component{ left: this.props.menu.position_x, top: this.props.menu.position_y, } - var height = 0 // TODO: use jquery to detect height + var height = 200 // TODO: use jquery to detect height var className = "context-menu "+this.props.menu.context - if (this.state.submenu_expanded) className += ' submenu-expanded' - if (this.props.menu.position_x > (window.innerWidth - 154)) className += ' right-align' - if (this.props.menu.position_x > (window.innerWidth - 308)) className += ' right-align-submenu' + if (this.state.submenu_expanded){ + className += ' submenu-expanded' + } + + if (this.props.menu.position_x > (window.innerWidth - 174)){ + style.left = 'auto' + style.right = 10 + } if (this.props.menu.position_y > (window.innerHeight - height)){ - style.top = style.top - height - className += ' bottom-align-submenu' + style.top = 'auto' + style.bottom = 10 } return ( diff --git a/src/scss/components/_context-menu.scss b/src/scss/components/_context-menu.scss index 077ed31d..4c0bf143 100755 --- a/src/scss/components/_context-menu.scss +++ b/src/scss/components/_context-menu.scss @@ -1,8 +1,6 @@ #context-menu { position: fixed; - left: 0; - top: 0; z-index: 99; .liner { @@ -10,20 +8,6 @@ color: #FFFFFF; width: 160px; - &.right-align { - margin-left: -160px; - } - - &.right-align-submenu .submenu { - left: auto !important; - right: 160px !important; - } - - &.bottom-align-submenu .submenu { - top: auto !important; - bottom: 0 !important; - } - .title { display: block; padding: 8px 12px; @@ -118,7 +102,7 @@ bottom: 0; left: 100%; width: 0; - min-height: 180px; + height: 100%; overflow-y: scroll; background: lighten($dark_grey, 15%); z-index: 3;