-
Notifications
You must be signed in to change notification settings - Fork 86
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
Fix mouse drag suppression #26
Fix mouse drag suppression #26
Conversation
You are right. It does not prevent the drag events to be fired. It only suppresses that a click is fired when the drag distance is smaller than Can you describe, what usecase you have where this is important? BTW: Your fix doesn't seem to work. With |
Yeah, I'm fixing that now, sorry. It randomly worked in Dartium, just not chrome :( The issue we are trying to solve is not so much that the click doesn't bubble through (that's working fine) but rather that there's still a visual artifact. Here are some GIFs showing what I'm talking about. Without fixWith fix |
Thanks for the helpful gifs @spencercornish-wk. I've moved parts of your code to
Can you test if this works as expected? |
@dustyholmes-wf You originally added the pull request for #13 to allow configurable |
CHANGELOG.md
Outdated
@@ -1,10 +1,15 @@ | |||
# Changelog | |||
|
|||
## Version 1.4.0 (2018-10-12) | |||
|
|||
- BREAKING CHANGE: Add an option `minDragStartDistance` on `Draggable` to define the minimum distance in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be done without a breaking change by making clickSuppression set minDragStartDistance?
I know within our organization a lot of libraries use this library and it would cause a decent amount of pain if this was released as a breaking change.
I believe this achieves the same concept that I was trying to address in my previous changes, I've always been sad about my variable choice too. I think the change generally looks like a step in the right direction. |
@marcojakob That works great, and is much more elegant than what I came up with. I also agree with @dustyholmes-wf about the breaking change stuff. I do think it looks cleaner as an optional named prop, but if |
Mark `clickSuppression` as deprecated
What do you think about this? I've marked it as /// The minimum distance for a drag to prevent click events.
/// DEPRECATED: Please use [minDragStartDistance] instead.
@deprecated
set clickSuppression(int distance) {
minDragStartDistance = distance;
} Would this work or will it still break your code? Note: The behavior is still a bit different. The drag will not start at all with So, as long as you are not depending on events being fired during a drag in the tiny first movement, it is only a very small visual change. For the first few pixels, the avatar will not show yet. But I think this is mostly how it's intendend and how other (big) libraries and web apps do it. |
That looks good. There is still technically a breaking change since clickSuppression could be read before. I'd suggest a getter too (also deprecated) to protect against the unlikely case that someone was reading that value. Maybe in a test. |
This looks awesome. Thanks so much @marcojakob !! |
Thanks for all the feedback @spencercornish-wk @dustyholmes-wf . Released as v1.4.0 on pub |
We noticed that drag suppression hasn't really been working. This fixes that, by effectively not starting a drag event until the suppression distance has been met. Once the distance has been exceeded, the drag started event is dispatched.
@marcojakob