Skip to content

Comments

feat(chart): keyboard navigation for chart panning#96

Open
terrylica wants to merge 1 commit intoflowsurface-rs:mainfrom
terrylica:feat/keyboard-chart-navigation
Open

feat(chart): keyboard navigation for chart panning#96
terrylica wants to merge 1 commit intoflowsurface-rs:mainfrom
terrylica:feat/keyboard-chart-navigation

Conversation

@terrylica
Copy link

Adds keyboard-driven chart panning so users can navigate history without touching the mouse or trackpad.

Key bindings:
←/→ scroll 10 bars left/right
Shift+←/→ scroll 50 bars (fast)
PageUp/Down scroll one full visible window
Home jump to latest bar (reset pan)

macOS equivalents: Fn+↑ = PageUp, Fn+↓ = PageDown, Fn+← = Home

Navigation works whenever the app window is focused; the cursor does not need to be inside the chart canvas.

Implementation

All pan logic lives in a new src/chart/keyboard_nav.rs module.

keyboard_nav_msg() is added as a default method on the Chart trait (using the already-required state() accessor), so every current and future chart type automatically gets keyboard navigation with no per-type boilerplate.

Minimal changes to existing files:

  • src/chart.rs mod declaration + default trait method +
    delegate _ => arm in canvas_interaction;
    cursor_position? guard moved inside Shift arm
    (ruler tool needs it, nav keys do not)
  • src/screen/dashboard.rs ChartKeyNav message + handler
  • src/screen/dashboard/pane.rs apply_keyboard_nav() + Chart import
  • src/main.rs extend keyboard::listen() to forward nav keys
    app-wide (canvas delivery requires cursor focus)

Tested on: Apple M3 Max, macOS 15.7.5 Sequoia (Build 24G607)

Adds keyboard-driven chart panning so users can navigate history
without touching the mouse or trackpad.

Key bindings:
  ←/→           scroll 10 bars left/right
  Shift+←/→     scroll 50 bars (fast)
  PageUp/Down   scroll one full visible window
  Home          jump to latest bar (reset pan)

macOS equivalents: Fn+↑ = PageUp, Fn+↓ = PageDown, Fn+← = Home

Navigation works whenever the app window is focused; the cursor does
not need to be inside the chart canvas.

Implementation
--------------
All pan logic lives in a new src/chart/keyboard_nav.rs module.

keyboard_nav_msg() is added as a default method on the Chart trait
(using the already-required state() accessor), so every current and
future chart type automatically gets keyboard navigation with no
per-type boilerplate.

Minimal changes to existing files:
- src/chart.rs         mod declaration + default trait method +
                       delegate _ => arm in canvas_interaction;
                       cursor_position? guard moved inside Shift arm
                       (ruler tool needs it, nav keys do not)
- src/screen/dashboard.rs   ChartKeyNav message + handler
- src/screen/dashboard/pane.rs  apply_keyboard_nav() + Chart import
- src/main.rs          extend keyboard::listen() to forward nav keys
                       app-wide (canvas delivery requires cursor focus)

Tested on: Apple M3 Max, macOS 15.7.5 Sequoia (Build 24G607)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant