Merge pull request #236941 from dmitrysonder/dmitrysonder/issue236939

refactor: use EventType constants for events
pull/229099/merge
Johannes Rieken 2025-01-06 10:00:02 +01:00 committed by GitHub
commit 47258d8289
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View File

@ -150,13 +150,13 @@ export class EditorMouseEventFactory {
}
public onContextMenu(target: HTMLElement, callback: (e: EditorMouseEvent) => void): IDisposable {
return dom.addDisposableListener(target, 'contextmenu', (e: MouseEvent) => {
return dom.addDisposableListener(target, dom.EventType.CONTEXT_MENU, (e: MouseEvent) => {
callback(this._create(e));
});
}
public onMouseUp(target: HTMLElement, callback: (e: EditorMouseEvent) => void): IDisposable {
return dom.addDisposableListener(target, 'mouseup', (e: MouseEvent) => {
return dom.addDisposableListener(target, dom.EventType.MOUSE_UP, (e: MouseEvent) => {
callback(this._create(e));
});
}
@ -180,7 +180,7 @@ export class EditorMouseEventFactory {
}
public onMouseMove(target: HTMLElement, callback: (e: EditorMouseEvent) => void): IDisposable {
return dom.addDisposableListener(target, 'mousemove', (e) => callback(this._create(e)));
return dom.addDisposableListener(target, dom.EventType.MOUSE_MOVE, (e) => callback(this._create(e)));
}
}

View File

@ -200,7 +200,7 @@ export class NativeTitlebarPart extends BrowserTitlebarPart {
}
const zoomFactor = getZoomFactor(getWindow(this.element));
this.onContextMenu(new MouseEvent('mouseup', { clientX: x / zoomFactor, clientY: y / zoomFactor }), MenuId.TitleBarContext);
this.onContextMenu(new MouseEvent(EventType.MOUSE_UP, { clientX: x / zoomFactor, clientY: y / zoomFactor }), MenuId.TitleBarContext);
}));
}