Drop the label below an upward-pointing triangle (#242) - #245
Merged
Conversation
An up-pointing triangle is drawn to point AT the gram above it, so the label stacked over its apex covered exactly the data the analyst had aimed it at. For that one symbol the label now hangs underneath instead — over ink the feature already spends — and no toggle or extra click is needed to read what is beneath it. One shared predicate, `labelSitsBelowSymbol()` in rendering/symbols.js, decides this for every labelled feature: - analysis markers, via `markerLabelPlacement()`: the baseline drops a whole line of text past the symbol's bottom edge, so the glyphs clear the mark; - harmonic and sideband pins, via `PinSetMode.labelStackPositions()`: the symbol still caps the line, only the number changes sides, and the top-edge clamp now measures from whichever part leads the stack. The grab region follows the digits rather than staying where they used to be: `labelStackBounds()` inverts with the layout, and reports the symbol's underside separately so a hidden-pin set's mini-pin stub keeps hanging from the symbol regardless of where the label went. The marker label's font size moves into utils/markerLabel.js, which needs it to size the drop, and rendering/labels.js imports it back. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SpLe4XCjhvgj7fEaYhghxZ
Contributor
PR PreviewPreview deployment is ready! View Preview Last updated: 2026-08-21T13:13:38.316Z |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #242.
The problem
An upward-pointing triangle is drawn to point at the gram above it, but the label was stacked over its apex — covering exactly the data the analyst had aimed it at.
The issue offered two fixes: a per-set label toggle, or teaching the layout that this one symbol carries its label underneath. This is the second, so it costs no extra interaction: pick the triangle, and the space it points at stays clear.
What changed
One shared predicate —
labelSitsBelowSymbol()insrc/rendering/symbols.js— decides this for every labelled feature, so the rule cannot drift between them:markerLabelPlacement()): the baseline drops a whole line of text past the symbol's bottom edge, so the glyphs — which hang above their baseline — start clear of the mark.PinSetMode.labelStackPositions()): the symbol still caps the pin line and the anchor never moves; only the number changes sides, landing over ink the pin already spends. The top-edge clamp now measures from whichever part leads the stack (the symbol when the label hangs below), so FR-011 still holds.Sidebands come along for free — both modes share
PinSetMode— which covers the issue's note about #241.The hotspot follows the digits rather than staying where they used to be:
labelStackBounds()inverts with the layout, and now reports the symbol's underside separately so a hidden-pin set's mini-pin stub keeps hanging from the symbol regardless of where the label went.Only the up triangle is affected.
triangle-downpoints at the space below it, so its label stays above, and every other symbol is unchanged.The marker label's font size moves into
utils/markerLabel.js, which needs it to size the drop;rendering/labels.jsimports it back, so the placement rule and the element that obeys it read one number.Testing
yarn test— 330 passed, including new coverage: an up-triangle pin stacks symbol → label with the gram above the apex clear; the label under the triangle still grabs its set, while the space it vacated now grabs nothing; the mini-pin still hangs from the symbol; and an up-triangle marker draws its label centred below the symbol.yarn test:unit— 136 passed, including the placement rule and a check thattriangleis the only symbol in the catalogue that inverts.yarn typecheck,yarn lint,yarn hygiene— all clean, no baselines moved.Docs updated:
docs/Gram-Modes.md(Analysis and Harmonics behaviour) and the mode summary inCLAUDE.md.Generated by Claude Code