You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
MGLMapCamera(lookingAtCenter:, fromDistance:, pitch:, heading:) is not respecting content insets properly. #12728
Set the content insets with a high (but not invalid) right inset. I tested it with a right inset of 370 in landscape mode.
Use MGLMapCamera(lookingAtCenter:, fromDistance:, pitch:, heading:) to create a new camera looking at some coordinate. I used distance 1840, pitch 60, heading 184.
Call fly(to: newCamera, withDuration: 1.25, completionHandler: nil) with the new camera
Expected behavior
The center coordinate is located in the center of the area of the view minus the insets
The pitch is set correctly
The distance is set correctly
A marker oriented into a special direction put right at the center coordinate should point up. In other words: The vanishing point should be located right above the new center coordinate, but it is still located in the center of the view, even though the content insets are set properly. (please see the image below. I also added text to the two crosses)
ScreenCoordinate center = getScreenCoordinate(padding);
center.y = state.size.height - center.y;
However, I think the problem you’ve identified is that the vanishing point is always located at the center-top of the view. Core GL doesn’t offer any way to move the vanishing point; ultimately, edge insets are implemented by changing the frame of reference for a center coordinate.
The workaround in @Gerungofulus’s case is to reduce the map view’s width to avoid the area taken up by the right panel. This only works because the right panel appears to be opaque and takes up the whole right side of the map view.
In cases where the panel is translucent or doesn’t extend to the top and bottom edges of the window, a rather unsatisfying workaround would be to extend the map view further to the left, beyond the left edge of the containing view, until the vanishing point shifts sufficiently to the left.
In cases where the panel is translucent or doesn’t extend to the top and bottom edges of the window, a rather unsatisfying workaround would be to extend the map view further to the left, beyond the left edge of the containing view, until the vanishing point shifts sufficiently to the left.
This is the rather unsatisfying workaround we’ve settled on in the navigation SDK’s CarPlay integration: mapbox/mapbox-navigation-ios#1845.
However, I think the problem you’ve identified is that the vanishing point is always located at the center-top of the view. Core GL doesn’t offer any way to move the vanishing point; ultimately, edge insets are implemented by changing the frame of reference for a center coordinate.
Configuring the vanishing point is an important feature for navigation use cases. It’s common for landscape layouts to overlay a large sidebar that doesn’t completely obscure the map but does shift the horizontal center visually.
In cases where the panel is translucent or doesn’t extend to the top and bottom edges of the window, a rather unsatisfying workaround would be to extend the map view further to the left, beyond the left edge of the containing view, until the vanishing point shifts sufficiently to the left.
This is the rather unsatisfying workaround we’ve settled on in the navigation SDK’s CarPlay integration: mapbox/mapbox-navigation-ios#1845.
This is fixed in #14664.
It's waiting for review.
Note that current "workaround" should keep functioning as intended after the PR #14664 lands - if navigation-ios is just enlarging the view and offsetting it.
If MGLMapView.contentInset is specified, center of perspective, and the user puck, will always be centered in the center of content area specified by contentInset; vanishing point would be above it.
Activity
1ec5 commentedon Sep 13, 2018
fly(to:withDuration:completionHandler:)does seem to apply the content insets:mapbox-gl-native/platform/macos/src/MGLMapView.mm
Line 1205 in f1aa869
mapbox-gl-native/platform/macos/src/MGLMapView.mm
Line 1215 in f1aa869
mapbox-gl-native/src/mbgl/map/transform.cpp
Lines 182 to 183 in f1aa869
However, I think the problem you’ve identified is that the vanishing point is always located at the center-top of the view. Core GL doesn’t offer any way to move the vanishing point; ultimately, edge insets are implemented by changing the frame of reference for a center coordinate.
/cc @ansis @brunoabinader @d-prukop
1ec5 commentedon Sep 13, 2018
The workaround in @Gerungofulus’s case is to reduce the map view’s width to avoid the area taken up by the right panel. This only works because the right panel appears to be opaque and takes up the whole right side of the map view.
In cases where the panel is translucent or doesn’t extend to the top and bottom edges of the window, a rather unsatisfying workaround would be to extend the map view further to the left, beyond the left edge of the containing view, until the vanishing point shifts sufficiently to the left.
stale commentedon Mar 12, 2019
This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.
1ec5 commentedon Mar 22, 2019
This is the rather unsatisfying workaround we’ve settled on in the navigation SDK’s CarPlay integration: mapbox/mapbox-navigation-ios#1845.
Configuring the vanishing point is an important feature for navigation use cases. It’s common for landscape layouts to overlay a large sidebar that doesn’t completely obscure the map but does shift the horizontal center visually.
[core] Offset viewport center when edge insets are specified
astojilj commentedon May 23, 2019
This is fixed in #14664.
It's waiting for review.
Note that current "workaround" should keep functioning as intended after the PR #14664 lands - if navigation-ios is just enlarging the view and offsetting it.
If MGLMapView.contentInset is specified, center of perspective, and the user puck, will always be centered in the center of content area specified by contentInset; vanishing point would be above it.
[core] Offset viewport center when edge insets are specified