From 22854ff3fba236f50893221805c9cc4d378baaca Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Wed, 18 May 2022 12:03:37 +0200 Subject: [PATCH] fix(tabview, tileview): fix scrolling The issue was introduced by 777fe1ea. It sends SCOLL_END event even when there is no scroll aniamtion --- src/extra/widgets/tabview/lv_tabview.c | 5 +++++ src/extra/widgets/tileview/lv_tileview.c | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/src/extra/widgets/tabview/lv_tabview.c b/src/extra/widgets/tabview/lv_tabview.c index c825a144e..90ac0e7dc 100755 --- a/src/extra/widgets/tabview/lv_tabview.c +++ b/src/extra/widgets/tabview/lv_tabview.c @@ -308,6 +308,11 @@ static void cont_scroll_end_event_cb(lv_event_t * e) lv_tabview_set_act(tv, lv_tabview_get_tab_act(tv), LV_ANIM_OFF); } else if(code == LV_EVENT_SCROLL_END) { + lv_indev_t * indev = lv_indev_get_act(); + if(indev && indev->proc.state == LV_INDEV_STATE_PRESSED) { + return; + } + lv_point_t p; lv_obj_get_scroll_end(cont, &p); diff --git a/src/extra/widgets/tileview/lv_tileview.c b/src/extra/widgets/tileview/lv_tileview.c index 4f98b552a..17fdb519a 100644 --- a/src/extra/widgets/tileview/lv_tileview.c +++ b/src/extra/widgets/tileview/lv_tileview.c @@ -7,6 +7,7 @@ * INCLUDES *********************/ #include "lv_tileview.h" +#include "../../../core/lv_indev.h" #if LV_USE_TILEVIEW /********************* @@ -157,6 +158,11 @@ static void tileview_event_cb(lv_event_t * e) lv_tileview_t * tv = (lv_tileview_t *) obj; if(code == LV_EVENT_SCROLL_END) { + lv_indev_t * indev = lv_indev_get_act(); + if(indev && indev->proc.state == LV_INDEV_STATE_PRESSED) { + return; + } + lv_coord_t w = lv_obj_get_content_width(obj); lv_coord_t h = lv_obj_get_content_height(obj);