MCPcopy Index your code
hub / github.com/simstudioai/sim / getContainerMetrics

Function getContainerMetrics

apps/sim/lib/workflows/autolayout/utils.ts:122–145  ·  view source on GitHub ↗

* Gets metrics for a container block

(block: BlockState)

Source from the content-addressed store, hash-verified

120 * Gets metrics for a container block
121 */
122function getContainerMetrics(block: BlockState): BlockMetrics {
123 const measuredWidth = block.layout?.measuredWidth
124 const measuredHeight = block.layout?.measuredHeight
125
126 const containerWidth = Math.max(
127 measuredWidth ?? 0,
128 resolveNumeric(block.data?.width, CONTAINER_DIMENSIONS.DEFAULT_WIDTH)
129 )
130 const containerHeight = Math.max(
131 measuredHeight ?? 0,
132 resolveNumeric(block.data?.height, CONTAINER_DIMENSIONS.DEFAULT_HEIGHT)
133 )
134
135 return {
136 width: containerWidth,
137 height: containerHeight,
138 minWidth: CONTAINER_DIMENSIONS.DEFAULT_WIDTH,
139 minHeight: CONTAINER_DIMENSIONS.DEFAULT_HEIGHT,
140 paddingTop: BLOCK_DIMENSIONS.HEADER_HEIGHT,
141 paddingBottom: BLOCK_DIMENSIONS.HEADER_HEIGHT,
142 paddingLeft: BLOCK_DIMENSIONS.HEADER_HEIGHT,
143 paddingRight: BLOCK_DIMENSIONS.HEADER_HEIGHT,
144 }
145}
146
147/**
148 * Counts visible preview subblocks using the same visibility rules as the

Callers 1

getBlockMetricsFunction · 0.85

Calls 1

resolveNumericFunction · 0.85

Tested by

no test coverage detected