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
This commit is contained in:
Elliot 2022-08-19 10:19:22 -04:00 committed by GitHub
parent a871aa628f
commit 898c3b7a48
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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,
})