How to calculate "height" of an SVG? #10278
Unanswered
bitttttten
asked this question in
Q&A
Replies: 2 comments 1 reply
-
the myPath._getTransformedDimensions() should give you a correct size for bounding box of the object. |
Beta Was this translation helpful? Give feedback.
1 reply
-
可以通过使用创建js Image对象,之后使用load获取图形高度和宽度信息。 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We have an SVG like this:
Running it through
loadSVGFromString
gives us an object with width: 29 and height 0. This makes sense since the path has no height, it is using the default stroke width of 1.You can see in this example: https://jsfiddle.net/e6vwtx1k/4/ the height is 0, strokeWidth is 1.
In short I am looking for a way to "edit" the "height" of an element, and this is where I am stuck. I understand I can sometimes do
height*scaleY
to get the relative height in the canvas. However how do I manage a svg path like this?Beta Was this translation helpful? Give feedback.
All reactions