MCPcopy
hub / github.com/react-component/slider / offsetChangedValue

Function offsetChangedValue

src/hooks/useOffset.ts:174–186  ·  view source on GitHub ↗
(
    values: number[],
    offset: number,
    valueIndex: number,
    mode: OffsetMode = 'unit',
  )

Source from the content-addressed store, hash-verified

172
173 /** Same as `offsetValue` but return `changed` mark to tell value changed */
174 const offsetChangedValue = (
175 values: number[],
176 offset: number,
177 valueIndex: number,
178 mode: OffsetMode = 'unit',
179 ) => {
180 const originValue = values[valueIndex];
181 const nextValue = offsetValue(values, offset, valueIndex, mode);
182 return {
183 value: nextValue,
184 changed: nextValue !== originValue,
185 };
186 };
187
188 const needPush = (dist: number) => {
189 return (pushable === null && dist === 0) || (typeof pushable === 'number' && dist < pushable);

Callers 1

offsetValuesFunction · 0.85

Calls 1

offsetValueFunction · 0.85

Tested by

no test coverage detected