From 22b51f50bb431fffb44b2ff470523742fb83a98d Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Thu, 17 Mar 2022 20:28:21 +0100 Subject: [PATCH] Fix iced param slider not snapping to values For discrete parameters. --- nih_plug_iced/src/widgets/param_slider.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nih_plug_iced/src/widgets/param_slider.rs b/nih_plug_iced/src/widgets/param_slider.rs index bf413ac7..20b4cd40 100644 --- a/nih_plug_iced/src/widgets/param_slider.rs +++ b/nih_plug_iced/src/widgets/param_slider.rs @@ -200,9 +200,11 @@ impl<'a, P: Param> ParamSlider<'a, P> { let plain_value = self.param.preview_plain(normalized_value); let current_plain_value = self.param.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( self.param.as_ptr(), - normalized_value, + normalized_plain_value, )); } }