refactor: use EventType constants for events

pull/236941/head
Dmitry Sonder 2024-12-25 14:13:11 +07:00
parent 4fa5611d67
commit 5cc442a418
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 { 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)); callback(this._create(e));
}); });
} }
public onMouseUp(target: HTMLElement, callback: (e: EditorMouseEvent) => void): IDisposable { 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)); callback(this._create(e));
}); });
} }
@ -180,7 +180,7 @@ export class EditorMouseEventFactory {
} }
public onMouseMove(target: HTMLElement, callback: (e: EditorMouseEvent) => void): IDisposable { 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)); 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);
})); }));
} }