feat(ui): H / F keyboard fits for the plot data viewport - #73
Merged
Conversation
`H` fits the y axis to the data visible in the current x window (the NMR vertical-fit convention — reset_y's window-scoped auto range, not full_y) and `F` fits both axes, both as single undoable viewport steps sharing the double-click reset path. Plain `F` was already bound to ZoomToSelection (board-level frame fit), so the chord is now context-split by a focused handler instead of the dispatch table: with the pointer on a plot's data area it runs the new FitPlotXY, anywhere else it keeps ZoomToSelection. Both fits are registered as CommandId (FitPlotY / FitPlotXY), gated in describe on an active plot, searchable in the palette, and listed in the View menu; invoked without a pointer target they fall back to the active plot. `H` was unbound before. The keyboard shortcut reference (English and Simplified Chinese) now documents the new keys; shortcuts.rs tests moved to a sibling shortcuts_tests.rs to stay under the source-size limit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Hfits the y axis to the data visible in the current x window (the NMR vertical-fit convention — the window-scoped auto range, notfull_y) andFfits both axes; both are single undoable viewport steps sharing the double-click reset path.Plain
Fwas already bound toZoomToSelection(board-level frame fit), so the chord is context-split by a focused handler instead of the dispatch table: with the pointer on a plot's data area it runs the newFitPlotXY, anywhere else it keepsZoomToSelection— neither behavior is dropped.Hwas unbound before. Invoked without a pointer target, both fits fall back to the active plot.Validation
cargo pr-checkpasses (fmt, source sizes, dependency policy, default-frontends build, clippy-D warnings, reference-backend test suite).F, and command gating;shortcuts.rstests moved to a siblingshortcuts_tests.rsto stay under the source-size limit.UI display logic
CommandId+describe) and are searchable in the command palette. (FitPlotY/FitPlotXYregistered, gated indescribeon an active plot, listed in the View menu.)disabled_reasonthat says how to unblock. (Commands stay visible and disable with a reason when no plot is active.)docs/(English and zh-CN) for user-visible behavior. (Keyboard shortcut reference updated in both languages.)