Resize path
See original GitHub issueExample (a simple dot):
<Svg style={{width: 110, height: 110}} viewbox="0 0 22 22">
<Path d="M11,0C4.926,0,0,4.926,0,11s4.926,11,11,11s11-4.926,11-11S17.074,0,11,0z" />
</Svg>
Same:
<Svg width={110} height={110} viewbox="0 0 22 22">
<Path d="M11,0C4.926,0,0,4.926,0,11s4.926,11,11,11s11-4.926,11-11S17.074,0,11,0z" />
</Svg>
Only the canvas got resized - not the dot.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:8
- Comments:20
Top Results From Across the Web
Resizing Paths The Easy Way - Planet Photoshop
When you're working with paths, you can visually resize your path by using the Path Selection tool. To do this, press A to...
Read more >RESIZING PATHS THE EASY WAY | Greased Lightnin
When you're using the Pen tool, you can visually resize your path by using the Path Selection tool. To do this, go up...
Read more >Resizing path of svg group - Stack Overflow
Resizing path of svg group ... I would like to resize path around 20 pixels. SVG should be same size of 500 *...
Read more >Edit paths in Adobe Photoshop
Select the path name in the Paths panel, and use the Path Selection tool to select the path in the image. To select...
Read more >5.4. Transforming Paths
Each of the Transform tools (Rotate, Scale, Perspective, etc) can be set to act on a layer, selection, or path. Select the transform...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I too ran into this issue and it appears to only be on Android. We use viewBox and it just doesn’t work. The paths are NOT re-rendered when width/height props are updated. I added a console.log in there and I do see the render method being called with then new props, but either React or the android native SVG library refuses to re-render the component.
Here is what it looked like before my hacky fix which android would crop the image: and then after my fix:
So how did I do it, by tracking size of the component and using a scale transform on android like this:
Just to make sure, the viewbox dimensions should be the original dimensions of the shape.