stringsync / vexml

MusicXML to Vexflow
MIT License
20 stars 5 forks source link

Music sheet events #159

Closed jaredjj3 closed 5 months ago

jaredjj3 commented 1 year ago

Requirements

When the user interacts (click, tap, keyboard press during focus, etc.) with a rendered score, the score should emit events that can be hooked into. An event may or may not contain information about what was interacted with.

NOTE: Any events tied to a cursor should be emitted by the cursor instead. See #158.

Hints

Before developing anything, I highly recommend that you make a list of events + payloads (see MusicDisplay Event definitions below).

There is prior art in stringsync.

jaredjj3 commented 5 months ago

I'm starting to work on this now. In both approaches, vexml would expose the same API. I'm going with the Single event listener approach unless I run into a hard block.

Single event listener (preferred)

Install a single event listener on the <svg> or <canvas>. On interaction, vexml calculates the data needed to satisfy the API.

Event listener per element

Install an event listener for each vexflow.Element in a <svg>. vexml would pipe and transform the data from the native events to conform to the API.