mirror of
https://github.com/9x/sheetmusictrainer.git
synced 2026-11-03 13:53:55 +01:00
Live-note staff: 64px box aligned with mic button, extreme ledger lines overflow instead of clipping
This commit is contained in:
@@ -1104,8 +1104,13 @@ button {
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.live-note-staff {
|
||||
height: 64px; /* matches the mic button — vertical centering via the bar's align-items */
|
||||
}
|
||||
|
||||
.live-note-staff svg {
|
||||
display: block; /* inline SVG baseline gap made the box taller than the SVG */
|
||||
overflow: visible; /* extreme ledger lines overlap neighbors instead of adding whitespace */
|
||||
}
|
||||
|
||||
/* Zen mode: center the core UI vertically; the exit button is position:fixed
|
||||
|
||||
@@ -42,10 +42,12 @@ export const LiveNoteStaff: React.FC<LiveNoteStaffProps> = ({
|
||||
container.innerHTML = '';
|
||||
|
||||
const renderer = new Renderer(container, Renderer.Backends.SVG);
|
||||
// Enough headroom for the instrument's written range: guitar first
|
||||
// position reaches written E3 — about four ledger lines BELOW the
|
||||
// treble staff. A 74px box clipped those (half-invisible staff).
|
||||
renderer.resize(width, 112);
|
||||
// Match the mic button height (64px) so the staff is vertically
|
||||
// aligned with it. The stave is centered in the box; extreme ledger
|
||||
// lines (very high/low notes) intentionally OVERFLOW the box
|
||||
// (CSS overflow: visible) and may overlap neighboring elements —
|
||||
// preferred over reserving large empty headroom.
|
||||
renderer.resize(width, 64);
|
||||
const context = renderer.getContext();
|
||||
|
||||
const resolvedColor =
|
||||
@@ -55,7 +57,7 @@ export const LiveNoteStaff: React.FC<LiveNoteStaffProps> = ({
|
||||
context.setFillStyle(resolvedColor);
|
||||
context.setStrokeStyle(resolvedColor);
|
||||
|
||||
const stave = new Stave(0, 28, width - 2);
|
||||
const stave = new Stave(0, 13, width - 2);
|
||||
stave.setDefaultLedgerLineStyle({ strokeStyle: resolvedColor, lineWidth: 2 });
|
||||
stave.addClef(clef);
|
||||
if (keySignature) stave.addKeySignature(keySignature);
|
||||
|
||||
Reference in New Issue
Block a user