未验证 提交 230baa73 编写于 作者: S SteVen Batten 提交者: GitHub

Fix/84231 (#84872)

* account for padding on macOS
fixes #84231

* move to native context menu service
and account for zoom
上级 524441ff
......@@ -91,18 +91,25 @@ class NativeContextMenuService extends Disposable implements IContextMenuService
const anchor = delegate.getAnchor();
let x: number, y: number;
let zoom = webFrame.getZoomFactor();
if (dom.isHTMLElement(anchor)) {
let elementPosition = dom.getDomNodePagePosition(anchor);
x = elementPosition.left;
y = elementPosition.top + elementPosition.height;
// Shift macOS menus by a few pixels below elements
// to account for extra padding on top of native menu
// https://github.com/microsoft/vscode/issues/84231
if (isMacintosh) {
y += 4 / zoom;
}
} else {
const pos: { x: number; y: number; } = anchor;
x = pos.x + 1; /* prevent first item from being selected automatically under mouse */
y = pos.y;
}
let zoom = webFrame.getZoomFactor();
x *= zoom;
y *= zoom;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册