react-native-svg
react-native-svg copied to clipboard
fix bbox as per spec
Summary
As per the spec, bbox should not include any transformations, including scaling. It should also not include any control points. This fixes getBBox to give correct results matching Google Chrome, Firefox as per the spec.
-
What issues does the pull request solve? Please tag them so that they will get automatically closed once the PR is merged
-
What is the feature? (if applicable) Bug fix.
-
How did you implement the solution? Like this, see.
-
What areas of the library does it impact? getBBox API.
Test Plan
I build some stuff that works with SVG, the results on web were inconsistent, and digging down I realise it was a react-native-svg.
Some fun fact, there was a surprisingly similar bug related to very confusing named (CGPathGetBoundingBox vs CGPathGetPathBoundingBox) APIs as well. https://bugzilla.mozilla.org/show_bug.cgi?id=1369904
What's required for testing (prerequisites)?
What are the steps to reproduce (after prerequisites)?
Compatibility
OS | Implemented |
---|---|
iOS | ✅ |
Android | ✅ |
Web | 🔘 * |
- Depends on the host platform. But works fine in major browsers.
Checklist
- [x] I have tested this on a device and a simulator
- [x] I added documentation in
README.md
- [x] I updated the typed files (typescript)
- [x] I added a test for the API in the
__tests__
folder