aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/SelectionManager.ts
diff options
context:
space:
mode:
authorAbdullah Ahmed <abdullah_ahmed@brown.edu>2019-10-05 19:17:11 -0400
committerAbdullah Ahmed <abdullah_ahmed@brown.edu>2019-10-05 19:17:11 -0400
commit57b57b2d82b385ec9aa9d59c0899dc8f48a31223 (patch)
treeea9fef42849fc1341c6da1300bc4e5f25048cb14 /src/client/util/SelectionManager.ts
parenta44e12f4625caca5d75a456f0ba1ab977149ae6e (diff)
parent961cb1566e16edb353975ec436a4445c1cf3db0f (diff)
meged
Diffstat (limited to 'src/client/util/SelectionManager.ts')
-rw-r--r--src/client/util/SelectionManager.ts20
1 files changed, 3 insertions, 17 deletions
diff --git a/src/client/util/SelectionManager.ts b/src/client/util/SelectionManager.ts
index 9efef888d..df1b46b33 100644
--- a/src/client/util/SelectionManager.ts
+++ b/src/client/util/SelectionManager.ts
@@ -24,6 +24,9 @@ export namespace SelectionManager {
manager.SelectedDocuments.push(docView);
// console.log(manager.SelectedDocuments);
docView.props.whenActiveChanged(true);
+ } else if (!ctrlPressed && manager.SelectedDocuments.length > 1) {
+ manager.SelectedDocuments.map(dv => dv !== docView && dv.props.whenActiveChanged(false));
+ manager.SelectedDocuments = [docView];
}
}
@action
@@ -38,7 +41,6 @@ export namespace SelectionManager {
DeselectAll(): void {
manager.SelectedDocuments.map(dv => dv.props.whenActiveChanged(false));
manager.SelectedDocuments = [];
- FormattedTextBox.InputBoxOverlay = undefined;
}
}
@@ -84,20 +86,4 @@ export namespace SelectionManager {
export function SelectedDocuments(): Array<DocumentView> {
return manager.SelectedDocuments.slice();
}
- export function ViewsSortedHorizontally(): DocumentView[] {
- let sorted = SelectionManager.SelectedDocuments().slice().sort((doc1, doc2) => {
- if (NumCast(doc1.props.Document.x) > NumCast(doc2.props.Document.x)) return 1;
- if (NumCast(doc1.props.Document.x) < NumCast(doc2.props.Document.x)) return -1;
- return 0;
- });
- return sorted;
- }
- export function ViewsSortedVertically(): DocumentView[] {
- let sorted = SelectionManager.SelectedDocuments().slice().sort((doc1, doc2) => {
- if (NumCast(doc1.props.Document.y) > NumCast(doc2.props.Document.y)) return 1;
- if (NumCast(doc1.props.Document.y) < NumCast(doc2.props.Document.y)) return -1;
- return 0;
- });
- return sorted;
- }
}