From c414e0b712af5778f19c707021a8963565bcf387 Mon Sep 17 00:00:00 2001 From: Syl Morrison Date: Fri, 6 Feb 2026 15:28:37 +0000 Subject: [PATCH 1/2] complete-change-gesture --- source/gui/mostlyharmless_WebviewEditor.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/gui/mostlyharmless_WebviewEditor.cpp b/source/gui/mostlyharmless_WebviewEditor.cpp index 9ab65e7..08eaf12 100644 --- a/source/gui/mostlyharmless_WebviewEditor.cpp +++ b/source/gui/mostlyharmless_WebviewEditor.cpp @@ -38,6 +38,13 @@ namespace mostly_harmless::gui { return endParamChangeGestureCallback(args); }; + auto performCompleteParamGestureCallback_ = [this](const choc::value::ValueView& args) -> choc::value::Value { + beginParamChangeGestureCallback(args); + paramChangeGestureCallback(args); + endParamChangeGestureCallback(args); + return {}; + }; + auto cacheCursorDownPositionCallback_ = [this](const choc::value::ValueView& args) -> choc::value::Value { std::uint32_t x, y; cursor::getCursorPosition(&x, &y); @@ -92,6 +99,7 @@ namespace mostly_harmless::gui { }; m_internalWebview->bind("cacheCursorDownPosition", std::move(cacheCursorDownPositionCallback_)); + m_internalWebview->bind("performCompleteParamGesture", std::move(performCompleteParamGestureCallback_)); m_internalWebview->bind("beginParamGesture", std::move(beginParamGestureCallback_)); m_internalWebview->bind("setParamValue", std::move(paramChangeCallback_)); m_internalWebview->bind("endParamGesture", std::move(endParamGestureCallback_)); From 7e688af1c48490a8163f0d9fd8a74eb75567be7a Mon Sep 17 00:00:00 2001 From: Syl Morrison Date: Sun, 22 Mar 2026 13:46:55 +0000 Subject: [PATCH 2/2] Document performCompleteParamGesture --- include/mostly_harmless/gui/mostlyharmless_WebviewEditor.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/mostly_harmless/gui/mostlyharmless_WebviewEditor.h b/include/mostly_harmless/gui/mostlyharmless_WebviewEditor.h index 967c428..1f1cd75 100644 --- a/include/mostly_harmless/gui/mostlyharmless_WebviewEditor.h +++ b/include/mostly_harmless/gui/mostlyharmless_WebviewEditor.h @@ -35,11 +35,12 @@ namespace mostly_harmless::gui { * ``` * * beginParamGesture is expected to be called when a slider first begins being dragged, - * setParamValue while it is being changed, and endParamValue once the user stops dragging. + * setParamValue while it is being changed, and endParamGesture once the user stops dragging. * These functions are bound to internal native functions (which you can override if you like), beginParamChangeGestureCallback(), * paramChangeGestureCallback(), and endParamChangeGestureCallback(). These functions are actually promises, which we don't really leverage here, aside from to report errors in the case of an arg-parsing failure. * The default implementation will attempt to parse the args (and assert fail if it failed), * and then enqueue the param changes to the guiToProcQueue, for the host and audio side to pick up. + * performCompleteParamGesture() is equivalent to calling beginParamGesture(),setParamValue(), and endParamGesture() in one operation - this is useful for buttons, comboboxes etc. * * For what I've been calling "ouroborosing" the cursor position, and generally providing the facilities to hide the cursor, snap back to original mouse down position on a drag etc, we also provide some extra helpers here. * `beginScopedCursorMoveGesture()` caches the mouse down position at the time of calling, and hides the cursor.