From 859d5b950c0b98c42818160e1e7614d1f1f945ba Mon Sep 17 00:00:00 2001 From: liaoxuezhi Date: Wed, 20 Nov 2019 20:04:44 +0800 Subject: [PATCH] =?UTF-8?q?contextmenu=20=E4=BD=8D=E7=BD=AE=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E4=B8=80=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ContextMenu.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/components/ContextMenu.tsx b/src/components/ContextMenu.tsx index 5b6755b06..06f9274c8 100644 --- a/src/components/ContextMenu.tsx +++ b/src/components/ContextMenu.tsx @@ -85,6 +85,13 @@ export class ContextMenu extends React.Component< info: {x: number; y: number; align?: 'left' | 'right'}, menus: Array ) { + 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,