You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Note, that rounding must be applied here either, so raw slider values with lots of decimals will be handled properly.
19
+
* Example: 1250.11011 Hz can be displayed as "1.25 kHz".
20
+
*/
15
21
displayValueFn: (value: number)=>string;
22
+
/**
23
+
* Used to convert the value from the raw manual input to the knob's value.
24
+
* Note, that rounding must be applied here either, so raw slider values with lots of decimals will be handled properly.
25
+
* Example: 0.500001 value should be converted to 50 (%).
26
+
*/
27
+
toManualInputFn: (x: number)=>number;
28
+
/**
29
+
* Opposite of `toManualInputFn`.
30
+
* Example: user enters 50 (%), which is converted to 0.5.
31
+
*/
32
+
fromManualInputFn: (x: number)=>number;
33
+
/**
34
+
* Used for mapping the value to the knob position (number from 0 to 1).
35
+
* This is the place for making the interpolation, if non-linear one is required.
36
+
* Example: logarithmic scale of frequency input, when knob center position 0.5 corresponds to ~ 1 kHz (instead of 10.1 kHz which is the "linear" center of frequency range).
tabIndex={-1}// Making element focusable by mouse / touch (not Tab). Details: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex
79
-
onKeyDown={onKeyDown}
80
-
onPointerDown={(event)=>{
81
-
// Touch devices have a delay before focusing so it won't focus if touch immediately moves away from target (sliding). We want thumb to focus regardless.
82
-
// See, for reference, Radix UI Slider does the same: https://github.com/radix-ui/primitives/blob/eca6babd188df465f64f23f3584738b85dba610e/packages/react/slider/src/Slider.tsx#L442-L445
83
-
event.currentTarget.focus();
84
-
}}
85
-
>
86
-
<labelhtmlFor={id}>{title}</label>
129
+
<divclassName='relative text-xs'>
87
130
<div
88
-
id={id}
131
+
ref={knobContainerRef}
89
132
className={clsx(
90
-
'relative touch-none',// It's recommended to disable "touch-action" for use-gesture: https://use-gesture.netlify.app/docs/extras/#touch-action
tabIndex={-1}// Making element focusable by mouse / touch (not Tab). Details: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex
137
+
onKeyDown={onKeyDown}
138
+
onPointerDown={(event)=>{
139
+
// Touch devices have a delay before focusing so it won't focus if touch immediately moves away from target (sliding). We want thumb to focus regardless.
140
+
// See, for reference, Radix UI Slider does the same: https://github.com/radix-ui/primitives/blob/eca6babd188df465f64f23f3584738b85dba610e/packages/react/slider/src/Slider.tsx#L442-L445
0 commit comments