mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-20 16:49:52 +00:00
Scroll volume if there are no tracks to scroll
This commit is contained in:
parent
3b9fdb30e5
commit
7bcdcdebde
2 changed files with 7 additions and 10 deletions
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
>
|
||||
<div className="playlist-track-numbers">
|
||||
{this._renderTracks((id, i) => `${i + 1 + offset}.`)}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue