diff options
author | ljungster <parkerljung@gmail.com> | 2022-04-28 10:18:53 -0400 |
---|---|---|
committer | ljungster <parkerljung@gmail.com> | 2022-04-28 10:18:53 -0400 |
commit | 6f17d019715ee20a29588edac94c790e57628be9 (patch) | |
tree | 345da8c9553c8bb51456da953f2963fc4b56ea49 /src | |
parent | 28e636ef7d7ed541dd735ec5cb9e29a6505ac787 (diff) |
still struggling
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/collections/CollectionNoteTakingView.tsx | 40 | ||||
-rw-r--r-- | src/client/views/collections/CollectionNoteTakingViewDivider.tsx | 10 |
2 files changed, 31 insertions, 19 deletions
diff --git a/src/client/views/collections/CollectionNoteTakingView.tsx b/src/client/views/collections/CollectionNoteTakingView.tsx index 818c5b671..4bb16b01e 100644 --- a/src/client/views/collections/CollectionNoteTakingView.tsx +++ b/src/client/views/collections/CollectionNoteTakingView.tsx @@ -85,6 +85,9 @@ export class CollectionNoteTakingView extends CollectionSubView<Partial<collecti // TODO: what is a layout doc? Is it literally how this document is supposed to be layed out? // here we're making an empty list of column headers (again, what Mehek showed us) this.layoutDoc._columnHeaders = new List<SchemaHeaderField>(); + // this.state = { + // columnStartXCoords: [0] + // } this.columnStartXCoords = [0] } else { //TODO instantiate columnStartXCoords and dividerXCoords @@ -628,20 +631,25 @@ export class CollectionNoteTakingView extends CollectionSubView<Partial<collecti // DragManager.StartDrag(e.target, {}, e.clientX, e.clientY) // } - @action - onDividerPointerOver = (e: React.PointerEvent, index: number) => { - if (DragManager.docsBeingDragged.length == 0) { - //convert client X to how we're doing stuff - const xPos = e.clientX + 2 * this.xMargin - // get difference (-25 is because that's the center of the divider) - const xDividerPos = this.columnStartXCoords[index + 1] - 25 - const diff = xDividerPos - xPos - // make a copy of the array - const colXCoords : number[] = [] - this.columnStartXCoords.forEach(val => colXCoords.push(val)) - colXCoords[index + 1] -= diff - this.columnStartXCoords = colXCoords - } + // @action + // onDividerPointerOver = (e: React.PointerEvent, index: number) => { + // if (DragManager.docsBeingDragged.length == 0) { + // //convert client X to how we're doing stuff + // const xPos = e.clientX + 2 * this.xMargin + // // get difference (-25 is because that's the center of the divider) + // const xDividerPos = this.columnStartXCoords[index + 1] - 25 + // const diff = xDividerPos - xPos + // // make a copy of the array + // const colXCoords : number[] = [] + // this.columnStartXCoords.forEach(val => colXCoords.push(val)) + // colXCoords[index + 1] -= diff + // this.columnStartXCoords = colXCoords + // } + // } + + setColumnStartXCoords = (newCoords: number[]) => { + this.columnStartXCoords = newCoords + console.log(this.columnStartXCoords) } // @@ -674,6 +682,7 @@ export class CollectionNoteTakingView extends CollectionSubView<Partial<collecti <CollectionNoteTakingViewDivider index={i} columnStartXCoords={this.columnStartXCoords} + setColumnStartXCoords={this.setColumnStartXCoords} xMargin={this.xMargin} /> ) @@ -757,7 +766,8 @@ export class CollectionNoteTakingView extends CollectionSubView<Partial<collecti onPointerDown={this.onPointerDown} onDrop={this.onExternalDrop.bind(this)} onContextMenu={this.onContextMenu} - onWheel={e => this.props.isContentActive(true) && e.stopPropagation()} > + onWheel={e => this.props.isContentActive(true) && e.stopPropagation()} + > {this.renderedSections} </div> </> diff --git a/src/client/views/collections/CollectionNoteTakingViewDivider.tsx b/src/client/views/collections/CollectionNoteTakingViewDivider.tsx index 9b4af16ce..3655c3f38 100644 --- a/src/client/views/collections/CollectionNoteTakingViewDivider.tsx +++ b/src/client/views/collections/CollectionNoteTakingViewDivider.tsx @@ -5,6 +5,7 @@ interface DividerProps { index: number columnStartXCoords: number[] xMargin: number + setColumnStartXCoords: (newCoords: number[]) => void } export default class Divider extends React.Component<DividerProps>{ @@ -39,10 +40,11 @@ export default class Divider extends React.Component<DividerProps>{ // const xDividerPos = this.props.columnStartXCoords[this.props.index + 1] - 25 // const diff = xDividerPos - xPos // // make a copy of the array - // const colXCoords : number[] = [] - // this.props.columnStartXCoords.forEach(val => colXCoords.push(val)) - this.props.columnStartXCoords[this.props.index + 1] += movementX - console.log(this.props.columnStartXCoords) + const colXCoords : number[] = [] + this.props.columnStartXCoords.forEach(val => colXCoords.push(val)) + colXCoords[this.props.index + 1] += movementX + this.props.setColumnStartXCoords(colXCoords) + // console.log(this.props.columnStartXCoords) // this.props.columnStartXCoords = colXCoords // } } |