diff --git a/js/actionCreators.js b/js/actionCreators.js index 25349f57..606a791d 100644 --- a/js/actionCreators.js +++ b/js/actionCreators.js @@ -468,11 +468,15 @@ export function scrollNTracks(n) { }; } -export function scrollPlaylistByDelta(delta) { +export function scrollPlaylistByDelta(e) { + e.preventDefault(); return (dispatch, getState) => { const state = getState(); + if (getOverflowTrackCount(state)) { + e.stopPropagation(); + } const totalPixelHeight = state.playlist.trackOrder.length * TRACK_HEIGHT; - const percentDelta = delta / totalPixelHeight * 100; + const percentDelta = e.deltaY / totalPixelHeight * 100; dispatch({ type: SET_PLAYLIST_SCROLL_POSITION, position: clamp( diff --git a/js/components/PlaylistWindow/TrackList.js b/js/components/PlaylistWindow/TrackList.js index ec3a47bc..25051058 100644 --- a/js/components/PlaylistWindow/TrackList.js +++ b/js/components/PlaylistWindow/TrackList.js @@ -13,7 +13,6 @@ class TrackList extends React.Component { constructor(props) { super(props); this._handleMoveClick = this._handleMoveClick.bind(this); - this._handleWeel = this._handleWeel.bind(this); } _renderTracks(format) { @@ -29,12 +28,6 @@ class TrackList extends React.Component { )); } - _handleWeel(e) { - this.props.scrollPlaylistByDelta(e.deltaY); - e.preventDefault(); - e.stopPropagation(); - } - _handleMoveClick(e) { if (!this._node) { return; @@ -72,7 +65,7 @@ class TrackList extends React.Component { className="playlist-tracks" style={{ height: "100%" }} onClick={this.props.selectZero} - onWheel={this._handleWeel} + onWheel={this.props.scrollPlaylistByDelta} >