MCPcopy Create free account
hub / github.com/adobe/react-spectrum / updateValue

Function updateValue

packages/react-stately/src/slider/useSliderState.ts:297–308  ·  view source on GitHub ↗
(index: number, value: number)

Source from the content-addressed store, hash-verified

295 }
296
297 function updateValue(index: number, value: number) {
298 if (isDisabled || !isThumbEditable(index)) {
299 return;
300 }
301 const thisMin = getThumbMinValue(index);
302 const thisMax = getThumbMaxValue(index);
303
304 // Round value to multiple of step, clamp value between min and max
305 value = snapValueToStep(value, thisMin, thisMax, step);
306 let newValues = replaceIndex(valuesRef.current, index, value);
307 setValues(newValues);
308 }
309
310 function updateDragging(index: number, dragging: boolean) {
311 if (isDisabled || !isThumbEditable(index)) {

Callers 3

setThumbPercentFunction · 0.85
incrementThumbFunction · 0.85
decrementThumbFunction · 0.85

Calls 6

snapValueToStepFunction · 0.90
isThumbEditableFunction · 0.85
getThumbMinValueFunction · 0.85
getThumbMaxValueFunction · 0.85
replaceIndexFunction · 0.85
setValuesFunction · 0.85

Tested by

no test coverage detected