JoeChapman / svg-builder

Simple, chainable SVG-building tool for NodeJS and the browser (with Browserify)
41 stars 13 forks source link

Nested elements? #10

Open YuriGal opened 2 years ago

YuriGal commented 2 years ago

I realized this repo probably is not actively maintained anymore, but decided to give it a shot. Is there a possibility to create nested elements, e.g.

  <g fill="white" stroke="green" stroke-width="5">
    <circle cx="40" cy="40" r="25" />
    <circle cx="60" cy="60" r="25" />
  </g>
JoeChapman commented 2 years ago

HI @YuriGal I cannot recall if that is possible, have you tried?

YuriGal commented 2 years ago

Thanks for the reply! I know it's been a while. It is currently possible with <a> element, something like

svg.a({}, svg.otherelement()}

I see <g> is listed as a container, but there is no svg.g() method. It would be really helpfull for things like group transform.

Fun fact :-) I am using your library to create apps for Fitbit smartwatches otherwise incapable of creating dynamic SVG on the fly.

JoeChapman commented 2 years ago

Hi @YuriGal I'm doing some work to update this repo, I'll address your issue. Thanks for your interest

JoeChapman commented 2 years ago

@YuriGal I have added the g element function.

YuriGal commented 2 years ago

@JoeChapman thanks! Really appreciate the work you put into it.

JoeChapman commented 2 years ago

No problem @YuriGal but I still need to publish new version to NPM. I am resurrecting this project.

JoeChapman commented 2 years ago

1.1.0 published to npm @YuriGal. Please let me know if it still requires fixes