diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/collections/CollectionNoteTakingView.tsx | 10 | ||||
-rw-r--r-- | src/client/views/collections/CollectionNoteTakingViewDivider.tsx | 18 |
2 files changed, 8 insertions, 20 deletions
diff --git a/src/client/views/collections/CollectionNoteTakingView.tsx b/src/client/views/collections/CollectionNoteTakingView.tsx index 79e3c5f4b..e7d7c15d2 100644 --- a/src/client/views/collections/CollectionNoteTakingView.tsx +++ b/src/client/views/collections/CollectionNoteTakingView.tsx @@ -648,8 +648,11 @@ export class CollectionNoteTakingView extends CollectionSubView<Partial<collecti // } // } - setColumnStartXCoords = (newCoords: number[]) => { - this.columnStartXCoords = newCoords + @action + setColumnStartXCoords = (movementX: number, colIndex: number) => { + const coords = [...this.columnStartXCoords] + coords[colIndex] += movementX + this.columnStartXCoords = coords console.log(this.columnStartXCoords) } @@ -670,8 +673,7 @@ export class CollectionNoteTakingView extends CollectionSubView<Partial<collecti if (i < sections.length - 1) { eles.push( <CollectionNoteTakingViewDivider - index={i} - columnStartXCoords={this.columnStartXCoords} + index={i + 1} setColumnStartXCoords={this.setColumnStartXCoords.bind(this)} xMargin={this.xMargin} /> diff --git a/src/client/views/collections/CollectionNoteTakingViewDivider.tsx b/src/client/views/collections/CollectionNoteTakingViewDivider.tsx index 731ac556e..ed5dc3715 100644 --- a/src/client/views/collections/CollectionNoteTakingViewDivider.tsx +++ b/src/client/views/collections/CollectionNoteTakingViewDivider.tsx @@ -3,9 +3,8 @@ import * as React from "react"; interface DividerProps { index: number - columnStartXCoords: number[] xMargin: number - setColumnStartXCoords: (newCoords: number[]) => void + setColumnStartXCoords: (movementX: number, colIndex: number) => void } export default class Divider extends React.Component<DividerProps>{ @@ -33,20 +32,7 @@ export default class Divider extends React.Component<DividerProps>{ @action onPointerMove = ({ movementX }: PointerEvent) => { - // if (DragManager.docsBeingDragged.length == 0) { - // //convert client X to how we're doing stuff - // const xPos = e.clientX + 2 * this.props.xMargin - // // get difference (-25 is because that's the center of the divider) - // const xDividerPos = this.props.columnStartXCoords[this.props.index + 1] - 25 - // const diff = xDividerPos - xPos - // // make a copy of the array - // const colXCoords = [...this.props.columnStartXCoords] - // colXCoords[this.props.index + 1] += movementX - this.props.columnStartXCoords[this.props.index + 1] += movementX - // this.props.setColumnStartXCoords(colXCoords) - console.log(this.props.columnStartXCoords) - // this.props.columnStartXCoords = colXCoords - // } + this.props.setColumnStartXCoords(movementX, this.props.index) } render() { |