maplibre-native icon indicating copy to clipboard operation
maplibre-native copied to clipboard

Increase map tilt to 85 degrees

Open mtpdog opened this issue 1 year ago • 5 comments

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.

mtpdog avatar Dec 04 '23 11:12 mtpdog

We increased the maximum allowed value in MapLibre GL JS.

wipfli avatar Dec 05 '23 07:12 wipfli

@wipfli I searched for an issue / PR but couldn't find one. Do you know what it was changed to?

louwers avatar Dec 05 '23 10:12 louwers

I think the trick is to look for "pitch" and not for "tilt"

image

wipfli avatar Dec 05 '23 10:12 wipfli

https://github.com/maplibre/maplibre-gl-js/pull/574

wipfli avatar Dec 05 '23 10:12 wipfli

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?

mindthefish avatar Dec 07 '23 13:12 mindthefish