[Bf-blender-cvs] [06585e0b133] master: UI: popovers scroll now changes offset directly

Campbell Barton noreply at git.blender.org
Thu Mar 21 01:43:20 CET 2019


Commit: 06585e0b133f1e94f0042d5f42da5810ebce4682
Author: Campbell Barton
Date:   Thu Mar 21 11:37:44 2019 +1100
Branches: master
https://developer.blender.org/rB06585e0b133f1e94f0042d5f42da5810ebce4682

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

===================================================================

M	source/blender/editors/interface/interface_handlers.c

===================================================================

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)) {



More information about the Bf-blender-cvs mailing list