diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-03-21 03:37:44 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-03-21 03:37:44 +0300 |
commit | 06585e0b133f1e94f0042d5f42da5810ebce4682 (patch) | |
tree | 5d9c9fb4e7acac688ba94da6c8d580aee5df4842 /source/blender/editors/interface/interface_handlers.c | |
parent | 83753d1d29ceaa5dbd77200efaeb8993d59f396e (diff) |
UI: popovers scroll now changes offset directly
Mouse wheel on menus changes the selected item item which doesn't work
well for popovers since buttons aren't always stacked vertically.
Resolves T62777
Diffstat (limited to 'source/blender/editors/interface/interface_handlers.c')
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index c7a02e0ef15..d07dba851da 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -8922,10 +8922,38 @@ static int ui_handle_menu_event( retval = WM_UI_HANDLER_BREAK; break; - case UPARROWKEY: - case DOWNARROWKEY: case WHEELUPMOUSE: case WHEELDOWNMOUSE: + { + if (IS_EVENT_MOD(event, shift, ctrl, alt, oskey)) { + /* pass */ + } + else if (!ui_block_is_menu(block)) { + int my_scroll = INT_MAX; + if (event->type == WHEELUPMOUSE) { + if (block->flag & UI_BLOCK_CLIPTOP) { + my_scroll = block->rect.ymax + (UI_UNIT_Y * 1.5); + } + } + else if (event->type == WHEELDOWNMOUSE) { + if (block->flag & UI_BLOCK_CLIPBOTTOM) { + my_scroll = block->rect.ymin - (UI_UNIT_Y * 1.5); + } + } + if (my_scroll != INT_MAX) { + if (but) { + but->active->cancel = true; + button_activate_exit(C, but, but->active, false, false); + } + ui_menu_scroll_to_y(ar, block, my_scroll); + WM_event_add_mousemove(C); + } + break; + } + ATTR_FALLTHROUGH; + } + case UPARROWKEY: + case DOWNARROWKEY: case MOUSEPAN: /* arrowkeys: only handle for block_loop blocks */ if (IS_EVENT_MOD(event, shift, ctrl, alt, oskey)) { |