diff options
| author | bob <bcz@cs.brown.edu> | 2020-01-10 16:05:02 -0500 |
|---|---|---|
| committer | bob <bcz@cs.brown.edu> | 2020-01-10 16:05:02 -0500 |
| commit | 12a54031b6b22b02c5fc08f80b3079d84785e457 (patch) | |
| tree | bf277107837a4079981ba3e5a3e3910c2c892a87 /src/client | |
| parent | 596d30bc3f755eaafd413ced7613ace6735458fa (diff) | |
| parent | ee10e28ba3f7c97b0947e2065d04562e33ed3498 (diff) | |
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web
Diffstat (limited to 'src/client')
| -rw-r--r-- | src/client/views/CollectionMulticolumnView.tsx | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/client/views/CollectionMulticolumnView.tsx b/src/client/views/CollectionMulticolumnView.tsx new file mode 100644 index 000000000..94e86c048 --- /dev/null +++ b/src/client/views/CollectionMulticolumnView.tsx @@ -0,0 +1,44 @@ +import { observer } from 'mobx-react'; +import { makeInterface } from '../../new_fields/Schema'; +import { documentSchema } from '../../new_fields/documentSchemas'; +import { CollectionSubView, SubCollectionViewProps } from './collections/CollectionSubView'; +import { DragManager } from '../util/DragManager'; +import * as React from "react"; +import { Doc } from '../../new_fields/Doc'; +import { NumCast } from '../../new_fields/Types'; + +type MulticolumnDocument = makeInterface<[typeof documentSchema]>; +const MulticolumnDocument = makeInterface(documentSchema); + +@observer +export default class CollectionMulticolumnView extends CollectionSubView(MulticolumnDocument) { + + constructor(props: Readonly<SubCollectionViewProps>) { + super(props); + const { Document } = this.props; + Document.multicolumnData = new Doc(); + } + + private _dropDisposer?: DragManager.DragDropDisposer; + protected createDropTarget = (ele: HTMLDivElement) => { //used for stacking and masonry view + this._dropDisposer && this._dropDisposer(); + if (ele) { + this._dropDisposer = DragManager.MakeDropTarget(ele, this.drop.bind(this)); + } + } + + public isCurrent(doc: Doc) { return !doc.isMinimized && (Math.abs(NumCast(doc.displayTimecode, -1) - NumCast(this.Document.currentTimecode, -1)) < 1.5 || NumCast(doc.displayTimecode, -1) === -1); } + + render() { + return ( + <div className={"collectionMulticolumnView_outer"}> + <div className={"collectionMulticolumnView_contents"}> + {this.childLayoutPairs.filter(pair => this.isCurrent(pair.layout)).map(({ layout, data }) => { + + })} + </div> + </div> + ); + } + +}
\ No newline at end of file |
