Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tracked camera position in camera#onIdle #500

Merged
merged 1 commit into from Feb 12, 2021
Merged

Conversation

n8han
Copy link
Collaborator

@n8han n8han commented Jan 5, 2021

When animating to a new camera position, the final resting position of
the camera is generally not received in a camera#onMove callback. The
latest camera position known to the flutter-mapbox-gl framework and the
underlying mapbox-gl framework is therefore out of sync, until the next
time the camera is moved. This same issue would exist when the camera is
moved with a swipe, but it's less prominent since the camera is not
moving as quickly.

The camera#onIdle callback is a good place to update the camera
position, since it is at rest and no longer moving. This insures that
the framework has an accurate camera position if the client application
requests one from its own onCameraIdle callback, or atany other time
between camera moves.

When animating to a new camera position, the final resting position of
the camera is generally not received in a `camera#onMove` callback. The
latest camera position known to the flutter-mapbox-gl framework and the
underlying mapbox-gl framework is therefore out of sync, until the next
time the camera is moved. This same issue would exist when the camera is
moved with a swipe, but it's less prominent since the camera is not
moving as quickly.

The `camera#onIdle` callback is a good place to update the camera
position, since it is at rest and no longer moving. This insures that
the framework has an accurate camera position if the client application
requests one from its own `onCameraIdle` callback, or atany other time
between camera moves.
@n8han n8han added the bug Something isn't working label Jan 5, 2021
@n8han
Copy link
Collaborator Author

n8han commented Jan 5, 2021

I've implemented the changes for all 3 platforms here since it's mostly copy and paste from the onMove callbacks, but I've only tested the iOS changes.

@tobrun tobrun merged commit 3fe04f8 into master Feb 12, 2021
@tobrun tobrun deleted the CameraIdlePosition branch February 12, 2021 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants