1
0
Fork 0

Fix iced param slider not snapping to values

For discrete parameters.
This commit is contained in:
Robbert van der Helm 2022-03-17 20:28:21 +01:00
parent bbb3f4eb64
commit 22b51f50bb

View file

@ -200,9 +200,11 @@ impl<'a, P: Param> ParamSlider<'a, P> {
let plain_value = self.param.preview_plain(normalized_value); let plain_value = self.param.preview_plain(normalized_value);
let current_plain_value = self.param.plain_value(); let current_plain_value = self.param.plain_value();
if plain_value != current_plain_value { if plain_value != current_plain_value {
// For the aforementioned snapping
let normalized_plain_value = self.param.preview_normalized(plain_value);
shell.publish(ParamMessage::SetParameterNormalized( shell.publish(ParamMessage::SetParameterNormalized(
self.param.as_ptr(), self.param.as_ptr(),
normalized_value, normalized_plain_value,
)); ));
} }
} }