-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: apple bounding box (CGPathGetPathBoundingBox) #2177
Conversation
cc @msand Since you have laid out the initial work for this. |
Pinging this as this is the only reason I need to maintain a fork and build expo apps. |
@omeid can you rebase your branch to main? |
@bohdanprog Done! |
Friendly ping this so that it doesn't go out of sync again. @jakex7 |
Hey @omeid, thanks for the PR! The code looks good to me, but I'm not entirely sure what issue it's resolving. Could you provide some examples of code that doesn't work currently and how it's improved after the fix? 😄 |
@jakex7 Currently calling On Android, it is wrongly scaled. If you want, I can create a snack later. |
@omeid sorry for the late response. I was able to test this PR, and It seems the scaling issue was introduced in this commit: f3e0b190a917c8f1ddc6a19ccd47563ad6c1ca59. Should we consider removing the scaling from other related areas as well? Additionally, could you please split this into two separate PRs since they address different aspects? |
Thanks for the review @jakex7, I will have to test the other methods as I didn't have a need for them, I will create a separate PR for that along with any other changes that might be required for the scaling on Android. |
Once this is merged, I will create another PR for the Android side. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀 Thank you!
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 in Firefox some years ago 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
will create a follow up PR. Currently getBBox on Android doesn't account for scaling properly.
Checklist
README.md
__tests__
folder