Skip to content

feat(processing): pick the Reference source position on the spectrum - #70

Merged
nmrtist merged 1 commit into
nmrtist:mainfrom
Limdongcheng:feat/reference-pick
Aug 29, 2026
Merged

feat(processing): pick the Reference source position on the spectrum#70
nmrtist merged 1 commit into
nmrtist:mainfrom
Limdongcheng:feat/reference-pick

Conversation

@Limdongcheng

@Limdongcheng Limdongcheng commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

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_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.

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 source limit.

Validation

  • cargo pr-check passes on current main (fmt, source sizes, dependency policy, default-frontends build, clippy -D warnings, reference-backend test suite).
  • Tests: processing-level offset-from-step reduction; pick arm/resolve lifecycle (valid only while the arming editor stays expanded on the active dataset); end-to-end commit conversion including undo.
  • The Processing manual page (English and zh-CN) gains a Reference section documenting the workflow; npm run build in docs/ passes.

UI display logic

  • New or changed actions go through the command catalog (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.)
  • Hiding happens only at Ribbon-group level (dataset kind or width budget); transient states disable with a disabled_reason that says how to unblock. (No show/hide logic touched.)
  • No layout changes from background events; panels are never auto-closed. (The pick mode is revalidated per frame against the editor's expanded state; it never opens or closes panels.)
  • New panels or empty regions show an empty state with a next step. (No new panels.)
  • Docs updated in docs/ (English and zh-CN) for user-visible behavior. (Processing guide gains a Reference section in both languages.)

@Limdongcheng Limdongcheng changed the title Feat/reference pick Feat(ui)/reference pick Aug 29, 2026
@Limdongcheng Limdongcheng changed the title Feat(ui)/reference pick feat(ui)/reference pick Aug 29, 2026
@Limdongcheng Limdongcheng changed the title feat(ui)/reference pick feat/reference pick Aug 29, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 29, 2026
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 Limdongcheng reopened this Aug 29, 2026
@Limdongcheng Limdongcheng changed the title feat/reference pick feat(processing): pick the Reference source position on the spectrum Aug 29, 2026
@nmrtist
nmrtist merged commit ebe0a0e into nmrtist:main Aug 29, 2026
11 checks passed
Repository owner deleted a comment from Limdongcheng Aug 29, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants