MCPcopy Create free account
hub / github.com/codeaashu/claude-code / calculateLayout

Method calculateLayout

src/native-ts/yoga-layout/index.ts:927–963  ·  view source on GitHub ↗
(
    ownerWidth: number | undefined,
    ownerHeight: number | undefined,
    _direction?: Direction,
  )

Source from the content-addressed store, hash-verified

925 // -- Layout entry point
926
927 calculateLayout(
928 ownerWidth: number | undefined,
929 ownerHeight: number | undefined,
930 _direction?: Direction,
931 ): void {
932 _yogaNodesVisited = 0
933 _yogaMeasureCalls = 0
934 _yogaCacheHits = 0
935 _generation++
936 const w = ownerWidth === undefined ? NaN : ownerWidth
937 const h = ownerHeight === undefined ? NaN : ownerHeight
938 layoutNode(
939 this,
940 w,
941 h,
942 isDefined(w) ? MeasureMode.Exactly : MeasureMode.Undefined,
943 isDefined(h) ? MeasureMode.Exactly : MeasureMode.Undefined,
944 w,
945 h,
946 true,
947 )
948 // Root's own position = margin + position insets (yoga applies position
949 // to the root even without a parent container; this matters for rounding
950 // since the root's abs top/left seeds the pixel-grid walk).
951 const mar = this.layout.margin
952 const posL = resolveValue(
953 resolveEdgeRaw(this.style.position, EDGE_LEFT),
954 isDefined(w) ? w : 0,
955 )
956 const posT = resolveValue(
957 resolveEdgeRaw(this.style.position, EDGE_TOP),
958 isDefined(w) ? w : 0,
959 )
960 this.layout.left = mar[EDGE_LEFT] + (isDefined(posL) ? posL : 0)
961 this.layout.top = mar[EDGE_TOP] + (isDefined(posT) ? posT : 0)
962 roundLayout(this, this.config.pointScaleFactor, 0, 0)
963 }
964}
965
966const DEFAULT_CONFIG = createConfig()

Callers

nothing calls this directly

Calls 5

layoutNodeFunction · 0.85
isDefinedFunction · 0.85
resolveEdgeRawFunction · 0.85
roundLayoutFunction · 0.85
resolveValueFunction · 0.70

Tested by

no test coverage detected