clickTolerance for draggable markers
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
Motivation
Clicking without moving the mouse at all is hard. For this reason, tiny pointer movements while down on marker should be treated as clicks not drags. In other words, markers should have a clickTolerance option similar to the map.
I considered posting this as a bug report, but since some design decisions are involved, I made it a feature. Here's a jsfiddle with a minimal example: https://jsfiddle.net/cchudzicki/q0bg7r18/11/
// example fiddle console log:
pointer down
pointer down and moving
marker dragstart
(x12): pointer down and moving
pointer up
marker dragend: pointer moved: 0.800018310546875
map click
Design Alternatives
I see three possibilities:
- Use map's
clickToleranceas the marker `clickTolerance. Anything below will this will be treated as a click not a drag. - Have separate
clickTolerancesfor each marker and for the map AND use the default marker tolerance as some specific value, e.g., "3px" - Have separate
clickTolerancesfor each marker and for the map AND set the default marker tolerance to match map tolerance.
Design
I believe we should implement Option 2 or 3, though I lean toward 3 because users probably want the same drag tolerance throughout their app.
Mock-Up and Concepts
Just add a clickTolerance option for markers.
Implementation
I am looking into this, but imagine something similar to how the map drag threshold works.
See related discussion: https://github.com/mapbox/mapbox-gl-js/issues/9624
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 reading the map drag threshold implementation and the related discussion in issue #9624. Define how marker movement below and above the tolerance should be classified, then verify that small movements remain clicks while larger movements trigger marker dragging.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- frontend, web-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100