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

clickTolerance for draggable markers #9636

Open
ChristopherChudzicki opened this issue Apr 27, 2020 · 2 comments
Open

clickTolerance for draggable markers #9636

ChristopherChudzicki opened this issue Apr 27, 2020 · 2 comments

Comments

@ChristopherChudzicki
Copy link
Contributor

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:

  1. Use map's clickTolerance as the marker `clickTolerance. Anything below will this will be treated as a click not a drag.
  2. Have separate clickTolerances for each marker and for the map AND use the default marker tolerance as some specific value, e.g., "3px"
  3. Have separate clickTolerances for 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: #9624

@ChristopherChudzicki
Copy link
Contributor Author

@ryanhamley Made a separate ticket as you suggested in #9624.

I am definitely interested in making a PR for this. I got the tests running and am digging into the code now. Cool excuse to try flow again 😄

@ryanhamley
Copy link
Contributor

Awesome, thanks! Let us know if you run into any issues that could use some clarification

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants