From e42970c013086bb7330bd4f58bfa27cb4ec652bb Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Fri, 11 Nov 2022 20:31:15 +0100 Subject: [PATCH] Modify Y-parameter before X-parameter So the X-parameter shows up as last touched in the DAW. --- plugins/diopser/src/editor/xy_pad.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/diopser/src/editor/xy_pad.rs b/plugins/diopser/src/editor/xy_pad.rs index 0f26486d..d08e550a 100644 --- a/plugins/diopser/src/editor/xy_pad.rs +++ b/plugins/diopser/src/editor/xy_pad.rs @@ -105,23 +105,25 @@ impl XyPad { /// Should be called at the start of a drag operation. fn begin_set_parameters(&self, cx: &mut EventContext) { - self.x_param_base.begin_set_parameter(cx); + // NOTE: Since the X-parameter is the main parmaeter, we'll always modify this parameter + // last so the host will keep this parameter highlighted self.y_param_base.begin_set_parameter(cx); + self.x_param_base.begin_set_parameter(cx); } /// Resets both parameters. `begin_set_parameters()` needs to be called first. fn reset_parameters(&self, cx: &mut EventContext) { - self.x_param_base - .set_normalized_value(cx, self.x_param_base.default_normalized_value()); self.y_param_base .set_normalized_value(cx, self.y_param_base.default_normalized_value()); + self.x_param_base + .set_normalized_value(cx, self.x_param_base.default_normalized_value()); } /// Set a normalized value for both parameters. `begin_set_parameters()` needs to be called /// first. fn set_normalized_values(&self, cx: &mut EventContext, (x_value, y_value): (f32, f32)) { - self.x_param_base.set_normalized_value(cx, x_value); self.y_param_base.set_normalized_value(cx, y_value); + self.x_param_base.set_normalized_value(cx, x_value); } /// Set a normalized value for both parameters based on mouse coordinates.