-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Refactored constraints within MGLMapView #1328
Conversation
The existing Visual Format Language usage necessitated various ternaries and over-wide lines that made the code harder to grok. Now it’s just plain ol’ Objective-C, mostly column-80-compliant. This change also adds additional constraint relations so that the various subviews respect the `MGLView`’s frame when it’s smaller than the view controller’s root view. Fixes #1327.
No need to set the frames manually since we set up constraints as soon as the `MGLMapView` is added to the view hierarchy. Set proper edge insets on the logo bug rather than fudging constraint constants.
9b8b072 ignores whitespace in the logo during layout. The only visual difference is that the logo’s left margin and the ℹ️’s right margin are now equal: @incanus, I very much wanted to fix #1265 as part of this PR, but I think your proposed solution would be worse than what we have now, due to an optical illusion. I tried vertically aligning the centers of the logo (sans whitespace) and ℹ️, which happens to be the same as aligning the p’s descender with the bottom of the ℹ️. But the logo now appears to be cocked upward, as if the tops of both views were aligned (they aren’t): |
Use leading/trailing instead of left/right for subview constraints for eventual right-to-left flippedness.
You knew this was coming, but ... care to merge/test against |
Added an accessibility label to the user dot.
Verify that the ornaments hug the `MGLMapView` when it’s smaller than the view controller’s root view.
To counteract the call to `-insetMapView` in `-testInsetMapView`.
Refactored constraints within MGLMapView
This PR cleans up
MGLMapView
’s internal constraints:NSLayoutConstraint
-building (clearer logic, shorter lines)MGLView
’s frame when it’s smaller than the view controller’s root view (fixes iOS: 🐶s hug screen layout guides even when view is smaller than screen #1327)MGLMapView
to its bounds (fixes User location dot appears outside MGLMapView #1300)That last change has the side-effect that callouts no longer draw outside the map’s bounds. That was either a bug or a feature. If we want to keep that capability, we’d need to clip subviews individually (so that the user dot could half-appear rather than hang halfway off the map) and hide callouts’ anchor triangles when they’d point somewhere outside the map.
/cc @incanus