From a71c320db74ff4b3eb66a4981c035ae423c437ef Mon Sep 17 00:00:00 2001 From: ljungster Date: Thu, 28 Apr 2022 16:18:36 -0400 Subject: best yet? --- .../views/collections/CollectionNoteTakingView.tsx | 10 ++++++---- .../collections/CollectionNoteTakingViewDivider.tsx | 18 ++---------------- 2 files changed, 8 insertions(+), 20 deletions(-) (limited to 'src') 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 { - 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 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{ @@ -33,20 +32,7 @@ export default class Divider extends React.Component{ @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() { -- cgit v1.2.3-70-g09d2