Skip to content
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

Line break in SVG fill (Visualizer) #672

Open
jameadows opened this issue Jul 29, 2023 · 0 comments
Open

Line break in SVG fill (Visualizer) #672

jameadows opened this issue Jul 29, 2023 · 0 comments

Comments

@jameadows
Copy link

I'm using PianoRollSVGVisualizer to generate an SVG image into a dynamically created SVGSVGElement and then converting this to a data URL by getting the outerHTML from the element. This doesn't work directly because of a line break character in the fill attribute, which gets exported as fill="rgba(8, 41, 64,
 1)".

I tracked this down to visualizer.ts where there are two occurences of this:

      const fill =
          `rgba(${isActive ? this.config.activeNoteRGB : this.config.noteRGB},
  ${opacity})`;

It looks like the coding style calls for 80 character lines, hence the line break. Perhaps this can be handled with concatenation to avoid the line break and still keep the 80 character limit?

It's a minor issue, but it stumped me for a while and I think it's a pretty easy fix. For the time being I've worked around it by using svgImage.outerHTML.replace(/
/g,''). Crude but effective ;)

Thanks for sharing this great project!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant