Skip to content

feat(highway): render teaching marks fg/ch/sd on 2D + 3D (§6.2.2)#538

Merged
byrongamatos merged 1 commit into
mainfrom
feat/teaching-marks-render
Jun 21, 2026
Merged

feat(highway): render teaching marks fg/ch/sd on 2D + 3D (§6.2.2)#538
byrongamatos merged 1 commit into
mainfrom
feat/teaching-marks-render

Conversation

@byrongamatos

Copy link
Copy Markdown
Contributor

Part of #334

PR 2 of 3 for the teaching marks epic (feedpak 1.5.0 §6.2.2). Renders the three optional per-note marks on both highways, mirroring the bend-curve render (#532). Display only — no scoring / NoteVerifier coupling.

Based on main; reads the wire keys (fg/ch/sd) defensively, so it renders correctly once PR #536 lands and is harmless before (absent fields → unset).

2D — static/highway.js

  • fg (fret-hand finger): renders by default as a small cyan numeral hugging the gem's right edge — T = thumb, 1..4.
  • sd (scale degree): amber label on the gem's left edge, opt-in.
  • ch (strum group): a bracket connecting gems that share a ch key, with a single arrowhead whose direction comes from pkd (down/up strum). Opt-in. Note-stream-only (chord notes already read as one simultaneous gesture).
  • New showTeachingMarks toggle gates the sd/ch overlays (default off) so the default highway stays uncluttered — exposed via toggleTeachingMarks / get/setTeachingMarksVisible and the bundle's teachingMarksVisible flag.
  • Pure helpers teachingFingerLabel / teachingDegreeLabel / strumGroupBuckets.

3D — plugins/highway_3d/screen.js

  • fg (default) + sd (opt-in, mirrors the 2D toggle via bundle.teachingMarksVisible) render next to the per-note fret label via a new pooled sprite (pTeachMarkLbl, full declare/create/warm/reset/null-out lifecycle).
  • _scrChordNote now resets fg/sd to -1 (like the existing fhm/bnv/bt resets) so chord notes don't inherit stale marks.
  • ch strum brackets are deferred in 3D — the per-note render has no cross-note batch pass to connect gems across strings; the 2D highway covers ch. Documented in code.

Tested locally

  • node tests/js/highway_teaching_marks.test.js7 passed (label mapping for both highways + strum-group bucketing edge cases).
  • node tests/js/highway_bend_curve.test.js still passes (helper extraction unaffected).
  • node --check static/highway.js and node --check plugins/highway_3d/screen.js clean.
  • Independent Codex review (read-only): caught a real P2 (3D _scrChordNote leaking stale fg/sd to chord notes) — fixed; re-review clean.

Deferrals

  • ch strum bracket in 3D (documented above).
  • ch bracket across chord notes in 2D (note-stream-only).

🤖 Generated with Claude Code

Render the three per-note teaching marks on both highways, mirroring the
bend-curve render (#532). Display only — no scoring / NoteVerifier coupling.

- 2D static/highway.js: fg renders by default as a small finger numeral hugging
  the gem (T = thumb, 1..4); sd (degree label) and ch (strum bracket connecting
  notes that share a ch key, arrow direction from pkd) are opt-in behind a new
  `showTeachingMarks` toggle (exposed via toggle/get/set + the bundle's
  `teachingMarksVisible` flag). Pure helpers teachingFingerLabel /
  teachingDegreeLabel / strumGroupBuckets drive the glyphs. ch bracket is
  note-stream-only (chord notes already read as one gesture).
- 3D plugins/highway_3d/screen.js: fg (default) + sd (opt-in, mirrors the 2D
  toggle via bundle.teachingMarksVisible) render next to the per-note fret label
  via a new pooled sprite (pTeachMarkLbl); _scrChordNote resets fg/sd so chord
  notes don't inherit stale marks. ch strum brackets are deferred in 3D (no
  cross-note batch pass in the per-note render); 2D covers ch.

Tests: tests/js/highway_teaching_marks.test.js extracts the pure helpers from
both files (extract-and-eval) and asserts label mapping + strum-group bucketing.

Part of #334

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@byrongamatos
byrongamatos merged commit 0f10069 into main Jun 21, 2026
0 of 3 checks passed
@byrongamatos
byrongamatos deleted the feat/teaching-marks-render branch June 21, 2026 05:58
byrongamatos added a commit that referenced this pull request Jun 21, 2026
…539)

Post-merge review of #538 noted the fg finger numeral rendered unconditionally on
both highways and couldn't be turned off — only sd/ch sat behind the (default-off)
teaching-marks toggle. A user who finds per-note numerals busy had no way to
declutter.

Add a SEPARATE finger-hints gate that keeps fg shown by default but makes it
hideable, independent of the sd/ch opt-in (so the two defaults — fg on, sd/ch off —
coexist; a single boolean can't express that):

- 2D static/highway.js: _showFingerHints (localStorage 'showFingerHints' !==
  'false', i.e. default on), a fingerHintsVisible bundle flag, and
  get/toggle/setFingerHintsVisible API; gates the fg label.
- 3D plugins/highway_3d/screen.js: mirrors via bundle.fingerHintsVisible !== false
  (default on); gates the fg sprite. sd/ch unchanged.

Default-on preserved (absent localStorage / absent bundle flag => shown); only an
explicit false hides fg. Codex-reviewed: clean. Render test 7/7.

Part of #334.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants