mapbox / mapbox/mapbox-maps-android

Mapbox 11 breaks cameraForCoordinates

Aperta
#2,268 12 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

auto-triaged bug :beetle:
Lingua principale
Kotlin
Stelle
578
Fork
161
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

## Environment

- Android OS version: 13
- Devices affected: Samsung Tab Active4 Pro
- Maps SDK Version: 11.0.0, 11.1.0, 11.2.0-beta.1, 11.2.0

## Observed behavior and steps to reproduce
`cameraForCoordinates` gives zoom levels that are too zoomed out outside of 45 degree rotation increments.

We underlay a mapbox map to fit coordinates given the lat lon of the topLeft and bottomRight of the screen.
```
map.setCamera(
map.cameraForCoordinates(
listOf(fromLngLat(topLeft.x, topLeft.y), fromLngLat(bottomRight.x, bottomRight.y)),
EdgeInsets(0.0, 0.0, 0.0, 0.0),
Math.toDegrees(renderer.rotation),
0.0
)
)
```
This only works when the rotation in degrees % 45 == 0. Outside of this the returned zoom from `cameraForCoordinates` is too zoomed out.

https://github.com/mapbox/mapbox-maps-android/assets/7464462/2068a31d-946c-499e-b3b5-a3968ed36c37

## Expected behavior
The yellow always aligns with the map (as it does at 45 degree rotation increments).
This is what happens in Mapbox 10.

## Notes / preliminary analysis
Must be somehow fitting a rectangle of the wrong rotation in somewhere to get this effect.
The returned centre is fine, only the zoom returned by `cameraForCoordinates` is wrong.
Add tests outside 45 degree increments.

## Additional links and references
Regression from Mapbox 10 (code is the same, broken after updating to 11).

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia dall’implementazione di cameraForCoordinates e dai test esistenti nel codice di Mapbox Maps SDK Android. Riproduci il problema usando rotazioni diverse da incrementi di 45 gradi e confronta lo zoom restituito con il comportamento di Mapbox 10. Aggiungi la copertura per queste rotazioni e considera completato l’issue quando la camera calcolata mantiene allineate le coordinate senza uno zoom indietro eccessivo.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
android, kotlin
Ambito
mobile
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.