mapbox / mapbox/mapbox-maps-android
Unintentional jump may still occur even after left the follow viewport state
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Kotlin
- Sterne
- 578
- Forks
- 161
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
## Observed behavior and steps to reproduce
Sometimes, the location puck will jump to the map center even I pan the map to leave the follow viewport state.
This can occur more easily, if you set the bearing of FollowPuckViewportStateOptions to a constant value, and test in indoor environment where there is no GPS signal available. When switched to the follow state, just after the location puck moved to the map center, pan the map to leave the follow state. The location puck may jump to the map center after a while.
## Expected behavior
The location puck should not jump to the map center after left the follow viewport state.
## Notes / preliminary analysis
It seems that FollowPuckViewportStateImpl.removeIndicatorListenerIfNeeded may not run successfully sometimes, as dataSourceUpdateObservers is not empty. This may occur as DefaultViewportTransitionImpl does not remove its observer immediately after the transition completed. Currently, it relies on FollowPuckViewportStateImpl to remove the observer on next notifyViewportStateDataObserver.
To solve the issue, may make the following change to DefaultViewportTransitionImpl:
```
var keepObserving = true
+ var observeCancelable: Cancelable? = null
```
```
completionListener.onComplete(!isCanceled)
+ observeCancelable?.cancel()
```
```
+ observeCancelable = cancelable
return Cancelable {
```
It seems that the iOS version has similar logic.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, FollowPuckViewportStateImpl.removeIndicatorListenerIfNeeded und DefaultViewportTransitionImpl zu verfolgen, wobei du dich auf dataSourceUpdateObservers und den Listener für den Abschluss des Übergangs konzentrierst. Reproduziere das Szenario mit Follow-Status, Schwenken und ohne GPS und überprüfe anschließend, dass das Verlassen des Follow-Status jeden späteren Sprung zur Kartenmitte verhindert; vergleiche bei Bedarf die entsprechende iOS-Logik.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- kotlin
- Bereich
- mobile
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 42/100