diff --git a/CHANGELOG.md b/CHANGELOG.md index 6bc5582bf..0dc6dae23 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Bugfixes - fix(lv_scr_load_anim) fix when multiple screen are loaded at tsame time with delay +- fix(page) fix LV_SCOLLBAR_MODE_DRAG ## v7.8.0 (01.12.2020) diff --git a/src/lv_widgets/lv_page.c b/src/lv_widgets/lv_page.c index 2400dccd3..936537c0a 100644 --- a/src/lv_widgets/lv_page.c +++ b/src/lv_widgets/lv_page.c @@ -1250,8 +1250,22 @@ static void scrlbar_refresh(lv_obj_t * page) (scrl_w + bg_left + bg_right - obj_w), obj_h - sb_width - sb_bottom); - if(ext->scrlbar.mode == LV_SCROLLBAR_MODE_AUTO || - ext->scrlbar.mode == LV_SCROLLBAR_MODE_DRAG) ext->scrlbar.hor_draw = 1; + if(ext->scrlbar.mode == LV_SCROLLBAR_MODE_AUTO) ext->scrlbar.hor_draw = 1; + else if(ext->scrlbar.mode == LV_SCROLLBAR_MODE_DRAG) { + lv_indev_t * indev = lv_indev_get_next(NULL); + while(indev) { + if(indev->driver.type == LV_INDEV_TYPE_POINTER && (indev->proc.types.pointer.drag_dir & LV_DRAG_DIR_HOR)) { + lv_obj_t * drag_obj = indev->proc.types.pointer.act_obj; + while(drag_obj && drag_obj->drag_parent) drag_obj = lv_obj_get_parent(drag_obj); + + if(drag_obj && drag_obj == scrl) { + ext->scrlbar.hor_draw = 1; + break; + } + } + indev = lv_indev_get_next(indev); + } + } } /*Full sized vertical scroll bar*/ @@ -1275,8 +1289,22 @@ static void scrlbar_refresh(lv_obj_t * page) (obj_h - size_tmp - 2 * sb_ver_pad)) / (scrl_h + bg_top + bg_bottom - obj_h)); - if(ext->scrlbar.mode == LV_SCROLLBAR_MODE_AUTO || - ext->scrlbar.mode == LV_SCROLLBAR_MODE_DRAG) ext->scrlbar.ver_draw = 1; + if(ext->scrlbar.mode == LV_SCROLLBAR_MODE_AUTO) ext->scrlbar.ver_draw = 1; + else if(ext->scrlbar.mode == LV_SCROLLBAR_MODE_DRAG) { + lv_indev_t * indev = lv_indev_get_next(NULL); + while(indev) { + if(indev->driver.type == LV_INDEV_TYPE_POINTER && (indev->proc.types.pointer.drag_dir & LV_DRAG_DIR_VER)) { + lv_obj_t * drag_obj = indev->proc.types.pointer.act_obj; + while(drag_obj && drag_obj->drag_parent) drag_obj = lv_obj_get_parent(drag_obj); + + if(drag_obj && drag_obj == scrl) { + ext->scrlbar.ver_draw = 1; + break; + } + } + indev = lv_indev_get_next(indev); + } + } } /*Invalidate the new scrollbar areas*/