-
Thank you for drawSVG, I use it a lot! Is there a way to get the dimensions from a draw.Group? I like to place different groups on the canvas in a specific orientation. After creating each group in its one zero-point, I want to transform/translate them to a specific position on the canvas. Without the width and height, this is difficult. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Not with drawSvg. drawSvg does not understand the sizes of shapes, it only allows you to put them together into an SVG. It sounds like if you add shapes to the group positioned so (0, 0) is the center, you may not need to calculate the bounding box (width and height). In general it is better to manually calculate the intended size so you aren't surprised by things like an over-full text field unexpectedly changing the final position. If you do really want to find the bounding box, CairoSVG may be able approximate it. See #25 for a discussion and code related to this. |
Beta Was this translation helpful? Give feedback.
Not with drawSvg. drawSvg does not understand the sizes of shapes, it only allows you to put them together into an SVG.
It sounds like if you add shapes to the group positioned so (0, 0) is the center, you may not need to calculate the bounding box (width and height). In general it is better to manually calculate the intended size so you aren't surprised by things like an over-full text field unexpectedly changing the final position.
If you do really want to find the bounding box, CairoSVG may be able approximate it. See #25 for a discussion and code related to this.