Mapbox-gl-native: Allow compass visibility customization

Created on 20 Jul 2017  路  7Comments  路  Source: mapbox/mapbox-gl-native

Our users love the compass and want to have it visible all the time. I have added an parameter, compassAlwaysVisible to MGLMapView in our branch that fixes this.

mapView.compassAlwaysVisible = YES;

Would it make sense to have this as an standard option i Mapbox GL Native? Do you want this minor thing as a pull-request?

MapKit parity feature iOS

Most helpful comment

MapKit is adding this feature in iOS 11 via a separate MKCompassButton, which includes a compassVisibility enum with adaptive, hidden, and visible options. That鈥檚 a nice approach.

In terms of our existing compass setup, I think it鈥檇 be better to add a visibility property on -[MGLMapView.compassView] with similar options.

All 7 comments

Hi @halset. Thank you for asking. Even if this is a small change most of our users don't expect the compass to be displayed unless required. If we make this change it will require them to adjust their code.

I have compassAlwaysVisible set to NO by default, so users would not need to change anything.

MapKit is adding this feature in iOS 11 via a separate MKCompassButton, which includes a compassVisibility enum with adaptive, hidden, and visible options. That鈥檚 a nice approach.

In terms of our existing compass setup, I think it鈥檇 be better to add a visibility property on -[MGLMapView.compassView] with similar options.

This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

@friedbunny

  • Should there be a new MGLCompassView class instead of the existing UIImageView for MGLMapView.compassView? Or should we just add a MGLMapView.compassVisibility
  • What is a good name for the visibility enum? VisibilityType is already present, but should probably not be expanded with an adaptive-variant. Translating MKFeatureVisibility to MGLFeatureVisibility is probably not the best as feature is something else? Perhaps MGLVisibility or would that be mixed up with VisibilityType?

@chloekraw I changed the title again, as my current intention is to implement adaptive, hidden, and visible options, which is more flexible than a single option to show-the-compass-even-when-it鈥檚-facing-north.

Oh, @friedbunny, I think I had the tab open and changed the title without refreshing the page, so I didn't know that you had already changed it. I meant to override the original title, not yours!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ksinghal picture ksinghal  路  3Comments

klblk picture klblk  路  4Comments

brunoabinader picture brunoabinader  路  4Comments

LukasPaczos picture LukasPaczos  路  3Comments

melihcolpan picture melihcolpan  路  3Comments