Important: unclear posts may not receive useful answers.
Before posting
- Get familiar with Markdown to format and structure your post
- Be sure to update lvgl from the latest version from the
master
branch.- Be sure you have checked the FAQ and read the relevant part of the documentation.
- If applicable use the Simulator to eliminate hardware related issues.
Delete this section if you read and applied the mentioned points.
Description
What MCU/Processor/Board and compiler are you using?
BES2700BP
What LVGL version are you using?
v8.3
What do you want to achieve?
Scroll propagation in multi-layer Flex layouts to parent objects.
What have you tried so far?
Analyze the implementation of the lv_indev_find_scroll_obj
function.
Code to reproduce
Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.
The code block(s) should be formatted like:
lv_obj_t * lv_indev_find_scroll_obj(lv_indev_t * indev)
{
...
/*Vertical scroll*/
snap_cnt = 0;
int32_t st = 0;
int32_t sb = 0;
lv_scroll_snap_t snap_y = lv_obj_get_scroll_snap_y(obj_act);
if(snap_y != LV_SCROLL_SNAP_NONE) {
uint32_t child_cnt = lv_obj_get_child_count(obj_act);
uint32_t i;
for(i = 0; i < child_cnt; i++) {
if(lv_obj_has_flag(lv_obj_get_child(obj_act, i), LV_OBJ_FLAG_SNAPPABLE)) {
snap_cnt++;
if(snap_cnt == 2) {
st = 1; /*Assume scrolling*/
sb = 1;
break;
}
}
}
}
if(snap_y == LV_SCROLL_SNAP_NONE || snap_cnt < 2) {
st = lv_obj_get_scroll_top(obj_act);
sb = lv_obj_get_scroll_bottom(obj_act);
}
/*If this object is scrollable into the current scroll direction then save it as a candidate.
*It's important only to be scrollable on the current axis (hor/ver) because if the scroll
*is propagated to this object it can show at least elastic scroll effect.
*But if not hor/ver scrollable do not scroll it at all (so it's not a good candidate)*/
if((st > 0 || sb > 0) &&
((up_en && obj_scroll_sum.y >= scroll_limit) ||
(down_en && obj_scroll_sum.y <= - scroll_limit))) {
obj_candidate = obj_act;
dir_candidate = LV_DIR_VER;
}
...
if(st <= 0) up_en = false;
if(sb <= 0) down_en = false;
if(sl <= 0) left_en = false;
if(sr <= 0) right_en = false;
...
/*Try the parent*/
obj_act = lv_obj_get_parent(obj_act);
...
}
Screenshot and/or video
If possible, add screenshots and/or videos about the current state.