MAIDR Documentation - v3.65.0
    Preparing search index...

    Class RotorNavigationService

    Manages rotor-based navigation for the active trace via alt+shift+up and alt+shift+down

    Purpose:

    • Provide modal navigation over a trace by rotating through available modes.

    Available modes vary by trace type:

    • Non-scatter traces: DATA_MODE → LOWER_VALUE_MODE → HIGHER_VALUE_MODE
    • Scatter traces (with grid): ROW_COL_MODE → GRID_MODE
    • Scatter traces (no grid): ROW_COL_MODE only

    Mode descriptions:

    • DATA_MODE / ROW_COL_MODE: Default data browsing. The display name is trace-specific.
    • LOWER_VALUE_MODE: Navigate to data points with lower y-values (non-scatter only).
    • HIGHER_VALUE_MODE: Navigate to data points with higher y-values (non-scatter only).
    • GRID_MODE: Navigate by grid cells in scatter plots (scatter with grid config only).

    Responsibilities:

    • Track the current rotor mode and expose helpers to cycle forward/backward across modes.
    • Coordinate scope focus: entering a compare mode (LOWER/HIGHER) may switch focus to the rotor scope; returning to data mode restores focus to the trace scope.
    • Delegate directional movement to the active AbstractTrace implementation using rotor-aware APIs, with a fallback to compare-based traversal when rotor methods are unavailable.

    Dependencies:

    • Context: Provides the active trace and current scope.
    • TextService: Reserved for user-facing feedback/messages and parity with other services.

    Notes:

    • UI-agnostic: this service contains no rendering logic and does not depend on the UI.
    • Returns user-facing messages from movement methods when a move is not possible; callers may surface these through the ViewModel/UI.
    Index

    Constructors

    • Creates a new RotorNavigationService instance.

      Parameters

      • context: Context

        The context providing access to the active trace

      • text: TextService

        Provides terse/verbose/off mode for message formatting

      • notification: NotificationService

        Used to push intersection-mode messages through the text alert region. The alert region re-mounts on every dispatch (keyed by a revision counter), which is what causes screen readers to re-announce on repeat key presses. Without this, identical messages dispatched only to the rotor area do not re-announce.

      Returns RotorNavigationService

    Methods

    • Advances to the next rotor navigation mode.

      Returns string

      The name of the new rotor mode, or grid info if entering grid mode

    • Moves to the previous rotor navigation mode.

      Returns string

      The name of the new rotor mode, or grid info if entering grid mode

    • Gets the current rotor mode index.

      Returns number

      The current rotor index

    • Moves to the next data point in the specified direction based on current compare mode.

      Parameters

      • direction: "left" | "right"

        The direction to move ('left' or 'right')

      Returns string | null

      Error message if move failed, null otherwise

    • Moves up to a data point with lower/higher value based on rotor mode, or moves up one grid cell in grid mode.

      Returns string | null

      Error message if move failed, null otherwise

    • Moves down to a data point with lower/higher value based on rotor mode, or moves down one grid cell in grid mode.

      Returns string | null

      Error message if move failed, null otherwise

    • Moves left to a data point with lower/higher value based on rotor mode, or moves left one grid cell in grid mode.

      Returns string | null

      Error message if move failed, null otherwise

    • Moves right to a data point with lower/higher value based on rotor mode, or moves right one grid cell in grid mode.

      Returns string | null

      Error message if move failed, null otherwise

    • Sets the rotor mode based on the current index and updates context state.

      Returns void

    • Gets the current rotor mode name.

      Known limitation: rotorIndex is not reset when the active plot/trace changes. If the user cycles to a capability-gated mode (GRID_MODE or INTERSECTION_MODE) and focus then moves to a trace that does not advertise that capability, the modulo below silently wraps the index onto a different mode without announcing the switch. Resetting the rotor on context change is a broader UX decision tracked separately from this file.

      Returns string

      The display name of the current rotor mode

    • Gets the comparison type for the current rotor mode.

      Returns "lower" | "higher"

      'lower' or 'higher' based on the current mode

    • Parameters

      • navType: string
      • direction: string

      Returns string