Closed philemonmerlet closed 4 years ago
Other related issue : https://github.com/mapbox/mapbox-gl-native-android/issues/282
This pull request has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.
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 https://github.com/mapbox/mapbox-gl-native/pull/15195 limits the depth, but this is far from enough.
As described in https://github.com/mapbox/mapbox-gl-native-android/issues/162 , from the demo sample :
Add a button on activity_basic_simpe_mapview.xml
Modify the SimpleMapActivity. At the end of the onCreate, add
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 !