From 6b84c1e84fe938118f77e90e1918e418b3d9419a Mon Sep 17 00:00:00 2001 From: Guillaume Piolat Date: Thu, 23 Nov 2023 11:38:12 +0100 Subject: [PATCH] Related to Issue #813: fix behaviour of UIImageSwitch in case of touch automation: the value will return to original AFTER the mouse is released. The general rule seems to be that endParamEdit should be called in onStopDrag. --- flatwidgets/dplug/flatwidgets/flatswitch.d | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/flatwidgets/dplug/flatwidgets/flatswitch.d b/flatwidgets/dplug/flatwidgets/flatswitch.d index 0d86d9f3..7306f9f6 100644 --- a/flatwidgets/dplug/flatwidgets/flatswitch.d +++ b/flatwidgets/dplug/flatwidgets/flatswitch.d @@ -101,7 +101,6 @@ nothrow: { _param.beginParamEdit(); _param.setFromGUI(_param.defaultValue()); - _param.endParamEdit(); } else { @@ -109,7 +108,6 @@ nothrow: // Note: double-click doesn't reset to default, would be annoying _param.beginParamEdit(); _param.setFromGUI(!_param.value()); - _param.endParamEdit(); } return Click.startDrag; } @@ -136,6 +134,10 @@ nothrow: override void onStopDrag() { + // End parameter edit at end of dragging, even if no parameter change happen, + // so that touch automation restore previous parameter value at the end of the mouse + // gesture. + _param.endParamEdit(); } override void onMouseDrag(int x, int y, int dx, int dy, MouseState mstate)