Fix #114557: UI scrollbar "focus bubble" interaction wrong in cases
Some Editors like the Filebrowser or Spreadsheet set up custom masks for scrollbars (they dont cover the whole region width or height, some rows or colums are excluded here -- e.g. the "index" column in the Spreadsheet), this was working fine for drawing, but mouse interaction was ignoring these custom masks. Symptoms were that clicking on the "focus bubble" of the scrollbar and dragging would not result in smooth scrolling [because internally code would assume the mouse was clicking outside], instead scroll by 1 'page' was happening [was perceived as a massive lag]. Especially noticable with many rows/columns (where the "focus bubble" gets small). So for drawing (`UI_view2d_scrollers_draw`) this wasnt a problem, masks were passed in for `view2d_scrollers_calc`. But for interaction (`scroller_activate_init`) `view2d_scrollers_calc` is called again and a NULL mask was passed. The already set up rects need to be considered though, otherwise coords for `mouse_in_scroller_handle` later are not compatible. To fix this, use existing `View2D` rects fors scrollbars, and pass a union of those as `mask_custom` to `view2d_scrollers_calc`. NOTE: this can temporarily extend the `View2D` scrollbar rect by a pixel, the next draw call will correct this again though. Pull Request: https://projects.blender.org/blender/blender/pulls/114631
This commit is contained in:
committed by
Philipp Oeser
parent
a4b8d214c6
commit
ed556113ce
@@ -1906,7 +1906,12 @@ static void scroller_activate_init(bContext *C,
|
||||
* - zooming must be allowed on this axis, otherwise, default to pan
|
||||
*/
|
||||
View2DScrollers scrollers;
|
||||
view2d_scrollers_calc(v2d, nullptr, &scrollers);
|
||||
/* Some Editors like the Filebrowser or Spreadsheet already set up custom masks for scrollbars
|
||||
* (they dont cover the whole region width or height), these need to be considered, otherwise
|
||||
* coords for `mouse_in_scroller_handle` later are not compatible. */
|
||||
rcti scroller_mask = v2d->hor;
|
||||
BLI_rcti_union(&scroller_mask, &v2d->vert);
|
||||
view2d_scrollers_calc(v2d, &scroller_mask, &scrollers);
|
||||
|
||||
/* Use a union of 'cur' & 'tot' in case the current view is far outside 'tot'. In this cases
|
||||
* moving the scroll bars has far too little effect and the view can get stuck #31476. */
|
||||
|
||||
Reference in New Issue
Block a user