pivotick - v2.0.1
    Preparing search index...

    Interface ModeStore

    A tiny observable holding the mode-rail state. The rail, contextual tool panel and the settings flyouts subscribe to it; clicks / keybindings dispatch to it. Setters are idempotent — they only notify when the value actually changes — and every notification carries a fresh snapshot so a listener can't mutate the store's internal state.

    The four built-in modes are always present. Modes registered through addRailMode are added with registerMode and hold state exactly like a built-in does.

    subscribe fires on changes only; render initial state from getState first, then subscribe for updates.

    interface ModeStore {
        armTool(mode: string, tool: string | null): void;
        dispose(): void;
        getArmedTool(mode: string): string | null;
        getDefaultTool(mode: string): string | null;
        getMode(): string;
        getState(): Readonly<ModeState>;
        hasMode(mode: string): boolean;
        isFlyoutActive(mode: string): boolean;
        isPanelOpen(mode: string): boolean;
        isPointerMode(mode: string): boolean;
        isViewActive(): boolean;
        registerMode(
            mode: string,
            kind: RailModeKind,
            defaultTool?: string | null,
            panelOpen?: boolean,
        ): void;
        setMode(mode: string): void;
        setPanelOpen(mode: string, open: boolean): void;
        subscribe(listener: ModeListener): () => void;
        toggleFlyout(mode: string): void;
        toggleToolPanel(mode: string): void;
        toggleView(): void;
        unregisterMode(mode: string): void;
    }
    Index

    Methods

    • Arm a tool in a pointer-mode (the rail slot reflects it). Idempotent.

      Parameters

      • mode: string
      • tool: string | null

      Returns void

    • Drop every subscriber (called on UI teardown).

      Returns void

    • The armed tool for a pointer-mode ('pointer'/null = default).

      Parameters

      • mode: string

      Returns string | null

    • The tool a mode rests on when nothing special is armed.

      Parameters

      • mode: string

      Returns string | null

    • Whether a mode is currently registered (the four built-ins always are).

      Parameters

      • mode: string

      Returns boolean

    • Whether a flyout is open (i.e. its mode is the active one).

      Parameters

      • mode: string

      Returns boolean

    • Whether a pointer-mode's tool panel is currently expanded.

      Parameters

      • mode: string

      Returns boolean

    • Whether a mode owns the tool panel. Unknown modes are not pointer-modes.

      Parameters

      • mode: string

      Returns boolean

    • Returns boolean

      use isFlyoutActive('view') — the rail has more than one flyout now.

    • Add a mode's state to the store. Called by the rail-mode registry; the four built-ins are already present. Re-registering an id overwrites its record but keeps whatever tool/panel state it already had.

      Parameters

      • mode: string
      • kind: RailModeKind
      • defaultTool: string | null = null
      • panelOpen: boolean = true

      Returns void

    • Expand / collapse a pointer-mode's tool panel. Idempotent.

      Parameters

      • mode: string
      • open: boolean

      Returns void

    • Subscribe to state changes. Returns an unsubscribe fn (pass to UIComponent.track).

      Parameters

      • listener: ModeListener

      Returns () => void

    • Open a flyout mode, or close it back to the last pointer-mode.

      Parameters

      • mode: string

      Returns void

    • Toggle a pointer-mode's tool panel open/closed.

      Parameters

      • mode: string

      Returns void

    • Returns void

      use toggleFlyout('view') — the rail has more than one flyout now.

    • Drop a mode's state. The caller is responsible for moving off it first — the store will not decide what to activate instead.

      Parameters

      • mode: string

      Returns void