Fix the sliders.

fixes #590
This commit is contained in:
IntegratedQuantum 2024-07-27 16:01:47 +02:00
parent 6dc106fb9f
commit 76476faa84
2 changed files with 2 additions and 2 deletions

View File

@ -83,7 +83,7 @@ pub fn toComponent(self: *ContinuousSlider) GuiComponent {
fn setButtonPosFromValue(self: *ContinuousSlider) void { fn setButtonPosFromValue(self: *ContinuousSlider) void {
const range: f32 = self.size[0] - 3*border - self.button.size[0]; const range: f32 = self.size[0] - 3*border - self.button.size[0];
const len: f32 = self.maxValue - self.minValue; const len: f32 = self.maxValue - self.minValue;
self.button.pos[0] = 1.5*border + range*(0.5 + (self.currentValue - self.minValue))/len; self.button.pos[0] = 1.5*border + range*(self.currentValue - self.minValue)/len;
self.updateLabel(self.currentValue, self.size[0]); self.updateLabel(self.currentValue, self.size[0]);
} }

View File

@ -29,7 +29,7 @@ fn deziBelToLinear(x: f32) f32 {
fn linearToDezibel(x: f32) f32 { fn linearToDezibel(x: f32) f32 {
const db = 20*std.math.log10(x); const db = 20*std.math.log10(x);
if(db < -59.95) return -60; if(db < -59.95) return -60;
return 0; return db;
} }
fn musicFormatter(allocator: NeverFailingAllocator, value: f32) []const u8 { fn musicFormatter(allocator: NeverFailingAllocator, value: f32) []const u8 {