aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbob <bcz@cs.brown.edu>2019-06-06 16:28:04 -0400
committerbob <bcz@cs.brown.edu>2019-06-06 16:28:04 -0400
commitc97070d2a754aa30a1352cf938add2a2b2a4060a (patch)
tree163bbfb3661a1e1750aa7dce9f998aadd3983efd
parent3ed872edc6478a6106c61a99cbcc94a9412136a8 (diff)
from last
-rw-r--r--src/client/views/collections/CollectionStackingView.tsx9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/client/views/collections/CollectionStackingView.tsx b/src/client/views/collections/CollectionStackingView.tsx
index 50194ba95..ddd9471ab 100644
--- a/src/client/views/collections/CollectionStackingView.tsx
+++ b/src/client/views/collections/CollectionStackingView.tsx
@@ -81,13 +81,12 @@ export class CollectionStackingView extends CollectionSubView(doc => doc) {
let dref = React.createRef<HTMLDivElement>();
let script = undefined;
let colWidth = () => d.nativeWidth ? Math.min(d[WidthSym](), this.columnWidth) : this.columnWidth;
- let margin = colWidth() < this.columnWidth ? "auto" : undefined;
let rowHeight = () => this.singleColDocHeight(d);
let dxf = () => this.getDocTransform(d, dref.current!).scale(this.columnWidth / d[WidthSym]());
return <div className="collectionStackingView-masonryDoc"
key={d[Id]}
ref={dref}
- style={{ marginTop: `${i ? this.yMargin : 0}px`, width: colWidth(), height: rowHeight(), marginLeft: margin, marginRight: margin }} >
+ style={{ marginTop: `${i ? this.yMargin : 0}px`, width: colWidth(), height: rowHeight(), marginLeft: "auto", marginRight: "auto" }} >
<CollectionSchemaPreview
Document={d}
width={colWidth}
@@ -151,15 +150,15 @@ export class CollectionStackingView extends CollectionSubView(doc => doc) {
render() {
let leftMargin = this.xMargin;
let topMargin = this.yMargin;
- let itemCols = Math.ceil(this.columnWidth / (this._gridSize + this.gridGap));
+ let itemCols = Math.floor(this.columnWidth / (this._gridSize + this.gridGap));
let cells = Math.floor((this.props.PanelWidth() - 2 * leftMargin) / (itemCols * (this._gridSize + this.gridGap)));
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 ${leftMargin}px`,
- marginRight: "auto",
+ padding: `${topMargin}px 0px 0px 0px`,
+ margin: "auto",
width: this.singleColumn ? "100%" : `${cells * itemCols * (this._gridSize + this.gridGap) + 2 * leftMargin}`,
height: "100%",
position: "relative",