Skip to content
This repository has been archived by the owner on Jun 26, 2024. It is now read-only.

Commit

Permalink
fix: touchpad horizontal scrolling
Browse files Browse the repository at this point in the history
  • Loading branch information
wwayne committed Jan 16, 2021
1 parent be7b1ec commit 3d83837
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,9 @@ export default class HorizontalScroll extends Component {
onWheel (e) {
const currentTrack = document.getElementById(this.trackId)
if (currentTrack) {
const delta = Math.abs(e.deltaX) > Math.abs(e.deltaY) ? e.deltaX : e.deltaY
const currentTrackLeft = currentTrack.style.left || '0px'
this.updateTrackLeft(parseFloat(currentTrackLeft.replace('px', '')) + e.deltaY)
this.updateTrackLeft(parseFloat(currentTrackLeft.replace('px', '')) + delta * 0.45)
}
}

Expand Down

0 comments on commit 3d83837

Please sign in to comment.