diff options
| author | eeng5 <eleanor_eng@brown.edu> | 2019-08-23 16:27:25 -0400 |
|---|---|---|
| committer | eeng5 <eleanor_eng@brown.edu> | 2019-08-23 16:27:25 -0400 |
| commit | 0ac0fd9cf2d93bf328b167710631cc46b1c27187 (patch) | |
| tree | 8631e1a74437e167eed58b73dae60a912417885f /src/client/views/collections/CollectionStackingView.tsx | |
| parent | 77487a00589f216b6dbdd764f646c599f9b17ae9 (diff) | |
autoheight works for masonry
Diffstat (limited to 'src/client/views/collections/CollectionStackingView.tsx')
| -rw-r--r-- | src/client/views/collections/CollectionStackingView.tsx | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/client/views/collections/CollectionStackingView.tsx b/src/client/views/collections/CollectionStackingView.tsx index 6d4ac54d6..678e10dc5 100644 --- a/src/client/views/collections/CollectionStackingView.tsx +++ b/src/client/views/collections/CollectionStackingView.tsx @@ -96,11 +96,15 @@ export class CollectionStackingView extends CollectionSubView(doc => doc) { // is there any reason this needs to exist? -syip. yes, it handles autoHeight for stacking views (masonry isn't yet supported). this._heightDisposer = reaction(() => { - if (this.isStackingView && BoolCast(this.props.Document.autoHeight)) { + if (BoolCast(this.props.Document.autoHeight)) { let sectionsList = Array.from(this.Sections.size ? this.Sections.values() : [this.filteredChildren]); - return this.props.ContentScaling() * sectionsList.reduce((maxHght, s) => Math.max(maxHght, - (this.Sections.size ? 50 : 0) + s.reduce((height, d, i) => height + this.childDocHeight(d) + (i === s.length - 1 ? this.yMargin : this.gridGap), this.yMargin) - ), 0); + if (this.isStackingView) { + return this.props.ContentScaling() * sectionsList.reduce((maxHght, s) => Math.max(maxHght, + (this.Sections.size ? 50 : 0) + s.reduce((height, d, i) => height + this.childDocHeight(d) + (i === s.length - 1 ? this.yMargin : this.gridGap), this.yMargin)), 0); + } else { + return this.props.ContentScaling() * sectionsList.reduce((totalHeight, s) => totalHeight + + (this.Sections.size ? 50 : 0) + s.reduce((height, d, i) => height + this.childDocHeight(d) + (i === s.length - 1 ? this.yMargin : this.gridGap), this.yMargin) + 40, 0); + } } return -1; }, |
