1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-05 00:43:53 +00:00

Menu bug repair (#2531)

This commit is contained in:
杨顺强
2018-11-15 18:46:46 +08:00
committed by Daniel Pan
parent f2a01521d2
commit c5b4b672f4
2 changed files with 13 additions and 5 deletions

View File

@@ -89,8 +89,8 @@ class DirentListItem extends React.Component {
}
onItemMenuShow = (e) => {
let left = e.clientX - 8*16;
let top = e.clientY + 15;
let left = e.clientX;
let top = e.clientY;
let position = Object.assign({},this.state.menuPosition, {left: left, top: top});
this.setState({
menuPosition: position,

View File

@@ -24,7 +24,8 @@ class DirentMenu extends React.Component {
let repo = this.props.currentRepo;
let menuList = this.calculateMenuList(repo);
this.setState({
menuList: menuList
menuList: menuList,
menuHeight: menuList.length * 30,
});
}
@@ -98,9 +99,16 @@ class DirentMenu extends React.Component {
}
render() {
let position = this.props.menuPosition;
let style = {position: 'fixed', left: position.left, top: position.top, display: 'block'};
if (this.state.menuList.length) {
let position = this.props.menuPosition;
let left = position.left - (8 * 16); // 8rem width;
let top = position.top + (1 * 16);
let style = {position: 'fixed', left: left, top: top, display: 'block'};
let screenH = window.innerHeight;
if (screenH - position.top < this.state.menuHeight) {
top = position.top - this.state.menuHeight;
style = {position: 'fixed', left: left, top: top, display: 'block'};
}
return (
<ul className="dropdown-menu operation-menu" style={style}>
{this.state.menuList.map((item, index) => {