Skip to content

Commit 6d20a29

Browse files
committed
2 parents b7c5c43 + 1ea2cf6 commit 6d20a29

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

src/lib/scroll/ScrollElement.js

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,6 @@ class ScrollElement extends Component {
2222
}
2323
}
2424

25-
/**
26-
* needed to handle scrolling with trackpad
27-
*/
28-
handleScroll = () => {
29-
const scrollX = this.scrollComponent.scrollLeft
30-
this.props.onScroll(scrollX)
31-
}
32-
3325
refHandler = el => {
3426
this.scrollComponent = el
3527
this.props.scrollRef(el)
@@ -40,13 +32,10 @@ class ScrollElement extends Component {
4032

4133

4234
handleWheel = e => {
43-
const { traditionalZoom } = this.props
44-
45-
35+
e.preventDefault()
4636

4737
// zoom in the time dimension
4838
if (e.ctrlKey || e.metaKey || e.altKey) {
49-
e.preventDefault()
5039
const parentPosition = getParentPosition(e.currentTarget)
5140
const xPosition = e.clientX - parentPosition.x
5241

@@ -55,10 +44,11 @@ class ScrollElement extends Component {
5544
// convert vertical zoom to horiziontal
5645
this.props.onWheelZoom(speed, xPosition, e.deltaY)
5746
} else if (e.shiftKey) {
58-
e.preventDefault()
5947
// shift+scroll event from a touchpad has deltaY property populated; shift+scroll event from a mouse has deltaX
6048
this.props.onScroll(this.scrollComponent.scrollLeft + (e.deltaY || e.deltaX))
6149
// no modifier pressed? we prevented the default event, so scroll or zoom as needed
50+
} else {
51+
this.props.onScroll(this.scrollComponent.scrollLeft + e.deltaX)
6252
}
6353
}
6454

@@ -198,7 +188,6 @@ class ScrollElement extends Component {
198188
onTouchStart={this.handleTouchStart}
199189
onTouchMove={this.handleTouchMove}
200190
onTouchEnd={this.handleTouchEnd}
201-
onScroll={this.handleScroll}
202191
>
203192
{children}
204193
</div>

0 commit comments

Comments
 (0)