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

Docs: Be more explicit on the dragStartPredicate return #544

Open
karmaral opened this issue Feb 23, 2023 · 2 comments
Open

Docs: Be more explicit on the dragStartPredicate return #544

karmaral opened this issue Feb 23, 2023 · 2 comments
Labels

Comments

@karmaral
Copy link

Hello!
The docs could be more explicit in regards to the return type of dragStartPredicate.
Currently it says

..it will be called until you return true or false.

I only realized this was implying that not returning true or false would re-run the function by examining the touch delay example.

Looking back I see there's just empty returns on the examples, but for at-a-glance reads, perhaps it would add value to have it more explicitly defined in the description.

Could be something as simple as highlighting until.

Do you agree? Or is it too fine grained?

@niklasramo
Copy link
Collaborator

Reading the docs again I think it indeed makes sense to emphasize that. Maybe something like this?

If you provide a function you can customize the drag start logic as you please. When the user starts to drag an item this predicate function will be called on every pointer/touch/mousemove event until you return true or false. If you return true the item will begin to move whenever the item is dragged. If you return false the item will not be moved at all. You should return undefined if you want to keep the predicate in "pending" state. Note that after you have returned true or false this function will not be called until the item is released and dragged again.

@karmaral
Copy link
Author

karmaral commented Mar 2, 2023

Yeah, that's much clearer!

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

No branches or pull requests

2 participants