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

Function updateDragging

packages/react-stately/src/slider/useSliderState.ts:309–325  ·  view source on GitHub ↗
(index: number, dragging: boolean)

Source from the content-addressed store, hash-verified

307 }
308
309 function updateDragging(index: number, dragging: boolean) {
310 if (isDisabled || !isThumbEditable(index)) {
311 return;
312 }
313 if (dragging) {
314 valuesRef.current = values;
315 }
316
317 const wasDragging = isDraggingsRef.current[index];
318 isDraggingsRef.current = replaceIndex(isDraggingsRef.current, index, dragging);
319 setDraggings(isDraggingsRef.current);
320
321 // Call onChangeEnd if no handles are dragging.
322 if (onChangeEnd && wasDragging && !isDraggingsRef.current.some(Boolean)) {
323 onChangeEnd(valuesRef.current);
324 }
325 }
326
327 let listFormatRef = useRef<Intl.ListFormat | null>(null);
328

Callers

nothing calls this directly

Calls 4

isThumbEditableFunction · 0.85
replaceIndexFunction · 0.85
setDraggingsFunction · 0.85
onChangeEndFunction · 0.50

Tested by

no test coverage detected