@ue-too/board / KmtIdleState
Class: KmtIdleState
Defined in: packages/board/src/input-interpretation/input-state-machine/kmt-input-state-machine.ts:227
IDLE state - default state waiting for user input.
Remarks
This is the default state of the KMT input state machine. It handles scroll events for panning and zooming, and transitions to pan-ready states when the user presses spacebar or middle-click.
Responsibilities:
- Process scroll events (pan or zoom depending on device and modifiers)
- Detect spacebar press to enter pan mode
- Detect middle-click to enter pan mode
- Distinguish between mouse and trackpad input modalities
Scroll Behavior:
- Ctrl + Scroll: Always zoom (both mouse and trackpad)
- Scroll (no Ctrl): Pan (trackpad) or Zoom (mouse, determined by modality detection)
Input Modality Detection: The state tracks horizontal scroll deltas to distinguish trackpads (which produce deltaX) from mice (which typically only produce deltaY). This affects zoom behavior.
Extends
TemplateState<KmtInputEventMapping,KmtInputContext,KmtInputStates,KmtInputEventOutputMapping>
Constructors
Constructor
new KmtIdleState():
KmtIdleState
Defined in: packages/board/src/input-interpretation/input-state-machine/kmt-input-state-machine.ts:233
Returns
KmtIdleState
Overrides
TemplateState< KmtInputEventMapping, KmtInputContext, KmtInputStates, KmtInputEventOutputMapping >.constructor
Properties
_defer
protected_defer:Defer<KmtInputContext,KmtInputEventMapping,"IDLE"|"READY_TO_PAN_VIA_SPACEBAR"|"READY_TO_PAN_VIA_SCROLL_WHEEL"|"PAN"|"INITIAL_PAN"|"PAN_VIA_SCROLL_WHEEL"|"DISABLED",KmtInputEventOutputMapping> |undefined
Defined in: packages/being/dist/interface.d.ts:492
Inherited from
TemplateState._defer
_delay
protected_delay:Delay<KmtInputContext,KmtInputEventMapping,"IDLE"|"READY_TO_PAN_VIA_SPACEBAR"|"READY_TO_PAN_VIA_SCROLL_WHEEL"|"PAN"|"INITIAL_PAN"|"PAN_VIA_SCROLL_WHEEL"|"DISABLED",KmtInputEventOutputMapping> |undefined
Defined in: packages/being/dist/interface.d.ts:491
Inherited from
TemplateState._delay
_eventGuards
protected_eventGuards:Partial<EventGuards<KmtInputEventMapping,KmtInputStates,KmtInputContext,Guard<KmtInputContext>>> ={}
Defined in: packages/board/src/input-interpretation/input-state-machine/kmt-input-state-machine.ts:241
Overrides
TemplateState._eventGuards
_eventReactions
protected_eventReactions:EventReactions<KmtInputEventMapping,KmtInputContext,KmtInputStates,KmtInputEventOutputMapping>
Defined in: packages/board/src/input-interpretation/input-state-machine/kmt-input-state-machine.ts:312
Overrides
TemplateState._eventReactions
_guards
protected_guards:Guard<KmtInputContext,"isIdle">
Defined in: packages/board/src/input-interpretation/input-state-machine/kmt-input-state-machine.ts:237
Overrides
TemplateState._guards
Accessors
delay
Get Signature
get delay():
Delay<Context,EventPayloadMapping,States,EventOutputMapping> |undefined
Defined in: packages/being/dist/interface.d.ts:497
Returns
Delay<Context, EventPayloadMapping, States, EventOutputMapping> | undefined
Inherited from
TemplateState.delay
eventGuards
Get Signature
get eventGuards():
Partial<EventGuards<EventPayloadMapping,States,Context,Guard<Context>>>
Defined in: packages/being/dist/interface.d.ts:495
Returns
Partial<EventGuards<EventPayloadMapping, States, Context, Guard<Context>>>
Inherited from
TemplateState.eventGuards
eventReactions
Get Signature
get eventReactions():
EventReactions<EventPayloadMapping,Context,States,EventOutputMapping>
Defined in: packages/being/dist/interface.d.ts:496
Returns
EventReactions<EventPayloadMapping, Context, States, EventOutputMapping>
Inherited from
TemplateState.eventReactions
guards
Get Signature
get guards():
Guard<Context>
Defined in: packages/being/dist/interface.d.ts:494
Returns
Guard<Context>
Inherited from
TemplateState.guards
handlingEvents
Get Signature
get handlingEvents(): keyof
EventPayloadMapping[]
Defined in: packages/being/dist/interface.d.ts:493
Returns
keyof EventPayloadMapping[]
Inherited from
TemplateState.handlingEvents
Methods
beforeExit()
beforeExit(
context,stateMachine,to):void
Defined in: packages/being/dist/interface.d.ts:499
Parameters
context
stateMachine
StateMachine<KmtInputEventMapping, KmtInputContext, "IDLE" | "READY_TO_PAN_VIA_SPACEBAR" | "READY_TO_PAN_VIA_SCROLL_WHEEL" | "PAN" | "INITIAL_PAN" | "PAN_VIA_SCROLL_WHEEL" | "DISABLED", KmtInputEventOutputMapping>
to
"TERMINAL" | "IDLE" | "READY_TO_PAN_VIA_SPACEBAR" | "READY_TO_PAN_VIA_SCROLL_WHEEL" | "PAN" | "INITIAL_PAN" | "PAN_VIA_SCROLL_WHEEL" | "DISABLED"
Returns
void
Inherited from
TemplateState.beforeExit
handles()
handles<
K>(args,context,stateMachine):EventResult<"IDLE"|"READY_TO_PAN_VIA_SPACEBAR"|"READY_TO_PAN_VIA_SCROLL_WHEEL"|"PAN"|"INITIAL_PAN"|"PAN_VIA_SCROLL_WHEEL"|"DISABLED",Kextends keyofKmtInputEventOutputMapping?KmtInputEventOutputMapping[K<K>] :void>
Defined in: packages/being/dist/interface.d.ts:500
Type Parameters
K
K extends string
Parameters
args
EventArgs<KmtInputEventMapping, K>
context
stateMachine
StateMachine<KmtInputEventMapping, KmtInputContext, "IDLE" | "READY_TO_PAN_VIA_SPACEBAR" | "READY_TO_PAN_VIA_SCROLL_WHEEL" | "PAN" | "INITIAL_PAN" | "PAN_VIA_SCROLL_WHEEL" | "DISABLED", KmtInputEventOutputMapping>
Returns
EventResult<"IDLE" | "READY_TO_PAN_VIA_SPACEBAR" | "READY_TO_PAN_VIA_SCROLL_WHEEL" | "PAN" | "INITIAL_PAN" | "PAN_VIA_SCROLL_WHEEL" | "DISABLED", K extends keyof KmtInputEventOutputMapping ? KmtInputEventOutputMapping[K<K>] : void>
Inherited from
TemplateState.handles
middlePointerDownHandler()
middlePointerDownHandler(
context,payload):void
Defined in: packages/board/src/input-interpretation/input-state-machine/kmt-input-state-machine.ts:352
Parameters
context
payload
Returns
void
scrollHandler()
scrollHandler(
context,payload):KmtOutputEvent
Defined in: packages/board/src/input-interpretation/input-state-machine/kmt-input-state-machine.ts:289
Parameters
context
payload
Returns
scrollPan()
scrollPan(
context,payload):KmtOutputEvent
Defined in: packages/board/src/input-interpretation/input-state-machine/kmt-input-state-machine.ts:251
Parameters
context
payload
Returns
scrollWithCtrlHandler()
scrollWithCtrlHandler(
context,payload):KmtOutputEvent
Defined in: packages/board/src/input-interpretation/input-state-machine/kmt-input-state-machine.ts:305
Parameters
context
payload
Returns
scrollZoom()
scrollZoom(
context,payload):KmtOutputEvent
Defined in: packages/board/src/input-interpretation/input-state-machine/kmt-input-state-machine.ts:265
Parameters
context
payload
Returns
spacebarDownHandler()
spacebarDownHandler(
context,payload):number
Defined in: packages/board/src/input-interpretation/input-state-machine/kmt-input-state-machine.ts:344
Parameters
context
payload
EmptyPayload
Returns
number
uponEnter()
uponEnter(
context):void
Defined in: packages/board/src/input-interpretation/input-state-machine/kmt-input-state-machine.ts:340
Parameters
context
Returns
void
Overrides
TemplateState.uponEnter