Don't change a parmeter if it wouldn't do anything
This commit is contained in:
parent
cd683187e0
commit
fe3ea5d9f8
1 changed files with 8 additions and 6 deletions
|
@ -29,12 +29,14 @@ impl<'a, P: Param> ParamSlider<'a, P> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_normalized_value(&self, normalized: f32) {
|
fn set_normalized_value(&self, normalized: f32) {
|
||||||
// This snaps to the nearest plain value if the parameter is stepped in some wayA
|
if normalized != self.normalized_value() {
|
||||||
// TODO: As an optimization, we could add a `const CONTINUOUS: bool` to the parameter to
|
// This snaps to the nearest plain value if the parameter is stepped in some wayA
|
||||||
// avoid this normalized->plain->normalized conversion for parameters that don't need
|
// TODO: As an optimization, we could add a `const CONTINUOUS: bool` to the parameter to
|
||||||
// it
|
// avoid this normalized->plain->normalized conversion for parameters that don't need
|
||||||
let value = self.param.preview_plain(normalized);
|
// it
|
||||||
self.setter.set_parameter(self.param, value);
|
let value = self.param.preview_plain(normalized);
|
||||||
|
self.setter.set_parameter(self.param, value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// This still needs to be part of a drag gestur
|
// This still needs to be part of a drag gestur
|
||||||
|
|
Loading…
Add table
Reference in a new issue