diff options
author | ljungster <parkerljung@gmail.com> | 2022-04-26 07:27:39 -0400 |
---|---|---|
committer | ljungster <parkerljung@gmail.com> | 2022-04-26 07:27:39 -0400 |
commit | 5e67e3db522c2080c51de53c1fbd4be570e62a98 (patch) | |
tree | 05930a3eb7261b50db7d0648dbb2d3f728e369f9 /src/client/views/collections/CollectionNoteTakingView.tsx | |
parent | a0f46b6216e8150e03b1790a42eb17cc1958a45c (diff) |
columns (sort of) working
Diffstat (limited to 'src/client/views/collections/CollectionNoteTakingView.tsx')
-rw-r--r-- | src/client/views/collections/CollectionNoteTakingView.tsx | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/client/views/collections/CollectionNoteTakingView.tsx b/src/client/views/collections/CollectionNoteTakingView.tsx index 5f9a4f4d0..0cdf63939 100644 --- a/src/client/views/collections/CollectionNoteTakingView.tsx +++ b/src/client/views/collections/CollectionNoteTakingView.tsx @@ -67,12 +67,14 @@ export class CollectionNoteTakingView extends CollectionSubView<Partial<collecti @computed get yMargin() { return this.props.yPadding || NumCast(this.layoutDoc._yMargin, 5); } // 2 * this.gridGap)); } @computed get gridGap() { return NumCast(this.layoutDoc._gridGap, 10); } @computed get numGroupColumns() { return this.columnHeaders.length; } - @computed get columnWidth() {return this.props.PanelWidth() - 2 * this.xMargin;} + // @computed get columnWidth() {return this.props.PanelWidth() - 2 * this.xMargin;} //-------------------------------------------- Parker's Playground --------------------------------------------// - draggedDocBackgroundColors: string[] = [] + // draggedDocBackgroundColors: string[] = [] columnStartXCoords: number[] = [] - dividerXCoords: number[] = [] + @computed get PanelWidth() {return this.props.PanelWidth()} + @computed get maxColWdith() {return this.props.PanelWidth() - 2 * this.xMargin;} + // dividerXCoords: number[] = [] //-------------------------------------------------------------------------------------------------------------// constructor(props: any) { @@ -315,8 +317,9 @@ export class CollectionNoteTakingView extends CollectionSubView<Partial<collecti const nw = Doc.NativeWidth(childLayoutDoc, childDataDoc) || (!(childLayoutDoc._fitWidth || this.props.childFitWidth?.(d)) ? d[WidthSym]() : 0); const nh = Doc.NativeHeight(childLayoutDoc, childDataDoc) || (!(childLayoutDoc._fitWidth || this.props.childFitWidth?.(d)) ? d[HeightSym]() : 0); if (nw && nh) { - const colWid = this.columnWidth / this.numGroupColumns; - const docWid = this.layoutDoc._columnsFill ? colWid : Math.min(this.getDocWidth(d), colWid); + // const colWid = this.columnWidth / this.numGroupColumns; + // const docWid = this.layoutDoc._columnsFill ? colWid : Math.min(this.getDocWidth(d), colWid); + const docWid = this.getDocWidth(d) return Math.min( maxHeight, docWid * nh / nw); @@ -347,7 +350,7 @@ export class CollectionNoteTakingView extends CollectionSubView<Partial<collecti // } resizeColumns = (n: number) => { - const totalWidth = this.props.PanelWidth() + const totalWidth = this.PanelWidth const colWidth = totalWidth / n const newColXCoords: number[] = [] let colStart = 0 @@ -356,6 +359,7 @@ export class CollectionNoteTakingView extends CollectionSubView<Partial<collecti colStart += colWidth } this.columnStartXCoords = newColXCoords + console.log(newColXCoords) } // TODO: This is where you want to create a copy of the document to take its place @@ -558,10 +562,13 @@ export class CollectionNoteTakingView extends CollectionSubView<Partial<collecti DataDoc={this.props.DataDoc} resizeColumns={this.resizeColumns.bind(this)} renderChildren={this.children} - columnWidth={this.columnWidth} + // columnWidth={this.columnWidth} numGroupColumns={this.numGroupColumns} gridGap={this.gridGap} pivotField={this.pivotField} + columnStartXCoords={this.columnStartXCoords} + maxColWidth={this.maxColWdith} + PanelWidth={this.PanelWidth} key={heading?.heading ?? ""} headings={this.headings} heading={heading?.heading ?? ""} |