Release geolocation camera lock on zoom#7909
Conversation
|
Can you try and see if you can find the cause that this test was added and the origin decision as to way the state was not changed to background for zoom, as the code suggests this is intentional and I want to see if we can understand why. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7909 +/- ##
==========================================
- Coverage 93.21% 93.19% -0.02%
==========================================
Files 290 290
Lines 24656 24656
Branches 6484 6484
==========================================
- Hits 22983 22979 -4
- Misses 1673 1677 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@HarelM I did some research and found this:
The question is: how should we proceed? My preference would be to release the lock when zooming. Panning and zooming are closely related and often combined, so having them produce different outcomes may be confusing. On mobile devices, it is also difficult to zoom without introducing some panning. Also, currently, a combined pan-and-zoom gesture does not release the lock (which leaves the location dot not in the middle of the screen). We should make our own decision here, but for comparison: Mapbox does release the lock when the user zooms. |
|
Another solution would be to preserve the current zoom level when the user re-enables the lock. So, when the state transitions from |
|
Maybe we can introduce a flag to support both behaviors? IDK. As you can read from the linked issue I think zoom should release lock, but I think @tderflinger disagrees, and I can respect that. Regarding keeping the zoom that an option as well. Let's wait for @tderflinger response before we proceed. |
|
Thanks @HarelM. For me the change by @timsluis is fine if that is what the majority of users want. Maybe asking real-world users of MapLibre about this behavior and their expectations would make sense. For me, keeping a flag would be beneficial if users are split about the behavior and like to have both options available to them. |
|
@HarelM A small custom geolocation control might indeed be the best solution if someone wants custom behavior. Do still you still use the MapLibre geolocation events? Or is it fully custom? About this solution: the current implementation fights the map user by zooming back after the user tries to zoom. So I think any of both is better than what we have now. I might have a slight preference for locking on the current zoom level now. However, that would be a bigger change. |
|
As I said in the original issue, I think you should look to what most popular mapping apps on the platform do. That is what users will expect. |
|
I've added it to the monthly meeting agenda, feel free to join in and share your thoughts! |
Fixes #7908.
When
GeolocateControlwas configured withtrackUserLocation: true, manually panning the map released the active camera lock, while manually zooming did not.The PR ensures that zooming releases the active camera lock, just like panning, by transitioning the control from
ACTIVE_LOCKtoBACKGROUND.Launch Checklist
CHANGELOG.mdunder the## mainsection.Assisted-By: Codex (GPT-5)