Description
Hi, I’m wondering if it’s possible to disable the animation when scrolling using touch. I have successfully removed it when scolling using an encoder by changing this line to LV_ANIM_OFF and the scroll feel is so much better.
What MCU/Processor/Board and compiler are you using?
MCU: nRF5340 together with Zephyr 3.2.99
What LVGL version are you using?
8.2.0
What do you want to achieve?
Smoother scrolling
What have you tried so far?
Searched around and tried modifying various places in the codebase without success.
Code to reproduce
This is the code: ZSWatch/application_manager.c at 877a7c27671d4ab66de2c1371d1add938a6d63fa · jakkra/ZSWatch · GitHub
Unfortunately I have not put this into a standalone sample. I don’t think it’s needed, as this is more of a question.
But this is the core code
lv_obj_t *entry;
static lv_style_t style;
lv_style_init(&style);
lv_style_set_flex_flow(&style, LV_FLEX_FLOW_ROW_WRAP);
lv_style_set_flex_main_place(&style, LV_FLEX_ALIGN_SPACE_EVENLY);
lv_style_set_layout(&style, LV_LAYOUT_FLEX);
lv_obj_set_scrollbar_mode(lv_scr_act(), LV_SCROLLBAR_MODE_OFF);
grid = lv_obj_create(root_obj);
lv_obj_add_style(grid, &style, 0);
lv_obj_set_scrollbar_mode(root_obj, LV_SCROLLBAR_MODE_OFF);
lv_obj_set_style_border_side(grid, LV_BORDER_SIDE_NONE, 0);
lv_obj_set_size(grid, LV_PCT(100), LV_PCT(100));
lv_obj_center(grid);
lv_obj_set_flex_flow(grid, LV_FLEX_FLOW_COLUMN);
lv_obj_set_scroll_dir(grid, LV_DIR_VER);
lv_obj_set_scroll_snap_y(grid, LV_SCROLL_SNAP_CENTER);
lv_obj_set_scrollbar_mode(grid, LV_SCROLLBAR_MODE_OFF);
lv_obj_add_event_cb(grid, scroll_event_cb, LV_EVENT_SCROLL, NULL);
Then I just add entries to this grid
object.
Screenshot and/or video
Long video: This is how scrolling looks and at the end you can also see scrolling with an encoder.
Short video: Here I have added the patch mentioned before about LV_ANIM_OFF and it solves the laggy behaviour when scrolling using an encoder.
I’m after the same behaviour, but when I’m scrolling using touch screen.
Thank you alot!