mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-10-21 18:54:01 -04:00
fix(osd): clamp vertical brightness slider (#3067)
* fix(osd): clamp vertical brightness slider * fix(osd): keep brightness slider value in sync
This commit is contained in:
@@ -109,6 +109,7 @@ DankOSD {
|
||||
onSliderValueChanged: newValue => {
|
||||
if (!DisplayService.brightnessAvailable)
|
||||
return;
|
||||
root._displayBrightness = newValue;
|
||||
DisplayService.setBrightness(newValue, DisplayService.lastIpcDevice, true);
|
||||
resetHideTimer();
|
||||
}
|
||||
@@ -257,8 +258,9 @@ DankOSD {
|
||||
if (!DisplayService.brightnessAvailable)
|
||||
return;
|
||||
const ratio = 1.0 - (mouse.y / height);
|
||||
const newValue = Math.round(vertSlider.minimum + ratio * (vertSlider.maximum - vertSlider.minimum));
|
||||
const newValue = Math.max(vertSlider.minimum, Math.min(vertSlider.maximum, Math.round(vertSlider.minimum + ratio * (vertSlider.maximum - vertSlider.minimum))));
|
||||
vertSlider.value = newValue;
|
||||
root._displayBrightness = newValue;
|
||||
DisplayService.setBrightness(newValue, DisplayService.lastIpcDevice, true);
|
||||
resetHideTimer();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user