fix: round volume values properly
This commit is contained in:
parent
e6d2e891d7
commit
30c2c51828
1 changed files with 2 additions and 10 deletions
|
@ -35,16 +35,8 @@ const SpeakerIndicator = params => Icon({
|
||||||
const SpeakerPercentLabel = params => Label({
|
const SpeakerPercentLabel = params => Label({
|
||||||
...params,
|
...params,
|
||||||
connections: [[Audio, label => {
|
connections: [[Audio, label => {
|
||||||
if (!Audio.speaker)
|
if (Audio.speaker) {
|
||||||
return;
|
label.label = Math.round(Audio.speaker.volume * 100) + '%';
|
||||||
|
|
||||||
let vol = Math.floor(Audio.speaker.volume * 100);
|
|
||||||
|
|
||||||
if (vol == 0) {
|
|
||||||
label.label = vol + '%';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
label.label = vol + 1 + '%';
|
|
||||||
}
|
}
|
||||||
}, 'speaker-changed']],
|
}, 'speaker-changed']],
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue