feat(editor): standard notation in the score view (View ▸ Score staff) - #288
Merged
Conversation
The live score view grows a staff preference: tablature only (default,
per the v1 call), standard notation only, or both staves together —
same generated alphaTex either way, alphaTab derives pitch from
tuning + fret, so notation comes free of new generation code.
- tab-view-live.js: _scoreStaffProfilePure maps the preference to
alphaTab's StaveProfile key (unknown/legacy stored values degrade to
tab, never throw into the renderer); the api tracks the staff it was
built with and rebuilds on change (staveProfile is construction-time);
editorSetTabViewStaff validates + persists (localStorage, a reading
preference like loop-snap) and ENTERS the view when it's off.
- menu-bar.js: a Score-staff radio trio in the View menu, same ctx/
dispatch pattern as the loop-snap trio; checkmarks resolve at open.
- state.js: S.tabViewStaff ('tab' default).
Live-verified on :8001 (AC/DC pak): all three staves engrave (tab
frets / treble-clef pitches with accidentals / braced grand system),
click-to-select works under 'both' (3 notes), the real View-menu radio
renders + dispatches + enters the view, preference persists. 148/148,
lint baseline, new tab_view_staff suite + menu-model radio pin.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EBQCHCNA81E9tHmSDHSe2Q
…build
The Score-staff switch made _ensureApi rebuild the alphaTab api on the
SAME mount node (staveProfile is a construction-time setting). But
_destroyApi only tore down alphaTab's own api — it never removed our
capture-phase mousedown fallback, which is our own closure. So every
staff toggle stacked another live listener on the surviving mount, and
each subsequent beat click fired select() / editorSeekToTime() / status
updates once per accumulated listener.
Root cause: the manual mount.addEventListener('mousedown', ..., true) in
_ensureApi had no matching removeEventListener. Name the handler, drop it
in _destroyApi before nulling _apiMount. In PR #273 this path never fired
on a surviving node (rebuild happened only on a NEW mount, GC'd the old
listener), so the leak is specific to the staff-switch guard this PR adds.
Regression test (tests/tab_view_staff.test.mjs): three staff switches on
one mount keep exactly one mousedown listener; fails pre-fix (2 !== 1).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughAdds a persisted score-staff preference with tablature, notation, and combined modes. The View menu controls the preference, alphaTab rebuilds when it changes, score view activation is supported, and listener cleanup plus menu behavior are tested. ChangesScore staff preference
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant ViewMenu
participant editorSetTabViewStaff
participant localStorage
participant alphaTabAPI
ViewMenu->>editorSetTabViewStaff: select staff mode
editorSetTabViewStaff->>localStorage: persist editorTabViewStaff
editorSetTabViewStaff->>alphaTabAPI: rebuild with staveProfile
alphaTabAPI-->>editorSetTabViewStaff: attach one mousedown handler
Possibly related PRs
Suggested reviewers: ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
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.
Supersedes #274 (auto-closed when its stacked base branch
feat/editor-tab-view-livewas deleted on merge of #273). Rebased cleanly onto main; content unchanged — notation staff + the review listener-leak fix. Reviewed green (161 pass); CodeRabbit clean.Summary by CodeRabbit
New Features
Bug Fixes