epiphany/crates
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
..
epiphany-bundle Pass 11 audit follow-up: honest LayoutObjectId status + doc/test gaps 2026-06-22 10:02:05 -04:00
epiphany-core Agent I-0: real clef + key-signature data in the core graph 2026-06-26 10:31:16 -04:00
epiphany-determinism P12-I2: wire the ratified MUSCLOID layout-object id derivation 2026-06-27 12:46:19 -04:00
epiphany-editor-core editor-core: a position_at click→beat-grid horizontal inverse 2026-06-29 21:46:11 -04:00
epiphany-editor-gui editor-core: a position_at click→beat-grid horizontal inverse 2026-06-29 21:46:11 -04:00
epiphany-engrave layout-ir, engrave: ledger lines 2026-06-29 17:12:56 -04:00
epiphany-layout-ir editor-core: a staff_pitch_at click→pitch vertical inverse 2026-06-29 18:56:34 -04:00
epiphany-ops epiphany-editor-core: a headless editor API + a conformance UI-seam gate 2026-06-27 16:47:34 -04:00
epiphany-render-svg layout-ir, engrave: ledger lines 2026-06-29 17:12:56 -04:00
epiphany-testkit epiphany-editor-core: a headless editor API + a conformance UI-seam gate 2026-06-27 16:47:34 -04:00