From 898c3b7a48cbc94e60226a51a586a076937325d3 Mon Sep 17 00:00:00 2001 From: Elliot Date: Fri, 19 Aug 2022 10:19:22 -0400 Subject: [PATCH] Add alt key precision nudging to number input (#282) * Add alt key precision nudging to number input * Change shift + scrub scrub modifier to 1/10 --- theatre/studio/src/uiComponents/form/BasicNumberInput.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/theatre/studio/src/uiComponents/form/BasicNumberInput.tsx b/theatre/studio/src/uiComponents/form/BasicNumberInput.tsx index 70feb91..a814463 100644 --- a/theatre/studio/src/uiComponents/form/BasicNumberInput.tsx +++ b/theatre/studio/src/uiComponents/form/BasicNumberInput.tsx @@ -233,12 +233,13 @@ const BasicNumberInput: React.FC<{ return { // note: we use mx because we need to constrain the `valueDuringDragging` // and dx will keep accumulating past any constraints - onDrag(_dx: number, _dy: number, _e: MouseEvent, mx: number) { + onDrag(_dx: number, _dy: number, e: MouseEvent, mx: number) { + const deltaX = e.altKey ? mx / 10 : mx const newValue = valueDuringDragging + propsA.nudge({ - deltaX: mx, - deltaFraction: mx / inputWidth, + deltaX, + deltaFraction: deltaX / inputWidth, magnitude: 1, })