feat(processing): pick the Reference source position on the spectrum - #70
Merged
Merged
Conversation
5 tasks
The Reference step's source position could only be typed as a number, while the value the user wants is "the peak currently sitting there" — a position they can see on the plot but had to read off manually. The step editor gains a "Pick position on spectrum" row (styled with the shared clickable-affordance accent) that arms a one-shot on-plot pick. While armed, hovering the target plot previews the position with a dashed guide line, an apex dot and a ppm readout; the pick reuses the zoom-scaled apex snap manual peak picking uses (Shift = nearest sample), so weak lines are reachable by zooming in first. A click writes the step's at_ppm through the property catalog — one undo step, the same recompute as typing — and prompts for the target position. Esc, collapsing the editor, or switching datasets disarms; the arm state is revalidated per frame like the on-plot phase mode, so a collapsed card never leaves a live click trap. The picked coordinate lives on the finished axis while at_ppm lives on the axis entering the step, so the commit subtracts the calibration applied at or after the step — exposed as AxisPipeline::chemical_shift_offset_from_step_ppm beside the existing whole-pipeline reduction, keeping reference-step semantics in one place. After the edit the picked feature reads exactly target_ppm even when re-picking a step that already carries an offset. The pick handler runs after navigation (wheel/trackpad zoom keep working while aiming) and consumes the pointer over the plot so the click cannot fall through to layout or data gestures. An axis without a 1D trace (a 2D dimension) picks the raw coordinate without snapping. canvas/mod.rs's inline test modules move to a sibling mod_tests.rs, and ui_state.rs's dialog-state cluster to ui_state_dialogs.rs, to stay under the 800-line limit. The Processing manual page (EN + zh-CN) gains a Reference section documenting the workflow.
Limdongcheng
force-pushed
the
feat/reference-pick
branch
from
August 29, 2026 09:02
0f5b8ab to
56abd92
Compare
Repository owner
deleted a comment from
Limdongcheng
Aug 29, 2026
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
The Reference step's source position could only be typed as a number, while the value the user wants is "the peak currently sitting there" — visible on the plot but read off manually.
The step editor gains a "Pick position on spectrum" row that arms a one-shot on-plot pick. While armed, hovering the target plot previews the position with a dashed guide line, an apex dot and a ppm readout; the pick reuses the zoom-scaled apex snap manual peak picking uses (Shift = nearest sample), so weak lines are reachable by zooming in first. A click writes the step's
at_ppmthrough the property catalog — one undo step, the same recompute as typing — and prompts for the target position. Esc, collapsing the editor, or switching datasets disarms; the arm state is revalidated per frame like the on-plot phase mode, so a collapsed card never leaves a live click trap.The picked coordinate lives on the finished axis while
at_ppmlives on the axis entering the step, so the commit subtracts the calibration applied at or after the step — exposed asAxisPipeline::chemical_shift_offset_from_step_ppmbeside the existing whole-pipeline reduction, keeping reference-step semantics in one place. After the edit the picked feature reads exactlytarget_ppmeven when re-picking a step that already carries an offset.canvas/mod.rs's inline test modules move to a siblingmod_tests.rs, andui_state.rs's dialog-state cluster toui_state_dialogs.rs, to stay under the 800-line source limit.Validation
cargo pr-checkpasses on currentmain(fmt, source sizes, dependency policy, default-frontends build, clippy-D warnings, reference-backend test suite).npm run buildindocs/passes.UI display logic
CommandId+describe) and are searchable in the command palette. (The pick button is a panel-local widget inside the step editor — explicitly exempt in the catalog rules; no commands added.)disabled_reasonthat says how to unblock. (No show/hide logic touched.)docs/(English and zh-CN) for user-visible behavior. (Processing guide gains a Reference section in both languages.)