fix(peaks): zoom-scaled apex snap and Shift free placement - #5
Closed
Limdongcheng wants to merge 1 commit into
Closed
fix(peaks): zoom-scaled apex snap and Shift free placement#5Limdongcheng wants to merge 1 commit into
Limdongcheng wants to merge 1 commit into
Conversation
Manual picking snapped to the tallest local maximum inside a window fixed at 1.5% of the full x span, regardless of zoom — so next to a strong line, a weak line could never be picked: zooming in sharpened the click but not the window. The apex search window is now derived from a fixed screen radius (12 px) at the current zoom, so zooming in narrows it in step with the click precision; tallest-in-window is kept (over nearest-local-maximum) so zoomed-out clicks land on real peaks instead of the nearest noise wiggle. Shift+click skips the snap and places the mark on the nearest sample — the escape hatch for shoulders. The hover preview resolves through the same path, modifier included. `Trace1d::snap` becomes `snap_within(x, half_width)` + `nearest_sample`, unified under `pick(x, ManualPeakSnap)`; `add_manual_peak` takes the snap explicitly. Range drag-picking (`pick_in_range`) keeps its 3-sigma prominence floor: it is scoped to the dragged window with MAD-based noise, which peaks inflate very little, and the reported failure was click-snap, not range picking. New peaks_tests.rs pins the narrow-window weak-apex pick, the wide-window tallest pick, free placement, and the no-apex fallback. The peak-picking guide (EN + zh-CN) documents the zoom-scaled snap and Shift placement.
|
I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
This was referenced Aug 28, 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.
Root cause
Manual picking snapped to the tallest local maximum inside a window fixed at 1.5% of the full x span, regardless of zoom — so next to a strong line a weak line could never be picked: zooming in sharpened the click but not the window.
Fix
API:
Trace1d::snapbecomessnap_within(x, half_width)+nearest_sample, unified underpick(x, ManualPeakSnap);add_manual_peaktakes the snap explicitly.Range drag-picking (
pick_in_range) keeps its 3-sigma prominence floor: it is scoped to the dragged window with MAD-based noise, which peaks inflate very little, and the reported failure was click-snap, not range picking.Docs & tests
New
peaks_tests.rspins the narrow-window weak-apex pick, the wide-window tallest pick, free placement, and the no-apex fallback. The peak-picking guide (EN + zh-CN) documents the zoom-scaled snap and Shift placement.cargo pr-checkpasses.Part 4 of the stack, based on
feat/plot-fit-shortcuts(#4).