-
Notifications
You must be signed in to change notification settings - Fork 664
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How is addClass method supposed to work? #1636
Comments
Unfortunately, that's not what An SVG class would be attached to the group, which you can always do by using openGroup and wrapping whatever you are drawing in a group, and add the class to that. But, you probably don't draw individual notes so this won't help with StaveNote. Edit: I should add that you can also do some direct styling for elements such as note heads. Check out the style_tests.ts test cases file. |
Thanks for the reply! I'm curious, what is addClass method for then? Is it used internally somehow? I ended up with an even more straightforward approach, directly modifying the styles of the needed note G elements by the index, btw. I needed to color the notes that are being played at a particular moment. |
@utanashati it is used for EasyScore. You can attach the class to the element instance in the easy score language, and then tell one instance from another in an array of notes, for instance. And I suppose it could be used for any text to vex widget. But canvas renderer doesn't have an equivalent of SVG class that affects the display, so it's not used when rendering. |
Hi Vexflow team! Thank you for this great lib!
I have an issue with the
addClass
method, of a StaveNote, in particular. I tried using it on a StaveNote to add a custom class to the corresponding G element, and while after I use it, the StaveNote instance does get updated with the new class name, it's not reflected in the final SVG.Could you please explain, is this a bug or a feature, and how is it supposed to work? At which point do the classes get appended to the G elements?
I reproduced the issue in a code sandbox.
The text was updated successfully, but these errors were encountered: