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

The camera follow demo does not stop following on compass ornament or double tap zoom #77

Open
sargunv opened this issue Dec 2, 2024 · 3 comments
Labels
bug Something isn't working help wanted Extra attention is needed upstream This issue can't be resolved until an upstream issue is resolved

Comments

@sargunv
Copy link
Owner

sargunv commented Dec 2, 2024

Since #76 the camera follow demo stops following when any gesture happens, but the double tap zoom gesture doesn't trigger this. Neither does the compass. It seems both are considered "programmatic" rather than gestures? Would be useful to differentiate between built in programmatic and public API programmatic.

Affects both Android and iOS.

@sargunv sargunv added bug Something isn't working android Affects Android in particular, or relates to Android specific code ios Affects iOS in particular, or relates to iOS specific code help wanted Extra attention is needed labels Dec 2, 2024
@sargunv sargunv changed the title The camera follow demo does not stop following on double tap zoom The camera follow demo does not stop following on double tap zoom or compass tap Dec 2, 2024
@sargunv sargunv removed android Affects Android in particular, or relates to Android specific code ios Affects iOS in particular, or relates to iOS specific code labels Dec 15, 2024
@sargunv sargunv changed the title The camera follow demo does not stop following on double tap zoom or compass tap The camera follow demo does not stop following on double tap zoom Dec 24, 2024
@sargunv
Copy link
Owner Author

sargunv commented Dec 24, 2024

material compass part fixed in #179

double tap and SDK compass is still outstanding

@sargunv sargunv changed the title The camera follow demo does not stop following on double tap zoom The camera follow demo does not stop following on compass ornament or double tap zoom Dec 31, 2024
@sargunv sargunv added the upstream This issue can't be resolved until an upstream issue is resolved label Dec 31, 2024
@michalgwo
Copy link
Contributor

I noticed that when the camera follow animation is run, the move reason is programmatic, but when it's not, the move reason is a gesture. It may be because of the execution of cameraState.animateTo() every few hundred milliseconds, which overrides the double tap gesture (see: maplibre/maplibre-native#2790). I limited cameraState.animateTo() executions to 1 per second and the move reason was correctly detected as a gesture.

I'm not sure if it's important, but I also noticed that when the camera follow animation is run and I tap on the map without moving it, it detects it as a programmatic camera movement (double tap, detects 2 programmatic camera movements), but when I tap on the map when there is no animation, it doesn't detect any camera movement.

As for differentiation between the developer's and API's programmatic reasons for camera movement, it seems to be a bug in Maplibre, and it was an issue before the fork on Mapbox (see: mapbox/mapbox-gl-native#10674 (comment))

As a workaround for the demo, we can stop the animation on zoom changes, but it's not a real solution, so probably not a good option.

@sargunv
Copy link
Owner Author

sargunv commented Feb 1, 2025

Yup. We're limited by what the SDK provide here. Calling animateTo so frequently doesn't even work properly on JS.

I'm hoping to solve this by moving the gestures implementation fully into this library. We'll need to reimplement gestures anyway for desktop native, so if we make that common code I hope we can solve this and also get better integration with Compose gesture interop APIs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed upstream This issue can't be resolved until an upstream issue is resolved
Projects
None yet
Development

No branches or pull requests

2 participants