Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Refactored constraints within MGLMapView #1328

Merged
merged 9 commits into from
Apr 24, 2015
Merged

Conversation

1ec5
Copy link
Contributor

@1ec5 1ec5 commented Apr 22, 2015

This PR cleans up MGLMapView’s internal constraints:

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

1ec5 added 2 commits April 22, 2015 12:45
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.
@1ec5 1ec5 added bug iOS Mapbox Maps SDK for iOS labels Apr 22, 2015
1ec5 added 2 commits April 22, 2015 15:33
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.
@1ec5
Copy link
Contributor Author

1ec5 commented Apr 22, 2015

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:

baselined

@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):

centered

Use leading/trailing instead of left/right for subview constraints for eventual right-to-left flippedness.
@incanus
Copy link
Contributor

incanus commented Apr 24, 2015

You knew this was coming, but ... care to merge/test against master now that tests have landed @1ec5? Also we might want to capture the old failure case here in tests to prevent a regression. I'll also take a look at this.

1ec5 added 4 commits April 24, 2015 09:21
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`.
@1ec5
Copy link
Contributor Author

1ec5 commented Apr 24, 2015

I’ve added tests for #1327 but not #1300. (For the latter, we’d have to mock the user location, ensure that the user dot wanders out of the shrunken MGLMapView, snapshot the root view, and verify that the snapshot image doesn’t include any blueish pixels in the neighborhood of the user dot.)

@1ec5 1ec5 added the 1 - Ready label Apr 24, 2015
incanus added a commit that referenced this pull request Apr 24, 2015
Refactored constraints within MGLMapView
@incanus incanus merged commit 06eabb8 into master Apr 24, 2015
@incanus incanus deleted the 1ec5-constraints-1327 branch April 24, 2015 22:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug iOS Mapbox Maps SDK for iOS
Projects
None yet
2 participants