New event: "user movement"
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
## Motivation
I've had a few instances where we want to keep track of whether the map's location has been moved by the user. As long as the user hasn't moved it, we want to control the map's location some other way (following an object, for instance). But as soon as the user moves the map, we want to defer to their choice.
It's not that easy right now. There are a few different events that unambiguously indicate a user movement: `dragstart`, `rotatestart`, `boxzoomstart`, `wheel`.
However, there are a few that are ambiguous: `zoomstart`, `movestart`
There isn't a simple unambiguous event fired by the user clicking on the +/- zoom buttons, for instance. (`NavigationControl` doesn't seem to emit events.) So a strategy of simply listening for every possible user interaction directly doesn't work.
There are workarounds (like, passing eventdata to each movement that we *do* initiate, and checking for its absence). But, a bit fiddly. It's still difficult to detect the difference between say mapbox-gl-geocoder firing a movement (because we can't set eventdata there), vs a user movement.
## Design Alternatives
Another options might be if the map itself tracks whether its most recent movement was user-initiated.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the existing map event handling and the NavigationControl entry point, with attention to dragstart, rotatestart, boxzoomstart, wheel, zoomstart, and movestart. Clarify how user-initiated movement should be distinguished from programmatic movement, including zoom-button actions and geocoder movement. Done means the design is settled and the new event reliably communicates user movement.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100