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

Expose name and default position of current style #6127

Merged
merged 2 commits into from
Aug 24, 2016
Merged

Conversation

1ec5
Copy link
Contributor

@1ec5 1ec5 commented Aug 23, 2016

This is a followup to #6002 that exposes the current style’s name and makes -[MGLMapView resetPosition] reset to the style’s default viewport rather than the SDK default.

/cc @friedbunny

@1ec5 1ec5 added feature iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS runtime styling labels Aug 23, 2016
@1ec5 1ec5 added this to the ios-v3.4.0 milestone Aug 23, 2016
@1ec5 1ec5 self-assigned this Aug 23, 2016
@1ec5
Copy link
Contributor Author

1ec5 commented Aug 23, 2016

I punted on jumping to the style’s default viewport on initialization, because the style may take an indeterminate amount of time to load. Would it be desirable to jump to that position as soon as the style finishes loading? We’d need to avoid clobbering any developer- or user-initiated viewport modifications. The same complications would arise if we were to respect the style’s default viewport when switching styles.

@jfirebaugh
Copy link
Contributor

Would it be desirable to jump to that position as soon as the style finishes loading? We’d need to avoid clobbering any developer- or user-initiated viewport modifications.

That's the behavior of GL JS. My preference would be to implement this behavior in core.

@1ec5
Copy link
Contributor Author

1ec5 commented Aug 23, 2016

Split out #6129 to consider jumping to the default viewport on initialization.

camera.altitude = MGLAltitudeForZoomLevel(0, 0, 0, self.frame.size);
self.camera = camera;
CGFloat pitch = _mbglMap->getDefaultPitch();
CLLocationDirection heading = mbgl::util::wrap(_mbglMap->getDefaultBearing(), 0., 360.);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like studio wraps bearings. Do we do this since we don't know where the style will actually come from? (just curious)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, we can’t assume the style was authored in Studio. Alternatively, we could establish a convention that mbgl::Map wraps the return values of getDefeaultBearing() and getBearing(), but we can tackle that separately from this PR.

@boundsj
Copy link
Contributor

boundsj commented Aug 24, 2016

👍

@1ec5 1ec5 merged commit 2523f33 into master Aug 24, 2016
@1ec5 1ec5 deleted the 1ec5-style-default-6002 branch August 24, 2016 18:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS runtime styling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants