diff --git a/browser/src/Input/Mouse.ts b/browser/src/Input/Mouse.ts index 6e1c2b3dc5..4b0910b1a8 100644 --- a/browser/src/Input/Mouse.ts +++ b/browser/src/Input/Mouse.ts @@ -16,8 +16,20 @@ export class Mouse extends EventEmitter { this._editorElement.addEventListener("mousedown", (evt: MouseEvent) => { const { line, column } = this._convertEventToPosition(evt) - this.emit("mouse", `<${line},${column}>`) - this._isDragging = true + switch (evt.which) { + case 1: + this.emit("mouse", `<${line},${column}>`) + this._isDragging = true + break + case 2: + this.emit("mouse", ``) + break + case 3: + this.emit("mouse", `<${line},${column}>`) + break + default: + break + } }) this._editorElement.addEventListener("mousemove", (evt: MouseEvent) => { @@ -29,10 +41,16 @@ export class Mouse extends EventEmitter { }) this._editorElement.addEventListener("mouseup", (evt: MouseEvent) => { - const { line, column } = this._convertEventToPosition(evt) - - this.emit("mouse", `<${line},${column}>`) - this._isDragging = false + switch (evt.which) { + case 1: + const { line, column } = this._convertEventToPosition(evt) + + this.emit("mouse", `<${line},${column}>`) + this._isDragging = false + break + default: + break + } }) // The internet told me 'mousewheel' is deprecated and use this.