spatial-monorepo / core/src / FloorSwitcherState
Class: FloorSwitcherState
Defined in: packages/core/src/FloorSwitcher/FloorSwitcherState.ts:9
Constructors
Constructor
new FloorSwitcherState(
floors,initialOrdinal?):FloorSwitcherState
Defined in: packages/core/src/FloorSwitcher/FloorSwitcherState.ts:13
Parameters
floors
initialOrdinal?
number
Returns
FloorSwitcherState
Methods
getActiveOrdinal()
getActiveOrdinal():
number
Defined in: packages/core/src/FloorSwitcher/FloorSwitcherState.ts:19
Returns
number
getFloors()
getFloors():
LevelFeature[]
Defined in: packages/core/src/FloorSwitcher/FloorSwitcherState.ts:80
Returns floors sorted by ordinal ascending
Returns
goDown()
goDown():
number
Defined in: packages/core/src/FloorSwitcher/FloorSwitcherState.ts:64
Step to the next existing floor below the current one (by array position, not naive ordinal - 1). Mirrors goUp(). No-op at the bottom.
Returns
number
goUp()
goUp():
number
Defined in: packages/core/src/FloorSwitcher/FloorSwitcherState.ts:45
Step to the next existing floor above the current one (by array position, not naive ordinal + 1). IMDF level ordinals are arbitrary integers and gaps are allowed (e.g. a skipped mezzanine), so stepping by +1 can land on an ordinal with no matching floor. No-op at the top.
Returns
number
setCurrentByOrdinal()
setCurrentByOrdinal(
ordinal):boolean
Defined in: packages/core/src/FloorSwitcher/FloorSwitcherState.ts:35
Jump to a floor by its ordinal index. Used by keyboard 0-9 shortcuts. Delegates to setFloor; returns false if ordinal not in floors list.
Parameters
ordinal
number
Returns
boolean
setFloor()
setFloor(
ordinal):boolean
Defined in: packages/core/src/FloorSwitcher/FloorSwitcherState.ts:24
Returns false if ordinal is not in the floors list
Parameters
ordinal
number
Returns
boolean
