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

feat(indev): detect double and triple click (closes #6020) #6187

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

niklasf
Copy link
Contributor

@niklasf niklasf commented May 6, 2024

This is a first attempt at detecting double and triple clicks (#6020). It's basically working but needs documentation and testing. I have some questions before proceding:

  • Should LV_EVENT_SHORT_CLICKED, LV_EVENT_DOUBLE_CLICKED, and LV_EVENT_TRIPLE_CLICKED be separate events, or should there be something like int lv_event_get_short_click_streak(lv_event_t*)?
  • Should short/double/triple click be mutually exclusive, or is every double/triple click also a short click?

@kisvegabor
Copy link
Member

Should LV_EVENT_SHORT_CLICKED, LV_EVENT_DOUBLE_CLICKED, and LV_EVENT_TRIPLE_CLICKED be separate events, or should there be something like int lv_event_get_short_click_streak(lv_event_t*)?

These should be separate events to allow easily adding a generic callback to an event.

Should short/double/triple click be mutually exclusive, or is every double/triple click also a short click?

Good question. On web on double click two onclick events are fired. I think we should follow the same principle. Adding LV_EVENT_SINGLE_CLICKED might make sense though.

cc @XuNeo

@XuNeo
Copy link
Collaborator

XuNeo commented May 9, 2024

The clicked event should be fired the first time of a double or triple click. The second and third click can be eliminated because now you know for sure it's a double click.

However, following with standard web behavior is also recommended.

Similar for the double click event inside of a triple click. It should also be fired as soon as it's detected.

@kisvegabor
Copy link
Member

The clicked event should be fired the first time of a double or triple click. The second and third click can be eliminated because now you know for sure it's a double click.
However, following with standard web behavior is also recommended.

I think adding LV_EVENT_SINGLE_CLICKED, and firing LV_EVENT_CLICKED three times on triple click would be a good solution.

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

Successfully merging this pull request may close these issues.

None yet

3 participants