aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/views/collections/CollectionNoteTakingView.tsx40
-rw-r--r--src/client/views/collections/CollectionNoteTakingViewDivider.tsx10
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
// }
}