GenerallyHelpfulSoftware / SVGgh

A framework for using SVG artwork in iOS Apps. Includes a UIView and a button class, printing and PDF export.
MIT License
142 stars 37 forks source link

Fixed `getBoundingBox` methods always returning x: 0, y: 0 rects #31

Closed ryanholden8 closed 7 years ago

ryanholden8 commented 7 years ago

When using the getBoundingBox methods I noticed it was always returning a rect that had a x: 0, y: 0.
This was due to using CGRectZero instead of CGRectNull in conjunction with CGRectUnion for the result variable.
CGRectIsNull is used to check the result so my guess is CGRectIsNull was always intended to be the initial value for the result variable.

ryanholden8 commented 6 years ago

Looks like this is happening again on iOS 12 too.. investigating a fix :)

ryanholden8 commented 6 years ago

Seems related: https://forums.developer.apple.com/thread/108631

grhowes commented 6 years ago

Thanks. It’s too bad this was not caught when iOS 12 was still in beta.

--glenn Sent from my iPhone

On Oct 10, 2018, at 10:39 AM, Ryan Holden notifications@github.com wrote:

Seems related: https://forums.developer.apple.com/thread/108631

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or mute the thread.

ryanholden8 commented 6 years ago

Discovered that deleting this line fixes the issue. Which is in line with the bug described in the link above where consecutive MoveToPoint calls are no longer compressed in iOS 12. My guess is that iOS 12, with it's goal of efficiency, is no longer tracking consecutive MoveToPoint calls internally and is rather putting that burden on the producer of the calls. Unfortunately, deleting that line also caused a few (small) rendering bugs on 3 SVGs we have.