UI: Add scroll to sidebar tabs #105355
|
@ -206,12 +206,12 @@ static int view_pan_exec(bContext *C, wmOperator *op)
|
|||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
guishe marked this conversation as resolved
|
||||
inline bool mouse_in_category_tab(const ARegion *region, const wmEvent *event)
|
||||
bool mouse_in_category_tab(const ARegion *region, const wmEvent *event)
|
||||
guishe marked this conversation as resolved
Outdated
Julian Eisel
commented
I don't see a point in using I don't see a point in using `inline` here, this is not a performance sensitive code path, so I rather don't optimize prematurely and let the compiler figure things out.
|
||||
{
|
||||
if (event == nullptr) {
|
||||
return false;
|
||||
}
|
||||
const int mvalx = event->mval[0];
|
||||
const int mvalx = event->xy[0] - region->winrct.xmin;
|
||||
if (region->runtime.category && !BLI_listbase_is_empty(®ion->panels_category)) {
|
||||
const PanelCategoryDyn *pc_dyn = static_cast<PanelCategoryDyn *>(
|
||||
region->panels_category.first);
|
||||
|
@ -509,8 +509,8 @@ static int view_scrolldown_exec(bContext *C, wmOperator *op)
|
|||
return OPERATOR_PASS_THROUGH;
|
||||
}
|
||||
|
||||
wmWindow *win = CTX_wm_window(C);
|
||||
wmEvent *event = win->event_last_handled;
|
||||
const wmWindow *win = CTX_wm_window(C);
|
||||
const wmEvent *event = win->eventstate;
|
||||
guishe marked this conversation as resolved
Outdated
Campbell Barton
commented
Use Use `win->eventstate`, `win->event_last_handled` is intended for event handling logic and not to be used by interface logic. Updated the doc-string to note this 09ba0210d9a19a2713fa0f92cf5f54914789c62f.
Guillermo Venegas
commented
Solved, the problem I had is that Solved, the problem I had is that `mval` is not assigned in `win->eventstate` for 'Wheel Up/Down' events.
|
||||
vpd->do_category_scroll = mouse_in_category_tab(vpd->region, event);
|
||||
|
||||
/* set RNA-Props */
|
||||
|
@ -560,8 +560,8 @@ static int view_scrollup_exec(bContext *C, wmOperator *op)
|
|||
return OPERATOR_PASS_THROUGH;
|
||||
}
|
||||
|
||||
wmWindow *win = CTX_wm_window(C);
|
||||
wmEvent *event = win->event_last_handled;
|
||||
const wmWindow *win = CTX_wm_window(C);
|
||||
const wmEvent *event = win->eventstate;
|
||||
vpd->do_category_scroll = mouse_in_category_tab(vpd->region, event);
|
||||
|
||||
/* set RNA-Props */
|
||||
|
|
Loading…
Reference in New Issue
Use
ED_region_panel_category_gutter_isect_xy
or add a new public utility function toarea_query.c
if existing functions cannot be used - with an explanation for how it differs from existing intersection checking functions.It works, can I just assume that
win->eventstate
is never null?Yes, you can assume it's never NULL (the doc-string should be updated to note this).