mapbox / mapbox-gl-native

Interactive, thoroughly customizable maps in native Android, iOS, macOS, Node.js, and Qt applications, powered by vector tiles and OpenGL
https://mapbox.com/mobile
Other
4.36k stars 1.33k forks source link

Add a factor to limit tilt when offset value is important #16448

Closed philemonmerlet closed 4 years ago

philemonmerlet commented 4 years ago

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 :

As a result, the view depth is too far away :

Capture d’écran 2020-04-29 à 19 27 14

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). Capture d’écran 2020-04-29 à 19 34 43

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 !

philemonmerlet commented 4 years ago

Other related issue : https://github.com/mapbox/mapbox-gl-native-android/issues/282

stale[bot] commented 4 years ago

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.