fix(highway): make fret-hand finger (fg) hints hideable (default on) (#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 got-feedback/feedback#334.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Byron Gamatos
2026-06-21 08:14:24 +02:00
committed by GitHub
co-authored by Claude Opus 4.8
parent 9b793c5dbd
commit f182bd0ab7
2 changed files with 38 additions and 9 deletions
+13 -4
View File
@@ -2535,8 +2535,12 @@
/** Snapshotted in update() — drawNote() is a sibling of update(), not nested in its closure. */
let _drawChordTemplates = null;
/** Teaching marks sd/ch overlay pref (§6.2.2), mirrored from the 2D
* highway's `teachingMarksVisible` bundle flag. fg renders regardless. */
* highway's `teachingMarksVisible` bundle flag. */
let _drawTeachingMarks = false;
/** Fret-hand finger (fg) hint pref, mirrored from the 2D highway's
* `fingerHintsVisible` bundle flag default on (shown unless an explicit
* false), hideable independently of the sd/ch overlays. */
let _showFingerHints = true;
let _laneTargetColor = null;
let _renderScale = 1;
let lyricsCanvas = null, lyricsCtx = null;
@@ -8831,6 +8835,8 @@
_drawNextByString = nextNoteByString;
_drawChordTemplates = bundle.chordTemplates ?? null;
_drawTeachingMarks = !!bundle.teachingMarksVisible;
// Default on: only an explicit false (older bundles omit the flag) hides fg.
_showFingerHints = bundle.fingerHintsVisible !== false;
// ── Recent-past event per string (for _nextAnyT deadline) ─────
// Once a note/chord passes `now` it leaves _drawNextByString,
@@ -12300,8 +12306,9 @@
// Teaching marks (§6.2.2) — display only, never grading. The
// fret-hand finger (fg) renders by default to the right of the
// fret label; the scale degree (sd) is opt-in (mirrors the 2D
// `teachingMarksVisible` toggle) and renders to the left.
// fret label (hideable via the finger-hints toggle); the scale
// degree (sd) is opt-in (mirrors the 2D `teachingMarksVisible`
// toggle) and renders to the left.
if (alpha > 0 && n.f > 0) {
const _tmS = 5.0 * K * _textSizeMul * fretLabelScaleForFret(n.f);
const _drawTeachMark = (text, colorHex, dx, cacheKey) => {
@@ -12318,7 +12325,9 @@
spr.scale.set(_tmS, _tmS, 1);
spr.material.opacity = alpha;
};
_drawTeachMark(teachingFingerLabel(n.fg), '#7fd1ff', NW * 0.95, 'teachFg');
if (_showFingerHints) {
_drawTeachMark(teachingFingerLabel(n.fg), '#7fd1ff', NW * 0.95, 'teachFg');
}
if (_drawTeachingMarks) {
_drawTeachMark(teachingDegreeLabel(n.sd), '#ffcc66', -NW * 0.95, 'teachSd');
}