Skip to content

@ue-too/board / translationWidthOf

Function: translationWidthOf()

translationWidthOf(boundaries): number | undefined

Defined in: packages/board/src/camera/utils/position.ts:300

Calculates the width (x-axis span) of the boundaries.

Parameters

boundaries

The boundaries to measure

Boundaries | undefined

Returns

number | undefined

Width in world units, or undefined if x boundaries are not fully defined

Remarks

Returns undefined if boundaries don't have both min.x and max.x defined. Result is always non-negative for valid boundaries (max.x - min.x).

Example

typescript
translationWidthOf({
  min: { x: -100, y: -50 },
  max: { x: 100, y: 50 }
}); // 200

translationWidthOf({ min: { x: 0 } }); // undefined (no max.x)
translationWidthOf(undefined);          // undefined