Hello crews,
I'm currently experimenting with rendering musical notation in the browser. For that purpose, I leverage Ractive + SVG.
After being able to render a simple piece of music, I'd like to add some basic editing, for example, clicking on musical objects should show their properties.
Because a typical musical score can have several hundreds of musical symbols, adding event handlers to every single object (and thus cluttering the code with "on-click"-like expressions) doesn't look like a good idea. Moreover, I'm not sure about the performance of this method.
Is it possible to create a kind of generic event handler in Ractive, attached to the SVG, and then figure out the precise event target? Something like this
fiddle (for the moment being, it doesn't work due to cross-origin issues but it shows the proof of concept)?
I'd greatly appreciate any suggestions (and perhaps real-world examples) regarding event handling in big documents.
Thank you in advance!
Cheers
Max