diff options
author | bob <bcz@cs.brown.edu> | 2019-06-06 18:01:16 -0400 |
---|---|---|
committer | bob <bcz@cs.brown.edu> | 2019-06-06 18:01:16 -0400 |
commit | cdbba1df80d20bd5852b20d05a1f0b20e3a8a293 (patch) | |
tree | 372b1a18b11d3c86a67b0f4a570998e82a87ef78 | |
parent | c97070d2a754aa30a1352cf938add2a2b2a4060a (diff) |
final changes to stack collection?
-rw-r--r-- | src/client/views/collections/CollectionStackingView.tsx | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/client/views/collections/CollectionStackingView.tsx b/src/client/views/collections/CollectionStackingView.tsx index ddd9471ab..af7e02e06 100644 --- a/src/client/views/collections/CollectionStackingView.tsx +++ b/src/client/views/collections/CollectionStackingView.tsx @@ -106,10 +106,10 @@ export class CollectionStackingView extends CollectionSubView(doc => doc) { } @computed get children() { - return this.childDocs.filter(d => !d.isMinimized).map(d => { + return this.childDocs.filter(d => !d.isMinimized).map((d, i) => { let dref = React.createRef<HTMLDivElement>(); let dxf = () => this.getDocTransform(d, dref.current!); - let colSpan = Math.ceil((this.columnWidth + this.gridGap) / (this._gridSize + this.gridGap)); + let colSpan = 1;//Math.ceil((this.columnWidth + this.gridGap) / (this._gridSize + this.gridGap)); let rowSpan = Math.ceil((this.columnWidth / d[WidthSym]() * d[HeightSym]() + this.gridGap) / (this._gridSize + this.gridGap)); let childFocus = (doc: Doc) => { doc.libraryBrush = true; @@ -148,22 +148,21 @@ export class CollectionStackingView extends CollectionSubView(doc => doc) { }) } render() { - let leftMargin = this.xMargin; - let topMargin = this.yMargin; - let itemCols = Math.floor(this.columnWidth / (this._gridSize + this.gridGap)); - let cells = Math.floor((this.props.PanelWidth() - 2 * leftMargin) / (itemCols * (this._gridSize + this.gridGap))); + let cols = this.singleColumn ? 1 : Math.floor((this.props.PanelWidth() - 2 * this.xMargin) / (this.columnWidth + 2 * this.gridGap)); + let templatecols = ""; + for (let i = 0; i < cols; i++) templatecols += `${this.columnWidth}px `; return ( <div className="collectionStackingView" style={{ height: "100%" }} ref={this.createRef} onWheel={(e: React.WheelEvent) => e.stopPropagation()}> <div className={`collectionStackingView-masonry${this.singleColumn ? "Single" : "Grid"}`} style={{ - padding: `${topMargin}px 0px 0px 0px`, + padding: `${this.yMargin}px ${this.xMargin}px 0px ${this.xMargin}px`, margin: "auto", - width: this.singleColumn ? "100%" : `${cells * itemCols * (this._gridSize + this.gridGap) + 2 * leftMargin}`, + width: this.singleColumn ? undefined : `${cols * (this.columnWidth + this.gridGap)}px`, height: "100%", position: "relative", gridGap: this.gridGap, - gridTemplateColumns: this.singleColumn ? undefined : `repeat(auto-fill, minmax(${this._gridSize}px,1fr))`, + gridTemplateColumns: this.singleColumn ? undefined : templatecols, gridAutoRows: this.singleColumn ? undefined : `${this._gridSize}px` }} > |