Fix positioning of the thread context menu (#7918)
This commit is contained in:
parent
b02d5ecb97
commit
115e17b097
2 changed files with 15 additions and 38 deletions
|
@ -260,10 +260,11 @@ export default class ContextMenu extends React.PureComponent<IProps, IState> {
|
|||
const { windowWidth, windowHeight } = UIStore.instance;
|
||||
if (contextMenuRect) {
|
||||
if (position.top !== undefined) {
|
||||
position.top = Math.min(
|
||||
position.top,
|
||||
windowHeight - contextMenuRect.height - WINDOW_PADDING,
|
||||
);
|
||||
let maxTop = windowHeight - WINDOW_PADDING;
|
||||
if (!this.props.bottomAligned) {
|
||||
maxTop -= contextMenuRect.height;
|
||||
}
|
||||
position.top = Math.min(position.top, maxTop);
|
||||
// Adjust the chevron if necessary
|
||||
if (chevronOffset.top !== undefined) {
|
||||
chevronOffset.top = props.chevronOffset + props.top - position.top;
|
||||
|
@ -278,10 +279,11 @@ export default class ContextMenu extends React.PureComponent<IProps, IState> {
|
|||
}
|
||||
}
|
||||
if (position.left !== undefined) {
|
||||
position.left = Math.min(
|
||||
position.left,
|
||||
windowWidth - contextMenuRect.width - WINDOW_PADDING,
|
||||
);
|
||||
let maxLeft = windowWidth - WINDOW_PADDING;
|
||||
if (!this.props.rightAligned) {
|
||||
maxLeft -= contextMenuRect.width;
|
||||
}
|
||||
position.left = Math.min(position.left, maxLeft);
|
||||
if (chevronOffset.left !== undefined) {
|
||||
chevronOffset.left = props.chevronOffset + props.left - position.left;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue