maplibre-native
maplibre-native copied to clipboard
Increase map tilt to 85 degrees
Is your feature request related to a problem? Please describe. Current tilt limitation (60 degrees) does not allow to see a full perspective without zooming out. Mapbox doesn't have such a limitation.
Describe the solution you'd like Remove tilt limitation.
Describe alternatives you've considered Keep as is
Additional context Add any other context or screenshots about the feature request here.
We increased the maximum allowed value in MapLibre GL JS.
@wipfli I searched for an issue / PR but couldn't find one. Do you know what it was changed to?
I think the trick is to look for "pitch" and not for "tilt"
https://github.com/maplibre/maplibre-gl-js/pull/574
I tried to set it to 85 by changing constexpr double PITCH_MAX = M_PI / 3;
to constexpr double PITCH_MAX = 1.4835; // 85 degrees
for testing in https://github.com/maplibre/maplibre-native/blob/27cd95337156b1cd6268165273d6147535e50244/include/mbgl/util/constants.hpp#L35C39-L35C39
I was still not able to tilt with gesture, then I found if (fabs(fingerSlopeAngle) < MLNHorizontalTiltToleranceDegrees && fabs(gestureSlopeAngle) > 60.0 )
in https://github.com/maplibre/maplibre-native/blob/27cd95337156b1cd6268165273d6147535e50244/platform/ios/src/MLNMapView.mm#L2641C9-L2641C9
Changing it to if (fabs(fingerSlopeAngle) < MLNHorizontalTiltToleranceDegrees && fabs(gestureSlopeAngle) > mbgl::util::rad2deg(mbgl::util::PITCH_MAX) )
made it possible to tilt further, but the map rendering at around 70 degrees is breaking.
Would anyone happen to have an idea on how to proceed?