abcjs icon indicating copy to clipboard operation
abcjs copied to clipboard

How to detect which note of the chord has been clicked?

Open ehsansh opened this issue 3 years ago • 5 comments

I have a chord [ADF] . What is the best way to find which note the user has clicked?

ehsansh avatar Jun 08 '21 11:06 ehsansh

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.

paulrosen avatar Jun 11 '21 01:06 paulrosen

Thanks. It is great. I tested now and found a few issues.

  1. When I have for example a and I click on the note head sometimes the clickedName shows ledger instead of the note name.
  2. For white and whole notes when I click in the white area inside of the note clickedName shows undefined. I do appreciate if you solve these issues for the next release.

ehsansh avatar Jun 11 '21 16:06 ehsansh

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!

nbruley avatar Oct 02 '21 18:10 nbruley

Is this what you are looking for? https://paulrosen.github.io/abcjs/visual/click-listener.html#abcelem

paulrosen avatar Oct 04 '21 13:10 paulrosen

Yes!! Exactly. Thank you.

nbruley avatar Oct 04 '21 22:10 nbruley