From c05bc2158143df565a3ab5210470da1a2975694e Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Fri, 18 Nov 2022 17:53:13 +0100 Subject: [PATCH] Also reset Vizia widgets on right click Because why choose. Right click, Ctrl+click, and double click all do the same thing now. --- nih_plug_vizia/src/widgets/param_slider.rs | 13 ++++++++----- plugins/diopser/src/editor/xy_pad.rs | 13 ++++++++----- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/nih_plug_vizia/src/widgets/param_slider.rs b/nih_plug_vizia/src/widgets/param_slider.rs index b173cc82..c44d756d 100644 --- a/nih_plug_vizia/src/widgets/param_slider.rs +++ b/nih_plug_vizia/src/widgets/param_slider.rs @@ -469,8 +469,8 @@ impl View for ParamSlider { self.text_input_active = true; cx.set_active(true); } else if cx.modifiers.command() { - // Ctrl+Click and double click should reset the parameter instead of initiating - // a drag operation + // Ctrl+Click, double click, and right clicks should reset the parameter instead + // of initiating a drag operation self.param_base.begin_set_parameter(cx); self.param_base .set_normalized_value(cx, self.param_base.default_normalized_value()); @@ -501,9 +501,12 @@ impl View for ParamSlider { meta.consume(); } - WindowEvent::MouseDoubleClick(MouseButton::Left) => { - // Ctrl+Click and double click should reset the parameter instead of initiating - // a drag operation + WindowEvent::MouseDoubleClick(MouseButton::Left) + | WindowEvent::MouseDown(MouseButton::Right) + | WindowEvent::MouseDoubleClick(MouseButton::Right) + | WindowEvent::MouseTripleClick(MouseButton::Right) => { + // Ctrl+Click, double click, and right clicks should reset the parameter instead of + // initiating a drag operation self.param_base.begin_set_parameter(cx); self.param_base .set_normalized_value(cx, self.param_base.default_normalized_value()); diff --git a/plugins/diopser/src/editor/xy_pad.rs b/plugins/diopser/src/editor/xy_pad.rs index b5e1e97d..007ca644 100644 --- a/plugins/diopser/src/editor/xy_pad.rs +++ b/plugins/diopser/src/editor/xy_pad.rs @@ -398,8 +398,8 @@ impl View for XyPad { self.text_input_active = true; cx.set_active(true); } else if cx.modifiers.command() { - // Ctrl+Click and double click should reset the parameter instead of initiating - // a drag operation + // Ctrl+Click, double click, and right clicks should reset the parameter instead + // of initiating a drag operation self.begin_set_parameters(cx); self.reset_parameters(cx); self.end_set_parameters(cx); @@ -432,9 +432,12 @@ impl View for XyPad { meta.consume(); } - WindowEvent::MouseDoubleClick(MouseButton::Left) => { - // Ctrl+Click and double click should reset the parameters instead of initiating a - // drag operation + WindowEvent::MouseDoubleClick(MouseButton::Left) + | WindowEvent::MouseDown(MouseButton::Right) + | WindowEvent::MouseDoubleClick(MouseButton::Right) + | WindowEvent::MouseTripleClick(MouseButton::Right) => { + // Ctrl+Click, double click, and right clicks should reset the parameter instead of + // initiating a drag operation self.begin_set_parameters(cx); self.reset_parameters(cx); self.end_set_parameters(cx);