Feature request: `group(id)` constructor for SVG.G
jango-fx opened this issue · 5 comments
jango-fx commented
Feature request: group(id)
constructor for SVG.G
to my mind a <g>
tag's main attribute is its id
(just like the width
and height
of a rect
) and I would expect it to be set similarly intuitively during construction. Without a cumbersome additional call of .attr('id', 'ID')
.
so instead of
let theGroup = draw.group()
theGroup.attr('id', 'myGroupID')
simply
let theGroup = draw.group("myGroupID")
to get
<svg>
<g id="myGroupID">
</g>
</svg>
(love your lib though ❤️ )
Fuzzyma commented
The constructor always takes the dimensions of the object. Since g don't have dimensions itself they don't take an argument.
But you can always pass an object with attributes: canvas.group({ id })
jango-fx commented
arr, I still don't find that very intuitive, but I might bow to your consistency 😜
Fuzzyma commented
haha, and I thought intuity comes from consistency :D
jango-fx commented
The constructor always takes the dimensions of the object
not true for SVG.text()
though 🤨