Home / Function/ moveStateToRange() — react Function Reference

moveStateToRange() — react Function Reference

Architecture documentation for the moveStateToRange() function in scrollState.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  73b69eb1_1def_ae18_854c_a93b29fe5e7d["moveStateToRange()"]
  d0e34df5_54e0_bd63_7394_3bfe61a4c376["scrollState.js"]
  73b69eb1_1def_ae18_854c_a93b29fe5e7d -->|defined in| d0e34df5_54e0_bd63_7394_3bfe61a4c376
  4ebde1c0_8d0a_f0b3_0dcd_03c2a6a016e2["AutoSizedCanvas()"]
  4ebde1c0_8d0a_f0b3_0dcd_03c2a6a016e2 -->|calls| 73b69eb1_1def_ae18_854c_a93b29fe5e7d
  804cd5a5_47ad_6091_4607_cf33ec051361["zoomToBatch()"]
  804cd5a5_47ad_6091_4607_cf33ec051361 -->|calls| 73b69eb1_1def_ae18_854c_a93b29fe5e7d
  3fecd1d6_3b0e_08d7_18fe_cef444b6228a["zoomToRange()"]
  3fecd1d6_3b0e_08d7_18fe_cef444b6228a -->|calls| 73b69eb1_1def_ae18_854c_a93b29fe5e7d
  e2f6ebe3_ac75_1cab_957c_094eec05800e["clampLength()"]
  73b69eb1_1def_ae18_854c_a93b29fe5e7d -->|calls| e2f6ebe3_ac75_1cab_957c_094eec05800e
  9bc9912f_7f92_4c87_d104_a207cdecc2a5["clampOffset()"]
  73b69eb1_1def_ae18_854c_a93b29fe5e7d -->|calls| 9bc9912f_7f92_4c87_d104_a207cdecc2a5
  style 73b69eb1_1def_ae18_854c_a93b29fe5e7d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-devtools-timeline/src/view-base/utils/scrollState.js lines 158–199

export function moveStateToRange({
  state,
  rangeStart,
  rangeEnd,
  contentLength,

  minContentLength,
  maxContentLength,
  containerLength,
}: {
  state: ScrollState,
  rangeStart: number,
  rangeEnd: number,
  contentLength: number,

  minContentLength: number,
  maxContentLength: number,
  containerLength: number,
}): ScrollState {
  // Length and offset must be computed separately, so that if the length is
  // clamped the offset will still be correct (unless it gets clamped too).

  const lengthClampedState = clampLength({
    state: {
      offset: state.offset,
      length: contentLength * (containerLength / (rangeEnd - rangeStart)),
    },
    minContentLength,
    maxContentLength,
    containerLength,
  });

  const offsetAdjustedState = clampOffset(
    {
      offset: -rangeStart * (lengthClampedState.length / contentLength),
      length: lengthClampedState.length,
    },
    containerLength,
  );

  return offsetAdjustedState;
}

Domain

Subdomains

Frequently Asked Questions

What does moveStateToRange() do?
moveStateToRange() is a function in the react codebase, defined in packages/react-devtools-timeline/src/view-base/utils/scrollState.js.
Where is moveStateToRange() defined?
moveStateToRange() is defined in packages/react-devtools-timeline/src/view-base/utils/scrollState.js at line 158.
What does moveStateToRange() call?
moveStateToRange() calls 2 function(s): clampLength, clampOffset.
What calls moveStateToRange()?
moveStateToRange() is called by 3 function(s): AutoSizedCanvas, zoomToBatch, zoomToRange.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free