From db8ded2a02367e504d140270b3dc9a702f2d1ac2 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Tue, 6 Jun 2017 14:19:12 -0700 Subject: [PATCH] Implement shift+click --- src/SelectionManager.ts | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/SelectionManager.ts b/src/SelectionManager.ts index 991fa6bb..ce4c0f22 100644 --- a/src/SelectionManager.ts +++ b/src/SelectionManager.ts @@ -238,12 +238,16 @@ export class SelectionManager extends EventEmitter { this._setMouseClickCount(); console.log(this._clickCount); - if (this._clickCount === 1) { - this._onSingleClick(event); - } else if (this._clickCount === 2) { - this._onDoubleClick(event); - } else if (this._clickCount === 3) { - this._onTripleClick(event); + if (event.shiftKey) { + this._onShiftClick(event); + } else { + if (this._clickCount === 1) { + this._onSingleClick(event); + } else if (this._clickCount === 2) { + this._onDoubleClick(event); + } else if (this._clickCount === 3) { + this._onTripleClick(event); + } } // Listen on the document so that dragging outside of viewport works @@ -253,6 +257,12 @@ export class SelectionManager extends EventEmitter { this.refresh(); } + private _onShiftClick(event: MouseEvent): void { + if (this._model.selectionStart) { + this._model.selectionEnd = this._getMouseBufferCoords(event); + } + } + private _onSingleClick(event: MouseEvent): void { this._model.selectionStartLength = 0; this._model.isSelectAllActive = false;