any SVG wizards here?
I'm having a problem, & I'm not sure how to fix it, & i just cannot find anything on
https://developer.mozilla.org/en-US/docs/Web/SVG
to help.
essentially I want to center a <g> within a larger <SVG> but the <g> is randomly generated so I do not know how wide it will be.
because of the platform its to go on, I can't use any outside scripts or JS or CSS/<div> etc.
help? nm see reply
{edit} glitch project for anyone who wants to poke it
( https://glitch.com/edit/#!/draft-inkle-pattern-generator-draft )
@Alien_Sunset
Speaking as an unemployed Linux-monkey, have you considered 300 lines of undocumented sed?
Or - better yet - one 3,000 character line of undocumented awk?
@Alien_Sunset
sed 's/undocumented/minified/g'
...there, much more professional!
@Alien_Sunset If you say it's randomly generated, what level of control do you have?
As in: do you know the value of the root's height and width attribute? It's viewBox?
What goes into the g element?
Trying to understand the scope a little better.
(I build web games in SVG as side projects)
@Alien_Sunset i learned SVG before there was much in the way of tooling so I'd do it with perl, but I'm guessing that's not the best answer nowadays. Maybe some kind of inkscape script? I don't even know if you can run those without opening the whole application gui, though?
@Alien_Sunset How much control do you have over the CSS itself? Can you edit it before it reaches the platform? Can you add `<style>` inside the SVG?
@Alien_Sunset hmm, thats indeed tricky! weird idea: do you have access to the svg header? maybe you can put a script tag in there that centers your group?
@Alien_Sunset does transform-origin: center work? it sounds like it should do the thing that you want but I'm getting an error on glitch so I can't see if it will work or not
https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/transform-origin