Context menu page limits

This commit is contained in:
James Barnsley
2017-04-21 09:10:47 +12:00
parent 303991df09
commit 26b5e2ed35
2 changed files with 12 additions and 23 deletions

View File

@ -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 (

View File

@ -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;