Home / Function/ clampLength() — react Function Reference

clampLength() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  e2f6ebe3_ac75_1cab_957c_094eec05800e["clampLength()"]
  d0e34df5_54e0_bd63_7394_3bfe61a4c376["scrollState.js"]
  e2f6ebe3_ac75_1cab_957c_094eec05800e -->|defined in| d0e34df5_54e0_bd63_7394_3bfe61a4c376
  f077803e_adfb_e522_43d4_7b720fa272fa["clampState()"]
  f077803e_adfb_e522_43d4_7b720fa272fa -->|calls| e2f6ebe3_ac75_1cab_957c_094eec05800e
  c31f920d_f533_0f23_d62e_7fc940a06959["zoomState()"]
  c31f920d_f533_0f23_d62e_7fc940a06959 -->|calls| e2f6ebe3_ac75_1cab_957c_094eec05800e
  73b69eb1_1def_ae18_854c_a93b29fe5e7d["moveStateToRange()"]
  73b69eb1_1def_ae18_854c_a93b29fe5e7d -->|calls| e2f6ebe3_ac75_1cab_957c_094eec05800e
  602ea433_ce95_7eee_6236_3ffd5c7bd98b["clamp()"]
  e2f6ebe3_ac75_1cab_957c_094eec05800e -->|calls| 602ea433_ce95_7eee_6236_3ffd5c7bd98b
  style e2f6ebe3_ac75_1cab_957c_094eec05800e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-devtools-timeline/src/view-base/utils/scrollState.js lines 33–52

function clampLength({
  state,
  minContentLength,
  maxContentLength,
  containerLength,
}: {
  state: ScrollState,
  minContentLength: number,
  maxContentLength: number,
  containerLength: number,
}): ScrollState {
  return {
    offset: state.offset,
    length: clamp(
      Math.max(minContentLength, containerLength),
      Math.max(containerLength, maxContentLength),
      state.length,
    ),
  };
}

Domain

Subdomains

Calls

Frequently Asked Questions

What does clampLength() do?
clampLength() is a function in the react codebase, defined in packages/react-devtools-timeline/src/view-base/utils/scrollState.js.
Where is clampLength() defined?
clampLength() is defined in packages/react-devtools-timeline/src/view-base/utils/scrollState.js at line 33.
What does clampLength() call?
clampLength() calls 1 function(s): clamp.
What calls clampLength()?
clampLength() is called by 3 function(s): clampState, moveStateToRange, zoomState.

Analyze Your Own Codebase

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

Try Supermodel Free