Skip to content

spatial-monorepo


spatial-monorepo / core/src / clampWallHeight

Function: clampWallHeight()

clampWallHeight(h, fallback): number

Defined in: packages/core/src/layers/wall-paint.ts:55

Clamps a height-like value (wall_height or base_height) to [WALL_HEIGHT_MIN, WALL_HEIGHT_MAX], falling back to fallback when h isn't a finite number. Callers MUST pass the fallback appropriate to the property being clamped (DEFAULT_WALL_HEIGHT for wall_height, DEFAULT_BASE_HEIGHT for base_height) — a single shared fallback for both properties was the bug this replaces (a missing base_height used to fall back to DEFAULT_WALL_HEIGHT, i.e. 3m off the ground, in the editor's buildWallExtrusionFC).

Parameters

h

unknown

fallback

number

Returns

number

Released under commercial licensing.