Skip to content

@ue-too/board / index / KmtIdleState

Class: KmtIdleState ​

Defined in: packages/board/src/input-interpretation/input-state-machine/kmt-input-state-machine.ts:236

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 ​

Constructors ​

Constructor ​

new KmtIdleState(): KmtIdleState

Defined in: packages/board/src/input-interpretation/input-state-machine/kmt-input-state-machine.ts:242

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:581

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:580

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:250

Overrides ​

TemplateState._eventGuards


_eventPreconditions ​

protected _eventPreconditions: Partial<EventPreconditions<EventPayloadMapping, Context, Guard<Context>>>

Defined in: packages/being/dist/interface.d.ts:579

Inherited from ​

TemplateState._eventPreconditions


_eventReactions ​

protected _eventReactions: EventReactions<KmtInputEventMapping, KmtInputContext, KmtInputStates, KmtInputEventOutputMapping>

Defined in: packages/board/src/input-interpretation/input-state-machine/kmt-input-state-machine.ts:321

Overrides ​

TemplateState._eventReactions


_guards ​

protected _guards: Guard<KmtInputContext, "isIdle">

Defined in: packages/board/src/input-interpretation/input-state-machine/kmt-input-state-machine.ts:246

Overrides ​

TemplateState._guards

Accessors ​

delay ​

Get Signature ​

get delay(): Delay<Context, EventPayloadMapping, States, EventOutputMapping> | undefined

Defined in: packages/being/dist/interface.d.ts:587

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:584

Returns ​

Partial<EventGuards<EventPayloadMapping, States, Context, Guard<Context>>>

Inherited from ​

TemplateState.eventGuards


eventPreconditions ​

Get Signature ​

get eventPreconditions(): Partial<EventPreconditions<EventPayloadMapping, Context, Guard<Context>>>

Defined in: packages/being/dist/interface.d.ts:585

Pre-action vetoes: named guards that must all pass before this state handles an event. Optional so existing State implementations remain valid; TemplateState always provides it.

Returns ​

Partial<EventPreconditions<EventPayloadMapping, Context, Guard<Context>>>

Inherited from ​

TemplateState.eventPreconditions


eventReactions ​

Get Signature ​

get eventReactions(): EventReactions<EventPayloadMapping, Context, States, EventOutputMapping>

Defined in: packages/being/dist/interface.d.ts:586

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:583

Returns ​

Guard<Context>

Inherited from ​

TemplateState.guards


handlingEvents ​

Get Signature ​

get handlingEvents(): keyof EventPayloadMapping[]

Defined in: packages/being/dist/interface.d.ts:582

Returns ​

keyof EventPayloadMapping[]

Inherited from ​

TemplateState.handlingEvents

Methods ​

beforeExit() ​

beforeExit(context, stateMachine, to): void

Defined in: packages/being/dist/interface.d.ts:589

Parameters ​

context ​

KmtInputContext

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", K extends keyof KmtInputEventOutputMapping ? KmtInputEventOutputMapping[K<K>] : void>

Defined in: packages/being/dist/interface.d.ts:590

Type Parameters ​

K ​

K extends string

Parameters ​

args ​

EventArgs<KmtInputEventMapping, K>

context ​

KmtInputContext

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:361

Parameters ​

context ​

KmtInputContext

payload ​

PointerEventPayload

Returns ​

void


scrollHandler() ​

scrollHandler(context, payload): KmtOutputEvent

Defined in: packages/board/src/input-interpretation/input-state-machine/kmt-input-state-machine.ts:298

Parameters ​

context ​

KmtInputContext

payload ​

ScrollWithCtrlEventPayload

Returns ​

KmtOutputEvent


scrollPan() ​

scrollPan(context, payload): KmtOutputEvent

Defined in: packages/board/src/input-interpretation/input-state-machine/kmt-input-state-machine.ts:260

Parameters ​

context ​

KmtInputContext

payload ​

ScrollEventPayload

Returns ​

KmtOutputEvent


scrollWithCtrlHandler() ​

scrollWithCtrlHandler(context, payload): KmtOutputEvent

Defined in: packages/board/src/input-interpretation/input-state-machine/kmt-input-state-machine.ts:314

Parameters ​

context ​

KmtInputContext

payload ​

ScrollWithCtrlEventPayload

Returns ​

KmtOutputEvent


scrollZoom() ​

scrollZoom(context, payload): KmtOutputEvent

Defined in: packages/board/src/input-interpretation/input-state-machine/kmt-input-state-machine.ts:274

Parameters ​

context ​

KmtInputContext

payload ​

ScrollWithCtrlEventPayload

Returns ​

KmtOutputEvent


spacebarDownHandler() ​

spacebarDownHandler(context, payload): number

Defined in: packages/board/src/input-interpretation/input-state-machine/kmt-input-state-machine.ts:353

Parameters ​

context ​

KmtInputContext

payload ​

EmptyPayload

Returns ​

number


uponEnter() ​

uponEnter(context): void

Defined in: packages/board/src/input-interpretation/input-state-machine/kmt-input-state-machine.ts:349

Parameters ​

context ​

KmtInputContext

Returns ​

void

Overrides ​

TemplateState.uponEnter