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

Function getNoteDimensions

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

* Resolves the on-canvas dimensions of a note block. * Notes are fixed-width and use a deterministic height, but fall back to any * stored measurement or data override when present.

(block: BlockState)

Source from the content-addressed store, hash-verified

321 * stored measurement or data override when present.
322 */
323function getNoteDimensions(block: BlockState): { width: number; height: number } {
324 const width = Math.max(
325 resolveNumeric(block.data?.width, 0),
326 block.layout?.measuredWidth ?? 0,
327 BLOCK_DIMENSIONS.FIXED_WIDTH
328 )
329
330 const defaultHeight =
331 BLOCK_DIMENSIONS.HEADER_HEIGHT +
332 BLOCK_DIMENSIONS.NOTE_CONTENT_PADDING +
333 BLOCK_DIMENSIONS.NOTE_BASE_CONTENT_HEIGHT
334
335 const height = Math.max(
336 resolveNumeric(block.data?.height, 0),
337 block.layout?.measuredHeight ?? 0,
338 block.height ?? 0,
339 defaultHeight
340 )
341
342 return { width, height }
343}
344
345/**
346 * Checks if a block has a valid, finite position.

Callers 2

resolveNoteOverlapsFunction · 0.85

Calls 1

resolveNumericFunction · 0.85

Tested by

no test coverage detected