提交 cd3481d9 编写于 作者: P Peng Lyu

right click context menu for inline diff actions

上级 13b681ee
......@@ -122,15 +122,12 @@ export class InlineDiffMargin extends Disposable {
}));
}
this._register(dom.addStandardDisposableListener(this._diffActions, 'mousedown', e => {
const { top, height } = dom.getDomNodePagePosition(this._diffActions);
let pad = Math.floor(lineHeight / 3);
e.preventDefault();
const showContextMenu = (x: number, y: number) => {
this._contextMenuService.showContextMenu({
getAnchor: () => {
return {
x: e.posx,
y: top + height + pad
x,
y
};
},
getActions: () => {
......@@ -141,6 +138,15 @@ export class InlineDiffMargin extends Disposable {
},
autoSelectFirstItem: true
});
};
this._register(dom.addStandardDisposableListener(this._diffActions, 'mousedown', e => {
const { top, height } = dom.getDomNodePagePosition(this._diffActions);
let pad = Math.floor(lineHeight / 3);
e.preventDefault();
showContextMenu(e.posx, top + height + pad);
}));
this._register(editor.onMouseMove((e: editorBrowser.IEditorMouseEvent) => {
......@@ -157,6 +163,22 @@ export class InlineDiffMargin extends Disposable {
this.visibility = false;
}
}));
this._register(editor.onMouseDown((e: editorBrowser.IEditorMouseEvent) => {
if (!e.event.rightButton) {
return;
}
if (e.target.type === editorBrowser.MouseTargetType.CONTENT_VIEW_ZONE || e.target.type === editorBrowser.MouseTargetType.GUTTER_VIEW_ZONE) {
const viewZoneId = e.target.detail.viewZoneId;
if (viewZoneId === this._viewZoneId) {
e.event.preventDefault();
currentLineNumberOffset = this._updateLightBulbPosition(this._marginDomNode, e.event.browserEvent.y, lineHeight);
showContextMenu(e.event.posx, e.event.posy + lineHeight);
}
}
}));
}
private _updateLightBulbPosition(marginDomNode: HTMLElement, y: number, lineHeight: number): number {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册