Go to file
Levi Neuwirth 1ab3e5f298 editor-core: a position_at click→beat-grid horizontal inverse
The horizontal half of click-to-insert: resolve a world point to the metric
region under the cursor and the grid-snapped musical position to insert at.
Together with staff_pitch_at it gives the (pitch, position) an insert needs.

The region and staff are picked through a shared nearest_manifestation helper
(extracted from staff_pitch_at, the non-finite guard moved into it), so the
vertical and horizontal halves agree on which staff the click is over.

The x→time inverse is solver-agnostic: position_anchors reads resolved glyph
x-positions and maps each to its event's onset through the glyph's Pitch/Event
provenance, so the samples come from the actual rendered layout. Only directly
-manifested onset glyphs anchor — synthesized glyphs (accidentals sit left of
the notehead, ledgers, …) are skipped so they cannot pull the time column off
the notehead. invert_x is piecewise-linear through those anchors, extrapolating
the end segment past the last note — the make-room case of clicking the empty
staff after the last note. snap_to_grid rounds to the nearest multiple of the
grid step, rebuilt by exact rational arithmetic so it lands on the grid.

GridResolution is the caller-supplied beat grid (a musical-time step, also the
default duration of a note entered there); a meter-derived default is deferred.
position_at refuses a non-positive grid, a non-metric region (no musical onset),
and a region with fewer than two rendered events (no scale to extrapolate from).

The GUI shows the resolved pitch and snapped position on an empty-staff click,
on a default quarter-note grid.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NAtEiJtt9yKVV1zjKYmZhS
2026-06-29 21:46:11 -04:00
.github/workflows editor-gui: a thin native (egui) editor over the editor-core seam 2026-06-29 11:47:25 -04:00
crates editor-core: a position_at click→beat-grid horizontal inverse 2026-06-29 21:46:11 -04:00
spec Pass-12 batch: mark the resolved I-series rows done 2026-06-27 12:53:36 -04:00
.gitignore Agent I Phase 2-3: engrave recognizable notation from Score to SVG 2026-06-26 20:46:33 -04:00
Cargo.lock editor-gui: a thin native (egui) editor over the editor-core seam 2026-06-29 11:47:25 -04:00
Cargo.toml editor-gui: a thin native (egui) editor over the editor-core seam 2026-06-29 11:47:25 -04:00