This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
Add a factor to limit tilt when offset value is important #16448
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With an important tilt, when using a top padding to offset the map center, like in GPS apps, currently the view depth becomes very far away, and the apps become very laggy (unusable on Android devices).
PR #15195 limits the depth, but this is far from enough.
As described in mapbox/mapbox-gl-native-android#162 , from the demo sample :
As a result, the view depth is too far away :
By adding a factor of 2.4 (value to be discussed) to the top offset when calculating the maximum tilt for a specified inset, the depth is less far away and the behavior is much more reasonable, allowing to use the app without lag while maintaining a view depth similar as when there is no padding, and also similar as what we had before the padding behavior was changed (post Android 7.4 release).
Note that on this particular screen, the resulting max tilt is approximately 45 degrees, which could be set manually using the MapboxMapOptions. However, this means the value would be set even when padding values do not need it (what about landscape mode ?). Also I think the current behavior looks like a bug, and users should not have to dig into mapbox issues to find this workaround.
Regards !