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:
parent
a871aa628f
commit
898c3b7a48
1 changed files with 4 additions and 3 deletions
|
@ -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,
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in a new issue