Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Behavior of Tilt with top padding #162

Closed
philemonmerlet opened this issue Jan 29, 2020 · 4 comments
Closed

Behavior of Tilt with top padding #162

philemonmerlet opened this issue Jan 29, 2020 · 4 comments
Labels

Comments

@philemonmerlet
Copy link

philemonmerlet commented Jan 29, 2020

Reproduced with the demo sample :

  • Add a button on activity_basic_simpe_mapview.xml
    <Button  
        android:id="@+id/simple_map_change_padding"  
        android:layout_width="wrap_content"  
        android:layout_height="wrap_content"  
        android:text="Change padding" />
  • Modify the SimpleMapActivity. At the end of the onCreate, add
    findViewById(R.id.simple_map_change_padding).setOnClickListener(v -> {  
        mapView.getMapAsync(mapboxMap -> {  
            mapboxMap.setPadding(0, (int) (mapView.getMeasuredHeight() * 0.7), 0, 0);  
        });  
    });
  • Launch the sample and open the "Simple map view" activity

  • Zoom a little bit to see New York, and tilt at maximum level

  • Click on the "Change padding" button

Result : The tilt increases a lot, showing very distant tiles. As a result, the map is so slow it is no longer usable

Expected : The tilt should not be changed.

device-2020-01-29-120427

@philemonmerlet
Copy link
Author

Hello, is there any plan to look at the problem ? We need to offset the map center on a tilted map, but I saw here : mapbox/mapbox-gl-native#11624 that the method for this is to use the map padding. As the top padding behavior is broken, it is not possible currently.

@philemonmerlet
Copy link
Author

device-2020-04-22-165542

To be more clear, we need to display a GPS where the user icon is not at the center of the screen, but rather at the bottom. Before (with mapbox 7.4) we used the map padding to achieve this, but now the performances are too low with this method. Maybe we are missing something and there is another way to do this ?

@1ec5
Copy link
Contributor

1ec5 commented Apr 29, 2020

mapbox/mapbox-gl-native#14664 correctly allowed the camera’s focal point to be uncentered. This is important for maintaining an accurate perspective effect in landscape layouts where there’s a large side padding, for instance. Unfortunately, the change did introduce several regressions such as the performance issue you’ve highlighted.

The tilt increases a lot, showing very distant tiles. As a result, the map is so slow it is no longer usable

This issue is tracked upstream in mapbox/mapbox-gl-native#15163. One solution would be to load tiles intended for lower zoom levels further out from the focal point: mapbox/mapbox-gl-native#9037.

We need to offset the map center on a tilted map, but I saw here : mapbox/mapbox-gl-native#11624 that the method for this is to use the map padding.

Conceptually, you want to set the camera such that a particular geographic coordinate is at a particular (uncentered) screen coordinate. It would be great to have an explicit setting for that.

The iOS map SDK has historically had two independent settings, a persistent content inset (called “padding” on Android) and a transient edge padding. You could set a camera with an edge padding as a frame of reference; that padded camera was internally translated into a camera in which the center coordinate is the coordinate at the logical center of the map view.

Offsetting the user location indicator relied on setting the camera with a large enough edge padding to take over the whole view, constraining the indicator to a single pixel towards the center bottom. Unfortunately, this approach also broke in mapbox/mapbox-gl-native#14664, because the transient edge padding was treated as a persistent content inset, affecting the perspective transform: mapbox/mapbox-gl-native#15233.

@stale stale bot added the archived label Nov 2, 2020
@stale
Copy link

stale bot commented Nov 9, 2020

This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

@stale stale bot closed this as completed Nov 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants