abcjs
abcjs copied to clipboard
How to detect which note of the chord has been clicked?
I have a chord [ADF]
.
What is the best way to find which note the user has clicked?
I am working on a change that will make this easy - I have it in the dev branch now but wanted to test it a little more before releasing it. If you are using the min version of the library give this a try: https://github.com/paulrosen/abcjs/blob/dev/dist/abcjs-basic-min.js.
If you are using the npm version put this in your package.json:
"abcjs": "https://github.com/paulrosen/abcjs#39ac46cd30bc98daa0db0f0a9a65e5c9d5bdc2a8",
Then you'll see a lot more info in the clickHandler.
Thanks. It is great. I tested now and found a few issues.
- When I have for example
a
and I click on the note head sometimes theclickedName
showsledger
instead of the note name. - For white and whole notes when I click in the white area inside of the note
clickedName
showsundefined
. I do appreciate if you solve these issues for the next release.
Is there documentation on how to use click events for note clicks? I'd like to display the classes on the note that is clicked to speed up generating the CSS for the 835 tunes which need to be edited for second interval overlapped notes. Thanks!
Is this what you are looking for? https://paulrosen.github.io/abcjs/visual/click-listener.html#abcelem
Yes!! Exactly. Thank you.