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

[LVGL] Two little problems about gesture event #597

Closed
liriyao opened this issue Oct 18, 2024 · 8 comments
Closed

[LVGL] Two little problems about gesture event #597

liriyao opened this issue Oct 18, 2024 · 8 comments
Assignees
Milestone

Comments

@liriyao
Copy link

liriyao commented Oct 18, 2024

  1. gesture event is too easy to trigger .
    Less than 20 pixels will trigger gesture event and i don't find any place to change the length myself
  2. When first click on an obj and try to trigger gesture event , the obj press event will trigger too.
    I wanted to do the same thing as a gesture swipe on a phone. It is anyone slove the same problem or any suggestions. Thanks
@mvladic
Copy link
Contributor

mvladic commented Oct 18, 2024

In lv_indev_t * indev there is gesture_limit and gesture_min_velocity fileds. They are initialized with these values:

/*Gesture threshold in pixels*/
#define LV_INDEV_DEF_GESTURE_LIMIT        50

/*Gesture min velocity at release before swipe (pixels)*/
#define LV_INDEV_DEF_GESTURE_MIN_VELOCITY 3

You can't change these fields if you include <lvgl/lvgl.h>, but you can include <lvgl/lvgl_private.h>.

@mvladic
Copy link
Contributor

mvladic commented Oct 18, 2024

When first click on an obj and try to trigger gesture event , the obj press event will trigger too.
I wanted to do the same thing as a gesture swipe on a phone. It is anyone slove the same problem or any suggestions. Thanks

Do not use PRESSED event of the button, use CLICKED.

@liriyao
Copy link
Author

liriyao commented Oct 18, 2024

When first click on an obj and try to trigger gesture event , the obj press event will trigger too.
I wanted to do the same thing as a gesture swipe on a phone. It is anyone slove the same problem or any suggestions. Thanks

Do not use PRESSED event of the button, use CLICKED.

CLICKED don't help . i will trigger too

In lv_indev_t * indev there is gesture_limit and gesture_min_velocity fileds. They are initialized with these values:

/*Gesture threshold in pixels*/
#define LV_INDEV_DEF_GESTURE_LIMIT        50

/*Gesture min velocity at release before swipe (pixels)*/
#define LV_INDEV_DEF_GESTURE_MIN_VELOCITY 3

You can't change these fields if you include <lvgl/lvgl.h>, but you can include <lvgl/lvgl_private.h>.

i will try this one . thanks for your reply

@mvladic
Copy link
Contributor

mvladic commented Oct 18, 2024

CLICKED don't help . i will trigger too

I found this LVGL issue: lvgl/lvgl#3211. It is suggested to call lv_indev_wait_release(lv_indev_active()); in gesture event handler to prevent CLICKED.

If you are using LVGL project without EEZ Flow you can just make this call in your event handler for the gesture event.

If you are using EEZ Flow then currently there is no way to do this. We can add call to lv_indev_wait_release for the GESTURE event always but I'm not sure this is always desirable.

@mvladic
Copy link
Contributor

mvladic commented Oct 18, 2024

If you are using EEZ Flow then currently there is no way to do this. We can add call to lv_indev_wait_release for the GESTURE event always but I'm not sure this is always desirable.

I just tested this. I modified EEZ Flow engine to call lv_indev_wait_release(lv_indev_active()) on GESTURE event and here is the result:

gesture_clicked

test_gesture_and_button.zip

@mvladic
Copy link
Contributor

mvladic commented Oct 18, 2024

Maybe we should indeed add this in the EEZ Flow engine. Why would anyone want CLICKED event when GESTURE is also detected?

mvladic added a commit that referenced this issue Oct 18, 2024
@mvladic
Copy link
Contributor

mvladic commented Oct 18, 2024

Implemented.

I added lv_indev_wait_release(lv_indev_active()); in the GESTURE event handler when EEZ Flow is used. This is now committed in the master branch of Studio.

@liriyao
Copy link
Author

liriyao commented Oct 18, 2024

I added lv_indev_wait_release(lv_indev_active()); in the GESTURE event handler when EEZ Flow is used. This is now committed in the master branch of Studio.

I will update my code and try. it help a lot when the screen got a lot of obj,but need to do slide to change screen. thanks

@mvladic mvladic changed the title Two little problems about gesture event [LVGL] Two little problems about gesture event Oct 18, 2024
@mvladic mvladic added this to the 0.19.0 milestone Oct 31, 2024
@mvladic mvladic closed this as completed Nov 4, 2024
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