contextmenu 位置优化一下

This commit is contained in:
liaoxuezhi 2019-11-20 20:04:44 +08:00
parent 4791f4f5d7
commit 859d5b950c

View File

@ -85,6 +85,13 @@ export class ContextMenu extends React.Component<
info: {x: number; y: number; align?: 'left' | 'right'},
menus: Array<MenuItem>
) {
if (info.x + 200 > window.innerWidth) {
info.x = window.innerWidth - 200;
info.align = 'left';
} else if (info.x + 300 > window.innerWidth) {
info.align = 'left';
}
this.setState({
isOpened: true,
x: info.x,