diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-11-07 10:14:21 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-11-07 10:19:46 +0300 |
commit | 767a39572772a5252a993159aa4d9eb64bf936b6 (patch) | |
tree | a62f0d9c73cdeb73772a7459f11ab1052077a124 /source/blender/editors/interface/view2d.c | |
parent | 0bd61227c246a488bd06b76fba213c44448379c7 (diff) |
Fix redraws from non-existing scrollbars
Cursor motion was often causing redraws.
Distance to scrollbars that don't exist in hidden regions
caused redraws (for alpha fading).
Check if scrollbars are used before calculating fade.
Diffstat (limited to 'source/blender/editors/interface/view2d.c')
-rw-r--r-- | source/blender/editors/interface/view2d.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index 20ca492c8d1..72f5a75904b 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -2429,16 +2429,20 @@ void UI_view2d_offset(struct View2D *v2d, float xfac, float yfac) * Check if mouse is within scrollers * * \param x, y: Mouse coordinates in screen (not region) space. + * \param r_scroll: Mapped view2d scroll flag. * * \return appropriate code for match. * - 'h' = in horizontal scroller. * - 'v' = in vertical scroller. * - 0 = not in scroller. */ -short UI_view2d_mouse_in_scrollers(const ARegion *ar, View2D *v2d, int x, int y) +char UI_view2d_mouse_in_scrollers_ex( + const ARegion *ar, View2D *v2d, int x, int y, + int *r_scroll) { int co[2]; int scroll = view2d_scroll_mapped(v2d->scroll); + *r_scroll = scroll; /* clamp x,y to region-coordinates first */ co[0] = x - ar->winrct.xmin; @@ -2456,6 +2460,13 @@ short UI_view2d_mouse_in_scrollers(const ARegion *ar, View2D *v2d, int x, int y) return 0; } +char UI_view2d_mouse_in_scrollers( + const ARegion *ar, View2D *v2d, int x, int y) +{ + int scroll_dummy = 0; + return UI_view2d_mouse_in_scrollers_ex(ar, v2d, x, y, &scroll_dummy); +} + /* ******************* view2d text drawing cache ******************** */ typedef struct View2DString { |