X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=_UIFramework.pde;h=3ca493b1658d365258104bc62381f826a35d8042;hb=34327c962351112e07c3d93f56ffc543fac45b58;hp=ba5a8c8e2b8ac1cd1a10b6887fb5b24fdd2befd6;hpb=a898d79bac007404bed34365f31ffbc6480c901c;p=SugarCubes.git diff --git a/_UIFramework.pde b/_UIFramework.pde index ba5a8c8..3ca493b 100644 --- a/_UIFramework.pde +++ b/_UIFramework.pde @@ -602,11 +602,28 @@ public class UIParameterSlider extends UIParameterControl { } private boolean editing = false; + private long lastClick = 0; + private float doubleClickMode = 0; + private float doubleClickX = 0; protected void onMousePressed(float mx, float my) { + long now = millis(); float handleLeft = 4 + parameter.getValuef() * (w-8-handleWidth); if (mx >= handleLeft && mx < handleLeft + handleWidth) { editing = true; + } else { + if ((now - lastClick) < 300 && abs(mx - doubleClickX) < 3) { + parameter.setValue(doubleClickMode); + } + doubleClickX = mx; + if (mx < w*.25) { + doubleClickMode = 0; + } else if (mx > w*.75) { + doubleClickMode = 1; + } else { + doubleClickMode = 0.5; + } } + lastClick = now; } protected void onMouseReleased(float mx, float my) {