diff --git a/app/assets/App.less b/app/assets/App.less index 2bc75a7b..29c68194 100644 --- a/app/assets/App.less +++ b/app/assets/App.less @@ -1,3 +1,5 @@ +@import '~#assets/common.less'; + html body { height: 100%; padding: 0; @@ -58,7 +60,7 @@ p { background: #d2d5da; .github-star { - height: 64px; + height: @navHeight; display: flex; align-items: center; margin-right: 8px; @@ -103,6 +105,7 @@ p { display: flex; z-index: 9; padding-left: 18px; + height: @navHeight; .studio-logo img { width: 126px; diff --git a/app/assets/common.less b/app/assets/common.less new file mode 100644 index 00000000..d01831c2 --- /dev/null +++ b/app/assets/common.less @@ -0,0 +1,2 @@ +@navHeight: 64px; +@controlHeight: 65px; diff --git a/app/assets/components/DisplayPanel/index.less b/app/assets/components/DisplayPanel/index.less index fcfe7819..e4fe3607 100644 --- a/app/assets/components/DisplayPanel/index.less +++ b/app/assets/components/DisplayPanel/index.less @@ -1,10 +1,12 @@ +@import '~#assets/common.less'; + .display-drawer { - top: 129px; + position: absolute; + top: 0; height: 100%; z-index: 0; .ant-drawer-content-wrapper { - height: calc(100% - 129px); border-right: 1px solid #d9d9d9; box-shadow: none !important; } diff --git a/app/assets/components/Expand/index.less b/app/assets/components/Expand/index.less index 1894122e..b445d868 100644 --- a/app/assets/components/Expand/index.less +++ b/app/assets/components/Expand/index.less @@ -1,9 +1,11 @@ +@import '~#assets/common.less'; + .expand-drawer { - top: 129px; + top: 0; z-index: 0; + position: absolute; > .ant-drawer-content-wrapper { - height: calc(100% - 129px); border-left: 1px solid #d9d9d9; box-shadow: none !important; } diff --git a/app/assets/modules/Explore/Control/index.less b/app/assets/modules/Explore/Control/index.less index 44f46e6b..5e05c530 100644 --- a/app/assets/modules/Explore/Control/index.less +++ b/app/assets/modules/Explore/Control/index.less @@ -1,7 +1,9 @@ +@import '~#assets/common.less'; + .nebula-explore .control { position: relative; z-index: 1; - height: 65px; + height: @controlHeight; padding: 12px; display: flex; border-bottom: 1px solid #eee; diff --git a/app/assets/modules/Explore/NebulaGraph/Menu/index.tsx b/app/assets/modules/Explore/NebulaGraph/Menu/index.tsx index df4d8202..798d4657 100644 --- a/app/assets/modules/Explore/NebulaGraph/Menu/index.tsx +++ b/app/assets/modules/Explore/NebulaGraph/Menu/index.tsx @@ -17,6 +17,44 @@ interface IProps { width: number; height: number; } +const menuConfig = [ + { + component: , + }, + { + component: , + }, + { + component: , + }, + { + component: , + }, + { + component: , + }, + { + component: , + }, + { + component: , + }, + { + component: , + }, + { + component: , + }, + { + component: , + }, + { + component: , + }, +]; + +const DEFAULT_MENU_HEIGHT = menuConfig.length * 43; + class Menu extends React.PureComponent { componentDidMount() { const self = this; @@ -26,11 +64,15 @@ class Menu extends React.PureComponent { d3.event.preventDefault(); }) .on('click', () => { - d3.select('.d3-click-right-menu').style('visibility', 'hidden'); + d3.select('.d3-click-right-menu') + .style('visibility', 'hidden') + .style('height', `${DEFAULT_MENU_HEIGHT}px`); }); d3.selectAll('.panel-btn-item').on('click', () => { - d3.select('.d3-click-right-menu').style('visibility', 'hidden'); + d3.select('.d3-click-right-menu') + .style('visibility', 'hidden') + .style('height', `${DEFAULT_MENU_HEIGHT}px`); }); } @@ -50,51 +92,34 @@ class Menu extends React.PureComponent { left = left - menuWidth; } if (menuHeight + top > height) { - top = top - menuHeight; + if (height - top > top) { + $rightMenu + .style('height', `${height - top - 30}px`) + .style('overflow', 'auto'); + } else { + top = + top - menuHeight < 0 + ? height - event.offsetY - 10 + : top - menuHeight; + let _menuHeight = DEFAULT_MENU_HEIGHT; + if (top < 0) { + _menuHeight = height - event.offsetY - 10; + } else if (_menuHeight + top > height) { + _menuHeight = height - top - 30; + } + $rightMenu + .style('height', `${_menuHeight}px`) + .style('overflow', 'auto'); + } } $rightMenu - .style('left', left + 'px') - .style('top', top + 'px') + .style('left', `${left}px`) + .style('top', `${top}px`) .style('visibility', 'visible'); } }; render() { - const menuConfig = [ - { - component: , - }, - { - component: , - }, - { - component: , - }, - { - component: , - }, - { - component: , - }, - { - component: , - }, - { - component: , - }, - { - component: , - }, - { - component: , - }, - { - component: , - }, - { - component: , - }, - ]; return (
{menuConfig.map((item, index) => ( diff --git a/app/assets/modules/Explore/NebulaGraph/Panel/index.less b/app/assets/modules/Explore/NebulaGraph/Panel/index.less index 8d9c0999..4f1612e7 100644 --- a/app/assets/modules/Explore/NebulaGraph/Panel/index.less +++ b/app/assets/modules/Explore/NebulaGraph/Panel/index.less @@ -1,6 +1,8 @@ +@import '~#assets/common.less'; + .graph-wrap { position: relative; - height: calc(100% - 65px); + height: calc(100% - @controlHeight); overflow: hidden; > .panel {