diff options
author | laurawilsonri <laura_wilson@brown.edu> | 2019-02-16 15:45:32 -0500 |
---|---|---|
committer | laurawilsonri <laura_wilson@brown.edu> | 2019-02-16 15:45:32 -0500 |
commit | 784eb6e6ba1daf00d3c74239f88669b669e9739c (patch) | |
tree | a036e639a901f2b7a6f00b892448b5a4a4609641 /src/client/views/collections/CollectionViewBase.tsx | |
parent | c835f47a32336c12e6ad7497b72694bb06dc2487 (diff) | |
parent | 3f98d6ec6050e7faa15179871f0d9669c1188a78 (diff) |
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web into improveText
Diffstat (limited to 'src/client/views/collections/CollectionViewBase.tsx')
-rw-r--r-- | src/client/views/collections/CollectionViewBase.tsx | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/client/views/collections/CollectionViewBase.tsx b/src/client/views/collections/CollectionViewBase.tsx index 274f26ecc..2f304f666 100644 --- a/src/client/views/collections/CollectionViewBase.tsx +++ b/src/client/views/collections/CollectionViewBase.tsx @@ -10,15 +10,21 @@ import React = require("react"); import { DocumentView } from "../nodes/DocumentView"; import { CollectionDockingView } from "./CollectionDockingView"; import { CollectionFreeFormDocumentView } from "../nodes/CollectionFreeFormDocumentView"; +import { Transform } from "../../util/Transform"; export interface CollectionViewProps { CollectionFieldKey: Key; DocumentForCollection: Document; ContainingDocumentView: Opt<DocumentView>; + GetTransform: () => Transform; BackgroundView: Opt<DocumentView>; +<<<<<<< HEAD DownX: number; DownY: number; +======= + ParentScaling: number; +>>>>>>> 3f98d6ec6050e7faa15179871f0d9669c1188a78 } export const COLLECTION_BORDER_WIDTH = 2; @@ -26,8 +32,8 @@ export const COLLECTION_BORDER_WIDTH = 2; @observer export class CollectionViewBase extends React.Component<CollectionViewProps> { - public static LayoutString(collectionType: string) { - return `<${collectionType} DocumentForCollection={Document} CollectionFieldKey={DataKey} ContainingDocumentView={DocumentView}/>`; + public static LayoutString(collectionType: string, fieldKey: string = "DataKey") { + return `<${collectionType} ParentScaling={ParentScaling} DocumentForCollection={Document} CollectionFieldKey={${fieldKey}} ContainingDocumentView={DocumentView} BackgroundView={BackgroundView} />`; } @computed public get active(): boolean { @@ -46,15 +52,18 @@ export class CollectionViewBase extends React.Component<CollectionViewProps> { } @action - removeDocument = (doc: Document): void => { + removeDocument = (doc: Document): boolean => { //TODO This won't create the field if it doesn't already exist const value = this.props.DocumentForCollection.GetData(this.props.CollectionFieldKey, ListField, new Array<Document>()) - if (value.indexOf(doc) !== -1) { - value.splice(value.indexOf(doc), 1) + let index = value.indexOf(doc); + if (index !== -1) { + value.splice(index, 1) SelectionManager.DeselectAll() ContextMenu.Instance.clearItems() + return true; } + return false } }
\ No newline at end of file |