mirror of
https://github.com/Dangoware/dango-music-player.git
synced 2025-05-07 10:12:54 -05:00
Implement basic volume scrolling interaction
This commit is contained in:
parent
78413861ec
commit
2714d5f6f9
4 changed files with 35 additions and 20 deletions
5
.gitattributes
vendored
5
.gitattributes
vendored
|
@ -1 +1,6 @@
|
||||||
* text=auto
|
* text=auto
|
||||||
|
* text eol=lf
|
||||||
|
|
||||||
|
*.png binary
|
||||||
|
*.ico binary
|
||||||
|
*.icns binary
|
|
@ -1,6 +1,6 @@
|
||||||
# Dango Music Player
|
# Dango Music Player
|
||||||
|

|
||||||
|
|
||||||

|
|
||||||
### Dango Music Player is an easy to use Music Player for all users to enjoy their music!
|
### Dango Music Player is an easy to use Music Player for all users to enjoy their music!
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
12
src/App.tsx
12
src/App.tsx
|
@ -310,6 +310,16 @@ function PlayBar({ playing, setPlaying }: PlayBarProps) {
|
||||||
invoke('seek', { time: Math.round(val * 1000) }).then()
|
invoke('seek', { time: Math.round(val * 1000) }).then()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const wheelVolume = (event: React.WheelEvent<HTMLDivElement>) => {
|
||||||
|
let x = volumeSlider.value;
|
||||||
|
if (event.deltaY < 0) {
|
||||||
|
volumeSlider.value++;
|
||||||
|
} else {
|
||||||
|
volumeSlider.value--;
|
||||||
|
}
|
||||||
|
invoke('set_volume', { volume: volumeSlider.value }).then(() => {})
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section id="playBar" className="playBar unselectable">
|
<section id="playBar" className="playBar unselectable">
|
||||||
<div className="seekBar" ref={ seekBarRef } onClick={ seek } onDrag={ seek }>
|
<div className="seekBar" ref={ seekBarRef } onClick={ seek } onDrag={ seek }>
|
||||||
|
@ -328,7 +338,7 @@ function PlayBar({ playing, setPlaying }: PlayBarProps) {
|
||||||
<div className="bottomRight">
|
<div className="bottomRight">
|
||||||
<button>🔀</button>
|
<button>🔀</button>
|
||||||
<button>🔁</button>
|
<button>🔁</button>
|
||||||
<input type="range" name="volume" id="volumeSlider" onChange={ (volume) => {
|
<input onWheel={wheelVolume} type="range" name="volume" id="volumeSlider" onChange={ (volume) => {
|
||||||
invoke('set_volume', { volume: volume.target.value }).then(() => {})
|
invoke('set_volume', { volume: volume.target.value }).then(() => {})
|
||||||
}} />
|
}} />
|
||||||
<p id="timeDisplay">
|
<p id="timeDisplay">
|
||||||
|
|
Loading…
Reference in a new issue