diff options
author | laurawilsonri <laura_wilson@brown.edu> | 2019-02-24 14:37:07 -0500 |
---|---|---|
committer | laurawilsonri <laura_wilson@brown.edu> | 2019-02-24 14:37:07 -0500 |
commit | f7b46167a7fd5d7ecf560dbd72e7d3295ba6c0c9 (patch) | |
tree | cc96c12c49e6c03c98b0f0e6f642e0902948283b /src/client/util/SelectionManager.ts | |
parent | 3ad38f0445178bdfe025e4f6da60f68f03876f56 (diff) | |
parent | d9d55e422826da1fe87aa7973c92e54bc0c99f02 (diff) |
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web into improveText
Diffstat (limited to 'src/client/util/SelectionManager.ts')
-rw-r--r-- | src/client/util/SelectionManager.ts | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/client/util/SelectionManager.ts b/src/client/util/SelectionManager.ts index 658bf8f93..82767bdcd 100644 --- a/src/client/util/SelectionManager.ts +++ b/src/client/util/SelectionManager.ts @@ -1,19 +1,20 @@ -import { CollectionFreeFormDocumentView } from "../views/nodes/CollectionFreeFormDocumentView"; import { observable, action } from "mobx"; import { CollectionFreeFormView } from "../views/collections/CollectionFreeFormView"; +import { DocumentView } from "../views/nodes/DocumentView"; export namespace SelectionManager { class Manager { @observable - SelectedDocuments: Array<CollectionFreeFormDocumentView> = []; + SelectedDocuments: Array<DocumentView> = []; @action - SelectDoc(doc: CollectionFreeFormDocumentView, ctrlPressed: boolean): void { + SelectDoc(doc: DocumentView, ctrlPressed: boolean): void { //remove preview cursor from collection if (doc.props.ContainingCollectionView != undefined && doc.props.ContainingCollectionView instanceof CollectionFreeFormView) { doc.props.ContainingCollectionView.hidePreviewCursor(); } + // if doc is not in SelectedDocuments, add it if (!ctrlPressed) { manager.SelectedDocuments = []; @@ -27,11 +28,11 @@ export namespace SelectionManager { const manager = new Manager; - export function SelectDoc(doc: CollectionFreeFormDocumentView, ctrlPressed: boolean): void { + export function SelectDoc(doc: DocumentView, ctrlPressed: boolean): void { manager.SelectDoc(doc, ctrlPressed) } - export function IsSelected(doc: CollectionFreeFormDocumentView): boolean { + export function IsSelected(doc: DocumentView): boolean { return manager.SelectedDocuments.indexOf(doc) !== -1; } @@ -39,7 +40,7 @@ export namespace SelectionManager { manager.SelectedDocuments = [] } - export function SelectedDocuments(): Array<CollectionFreeFormDocumentView> { + export function SelectedDocuments(): Array<DocumentView> { return manager.SelectedDocuments; } }
\ No newline at end of file |