-
Notifications
You must be signed in to change notification settings - Fork 1.3k
MGLMapCamera(lookingAtCenter:, fromDistance:, pitch:, heading:) is not respecting content insets properly. #12728
Comments
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. |
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. |
This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions. |
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. |
The change is implemented in TransformState::getProjMatrix, the rest of the code is making sure that existing API contracts stay and there are tests verifyingrendering and render query processing only items within screen and given tolerance around screen edges. MapView: don't bake edge insets into relalculated camera center. Keep edge insets as property of camera in TransformState (similar to pitch, zoom, bearing) independent from specified camera center. Interpolate edge insets in animation. iOS Demo app: "Turn On/Off Content Insets" pitch the camera and navigate to convenient location in Denver, where streets are parallel to cardinal directions, to illustrate viewport center offset when edge insets are set. Tests: ViewFrustumCulling: although Annotations are deprecated, queryRenderedFeatures related tests in Annotations would need to get ported and decided to add the edge insets related query tests next to them. Verify frustum culling (render+queryRenderedFeatures) With different camera and edge insets setups. TODO: port Annotations tests. Transform.Padding: Verify that coordinates take proper place on screen after applying edge insets. LocalGlyphRasterizer: verify text rendering when applying padding. Related to #11882: both use projection matrix elements [8] and [9]. Alternative approach to this was to increase and offset map origin so that the screen would be a sub-rectangle in larger map viewport. This approach has a drawback of unecessary processing the items that are outside screen area. Fixes #12107, #12728, navigation-sdks/issues/120
This is fixed in #14664. |
The change is implemented in TransformState::getProjMatrix, the rest of the code is making sure that existing API contracts stay and there are tests verifyingrendering and render query processing only items within screen and given tolerance around screen edges. MapView: don't bake edge insets into relalculated camera center. Keep edge insets as property of camera in TransformState (similar to pitch, zoom, bearing) independent from specified camera center. Interpolate edge insets in animation. iOS Demo app: "Turn On/Off Content Insets" pitch the camera and navigate to convenient location in Denver, where streets are parallel to cardinal directions, to illustrate viewport center offset when edge insets are set. Tests: ViewFrustumCulling: although Annotations are deprecated, queryRenderedFeatures related tests in Annotations would need to get ported and decided to add the edge insets related query tests next to them. Verify frustum culling (render+queryRenderedFeatures) With different camera and edge insets setups. TODO: port Annotations tests. Transform.Padding: Verify that coordinates take proper place on screen after applying edge insets. LocalGlyphRasterizer: verify text rendering when applying padding. Related to #11882: both use projection matrix elements [8] and [9]. Alternative approach to this was to increase and offset map origin so that the screen would be a sub-rectangle in larger map viewport. This approach has a drawback of unecessary processing the items that are outside screen area. Fixes #12107, #12728, navigation-sdks/issues/120
The change is implemented in TransformState::getProjMatrix, the rest of the code is making sure that existing API contracts stay and there are tests verifyingrendering and render query processing only items within screen and given tolerance around screen edges. MapView: don't bake edge insets into relalculated camera center. Keep edge insets as property of camera in TransformState (similar to pitch, zoom, bearing) independent from specified camera center. Interpolate edge insets in animation. iOS Demo app: "Turn On/Off Content Insets" pitch the camera and navigate to convenient location in Denver, where streets are parallel to cardinal directions, to illustrate viewport center offset when edge insets are set. Tests: ViewFrustumCulling: although Annotations are deprecated, queryRenderedFeatures related tests in Annotations would need to get ported and decided to add the edge insets related query tests next to them. Verify frustum culling (render+queryRenderedFeatures) With different camera and edge insets setups. TODO: port Annotations tests. Transform.Padding: Verify that coordinates take proper place on screen after applying edge insets. LocalGlyphRasterizer: verify text rendering when applying padding. Related to #11882: both use projection matrix elements [8] and [9]. Alternative approach to this was to increase and offset map origin so that the screen would be a sub-rectangle in larger map viewport. This approach has a drawback of unecessary processing the items that are outside screen area. Fixes #12107, #12728, navigation-sdks/issues/120
Steps to reproduce
fly(to: newCamera, withDuration: 1.25, completionHandler: nil)
with the new cameraExpected behavior
Configuration
Mapbox SDK versions:
![img_02c88c9455d2-1](https://user-images.githubusercontent.com/9848525/44544264-fe728200-a711-11e8-8220-7b5c938744d7.jpeg)
4.2.0
iOS/macOS versions:
11.4.1 (15G77)
Device/simulator models:
iPhone 6s+ in Landscape
Xcode version:
9.4.1 (9F2000)
The text was updated successfully, but these errors were encountered: