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

Keep slided to unlock #107

Closed
sebasira opened this issue Mar 2, 2020 · 3 comments
Closed

Keep slided to unlock #107

sebasira opened this issue Mar 2, 2020 · 3 comments

Comments

@sebasira
Copy link

sebasira commented Mar 2, 2020

FeatureRequest

I would like to have an attribute so I can set a value of time (maybe milliseconds) to request the button to remain-slided (sorry for my English) so the action would be effective. Or maybe not a time value but an attribute with a default inner time (as the long click).

In other words if I just slide the button it would bump as if it was locked. But if I keep it in the slided position for a time (as a long pressed button) it will unlock and perform the action.

Am I clear? Thank you very much!

@cortinico
Copy link
Owner

Hi @sebasira Thanks for submitting this feature request.

Unfortunately I haven't fully understood your request. Can you provide a real-world scenario or use case?

Generally, I don't think that having a timing attribute is a good idea. Ideally you should be able to achieve what you need only using event handlers.

@sebasira
Copy link
Author

sebasira commented Mar 4, 2020

I agree with you when you say

having a timing attribute is a good idea.

But I was thinking that maybe this behaviour could be encapsulated in this library.

The real-world scenario would be to prevent unwanted slides. I know it's difficult to accidentaly slide a button from one side to another, but in the app I'm developing the Users say they accidentaly do it most of the time. You could think of the requirement as a long-pressed button or the onLongClick event. As a safe-lock for the action.

If the User really wants to perform the actions he would have to slide it, keep it in the slided position and then release. If he just slide it, it would bump as locked.

And about

Ideally you should be able to achieve what you need only using event handlers.

Maybe if you give me some clues I can achieve it. I was thinking on locking the button and release the lock if it remains a certain amount of time on the slided position, but I don't know how I would know how much time it was. That's what I can figure out

@cortinico
Copy link
Owner

Hi @sebasira
Thanks for your explanation, I got your point. I understand your scenario but this looks to me like a real niche use case. I'm afraid but I have to reject this feature request.

As a side note, you can probably achieve this behavior as you suggested:

Maybe if you give me some clues I can achieve it. I was thinking on locking the button and release the lock if it remains a certain amount of time on the slided position, but I don't know how I would know how much time it was. That's what I can figure out
  • Lock the slider
  • Fire an event (you need to create a new eventhandler) when the slider reaches the end
  • For that event you can start a timer that will enable the slider

You should also take care that you invalidate the timer if the user is moving back the slider with the finger (e.g. the user should stay in the area 80% - 100% of the slider for more than X seconds).

I hope I was helpful :)

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

2 participants