-
Notifications
You must be signed in to change notification settings - Fork 213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(Player): change volume with mouse wheel #405
Conversation
const onWheel = ({ deltaY }) => { | ||
if (deltaY > 0) { | ||
if (!subtitlesMenuOpen && !infoMenuOpen && !videosMenuOpen && !speedMenuOpen && !optionsMenuOpen && !statisticsMenuOpen && videoState.volume !== null) { | ||
onVolumeChangeRequested(videoState.volume - 5); | ||
} | ||
} else { | ||
if (!subtitlesMenuOpen && !infoMenuOpen && !videosMenuOpen && !speedMenuOpen && !optionsMenuOpen && !statisticsMenuOpen && videoState.volume !== null) { | ||
onVolumeChangeRequested(videoState.volume + 5); | ||
} | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be simplified to:
const onWheel = ({ deltaY }) => { | |
if (deltaY > 0) { | |
if (!subtitlesMenuOpen && !infoMenuOpen && !videosMenuOpen && !speedMenuOpen && !optionsMenuOpen && !statisticsMenuOpen && videoState.volume !== null) { | |
onVolumeChangeRequested(videoState.volume - 5); | |
} | |
} else { | |
if (!subtitlesMenuOpen && !infoMenuOpen && !videosMenuOpen && !speedMenuOpen && !optionsMenuOpen && !statisticsMenuOpen && videoState.volume !== null) { | |
onVolumeChangeRequested(videoState.volume + 5); | |
} | |
} | |
}; | |
const onWheel = ({ deltaY }) => { | |
if (!subtitlesMenuOpen && !infoMenuOpen && !videosMenuOpen && !speedMenuOpen && !optionsMenuOpen && !statisticsMenuOpen && videoState.volume !== null) { | |
onVolumeChangeRequested(deltaY > 0 ? videoState.volume - 5 : videoState.volume + 5); | |
} | |
}; |
Or even shorter:
// ...
onVolumeChangeRequested(videoState.volume + (deltaY > 0 ? -5 : 5));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like how on most players the wheel can work when you've hovered on the volume control itself but I guess if you add some visual cue that you are changing your volume this is also good.
A visual indicator could be a nice thing to add |
No description provided.