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

[ios] Added 2 new mid alignment position in MGLAnnotationVerticalAlignment #11342

Closed
wants to merge 3 commits into from

Conversation

iDevid
Copy link

@iDevid iDevid commented Feb 28, 2018

Added MidBottom and MidTop MGLAnnotationVerticalAlignment.

@iDevid iDevid changed the title [ios] Added 2 new MGLAnnotationVerticalAlignment [ios] Added 2 new mid alignment position in MGLAnnotationVerticalAlignment Feb 28, 2018
@tobrun tobrun added iOS Mapbox Maps SDK for iOS ✓ ready for review labels Mar 1, 2018
@iDevid
Copy link
Author

iDevid commented Mar 5, 2018

@anandthakker

@1ec5 1ec5 added annotations Annotations on iOS and macOS or markers on Android and removed ✓ ready for review labels Mar 5, 2018
@1ec5
Copy link
Contributor

1ec5 commented Mar 5, 2018

Hi @iDevid, can you describe your use case, so that we can better understand what you’re trying to accomplish?

@iDevid
Copy link
Author

iDevid commented Mar 5, 2018

I wanted to align the user annotation in the middle between the center of the frame and the bottom/top of the frame.
schermata 2018-03-05 alle 23 14 11
schermata 2018-03-05 alle 23 14 40

@iDevid
Copy link
Author

iDevid commented Mar 6, 2018

@1ec5

@1ec5
Copy link
Contributor

1ec5 commented Mar 7, 2018

Have you considered changing the map view’s contentInsets property instead?

@iDevid
Copy link
Author

iDevid commented Mar 8, 2018

@1ec5 of course, but when following the user, sometimes the map glitches and the insets goes back to default (I think because there is verticalAlignment center by default)

@iDevid
Copy link
Author

iDevid commented Mar 13, 2018

As seen in the video, while following the user with contentInset, it will get restored to .center
ScreenRecording_03-13-2018 17-38-12.MP4.zip

@iDevid
Copy link
Author

iDevid commented Mar 14, 2018

@1ec5
Copy link
Contributor

1ec5 commented Mar 21, 2018

As seen in the video, while following the user with contentInset, it will get restored to .center

That looks like unintended behavior. Perhaps we can address the issue you’re seeing without adding the API surface area. Would you mind opening a separate issue about it? If the problem only occurs with certain settings or when setting insets at a particular time, please note that in the ticket. Thanks!

@iDevid
Copy link
Author

iDevid commented Jun 22, 2018

UP

@1ec5
Copy link
Contributor

1ec5 commented Jun 22, 2018

First of all, thank you for taking the time to propose these changes. I agree that the user puck’s default positioning isn’t ideal for every application, but I don’t think we’re going to want to add these halfway alignment values. The user puck is supposed to respect the map view’s content inset. Following #7716, it should respect the containing view controller’s layout guides, and following #12147, it’ll also respect the safe area.

If there are bugs in how the map view interacts with content insets, layout guides, or the safe area, I suspect #6566 has something to do with it. Please open a new issue about it with a reproducible test case.

Ultimately, it was a mistake for us to expose something as simplistic as MGLAnnotationVerticalAlignment. #12203 would supplant this enumeration with a delegate method, which you could use to decide exactly where on screen you want the user puck (and the camera’s focal point) to appear.

Feel free to open a new PR for either the design in #12203 or a different design that gives developers more control over the exact positioning.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
annotations Annotations on iOS and macOS or markers on Android iOS Mapbox Maps SDK for iOS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants