Skip to content

Commit

Permalink
Eslint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
udai1931 committed Nov 11, 2024
1 parent cad1074 commit d9595c0
Showing 1 changed file with 5 additions and 20 deletions.
25 changes: 5 additions & 20 deletions src/ScrollSync.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,13 @@ export default class ScrollSync extends Component {

addEvents = (node) => {
/* For some reason element.addEventListener doesnt work with document.body */
console.log("In add events")
console.log(node)
console.log(this.panes)
let nodeGroups = []
if(this.panes && typeof this.panes === "object"){
Object.keys(this.panes).forEach(pane => {
const nodeGroups = []
if (this.panes && typeof this.panes === 'object') {
Object.keys(this.panes).forEach((pane) => {
if (this.findNode(this.panes[pane], node)) nodeGroups.push(pane)
})
// if (this.findNode(this.panes.vertical, node)) nodeGroups.push("vertical")
// if (this.findNode(this.panes.horizontal, node)) nodeGroups.push("horizontal")
// if (this.findNode(this.panes.default, node)) nodeGroups.push("default")
}
node.onscroll = this.handlePaneScroll.bind(this, node, nodeGroups) // eslint-disable-line
console.log("In add events")
}

removeEvents = (node) => {
Expand All @@ -96,11 +89,11 @@ export default class ScrollSync extends Component {
}

findNode = (pane, node) => {
if (!pane){
if (!pane) {
return false
}

return pane.find(n => n === node)
return pane.find(savedNode => savedNode === node)
}

handlePaneScroll = (node, groups) => {
Expand All @@ -109,8 +102,6 @@ export default class ScrollSync extends Component {
}

window.requestAnimationFrame(() => {
console.log(node)
console.log(groups)
this.syncScrollPositions(node, groups)
})
}
Expand All @@ -130,10 +121,6 @@ export default class ScrollSync extends Component {

const { proportional, vertical, horizontal } = this.props

console.log(proportional)
console.log(vertical)
console.log(horizontal)

/* Calculate the actual pane height */
const paneHeight = pane.scrollHeight - clientHeight
const paneWidth = pane.scrollWidth - clientWidth
Expand All @@ -148,9 +135,7 @@ export default class ScrollSync extends Component {

syncScrollPositions = (scrolledPane, groups) => {
groups.forEach((group) => {
console.log(group)
this.panes[group].forEach((pane) => {
console.log(pane)
/* For all panes beside the currently scrolling one */
if (scrolledPane !== pane) {
/* Remove event listeners from the node that we'll manipulate */
Expand Down

0 comments on commit d9595c0

Please sign in to comment.