diff options
author | Yevgeny Makarov <jenkm> | 2020-02-28 17:58:14 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2020-02-28 18:03:53 +0300 |
commit | fe3ce615287ae8c6fa5694c03a07d8699d7c8aff (patch) | |
tree | fc8b07118c4e916a36a75713eb1712b089d1cc71 /source/blender/editors/interface/interface_handlers.c | |
parent | 0cea9353fdfef4ae736d9894e4f6a0a8cef99619 (diff) |
Fix T65351: visual glitches when scrolling in popovers
Diffstat (limited to 'source/blender/editors/interface/interface_handlers.c')
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 8fc73327432..4183f9226d9 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -9197,24 +9197,27 @@ static char ui_menu_scroll_test(uiBlock *block, int my) static void ui_menu_scroll_apply_offset_y(ARegion *ar, uiBlock *block, float dy) { BLI_assert(dy != 0.0f); - if (dy < 0.0f) { - /* stop at top item, extra 0.5 unit Y makes it snap nicer */ - float ymax = -FLT_MAX; - for (uiBut *bt = block->buttons.first; bt; bt = bt->next) { - ymax = max_ff(ymax, bt->rect.ymax); - } - if (ymax + dy - UI_UNIT_Y * 0.5f < block->rect.ymax - UI_MENU_SCROLL_PAD) { - dy = block->rect.ymax - ymax - UI_MENU_SCROLL_PAD; - } - } - else { - /* stop at bottom item, extra 0.5 unit Y makes it snap nicer */ - float ymin = FLT_MAX; - for (uiBut *bt = block->buttons.first; bt; bt = bt->next) { - ymin = min_ff(ymin, bt->rect.ymin); + + if (ui_block_is_menu(block)) { + if (dy < 0.0f) { + /* Stop at top item, extra 0.5 UI_UNIT_Y makes it snap nicer. */ + float ymax = -FLT_MAX; + for (uiBut *bt = block->buttons.first; bt; bt = bt->next) { + ymax = max_ff(ymax, bt->rect.ymax); + } + if (ymax + dy - UI_UNIT_Y * 0.5f < block->rect.ymax - UI_MENU_SCROLL_PAD) { + dy = block->rect.ymax - ymax - UI_MENU_SCROLL_PAD; + } } - if (ymin + dy + UI_UNIT_Y * 0.5f > block->rect.ymin + UI_MENU_SCROLL_PAD) { - dy = block->rect.ymin - ymin + UI_MENU_SCROLL_PAD; + else { + /* Stop at bottom item, extra 0.5 UI_UNIT_Y makes it snap nicer. */ + float ymin = FLT_MAX; + for (uiBut *bt = block->buttons.first; bt; bt = bt->next) { + ymin = min_ff(ymin, bt->rect.ymin); + } + if (ymin + dy + UI_UNIT_Y * 0.5f > block->rect.ymin + UI_MENU_SCROLL_PAD) { + dy = block->rect.ymin - ymin + UI_MENU_SCROLL_PAD; + } } } |