From 5e67e3db522c2080c51de53c1fbd4be570e62a98 Mon Sep 17 00:00:00 2001
From: ljungster <parkerljung@gmail.com>
Date: Tue, 26 Apr 2022 07:27:39 -0400
Subject: columns (sort of) working

---
 .../views/collections/CollectionNoteTakingView.tsx  | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

(limited to 'src/client/views/collections/CollectionNoteTakingView.tsx')

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 ?? ""}
-- 
cgit v1.2.3-70-g09d2

