diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2018-04-26 16:25:59 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2018-04-26 16:34:39 +0300 |
commit | a31807ed7c755e65bd244025bd575fd2b183561a (patch) | |
tree | 84bb491d3c68dcd367791d7871a87964b65b948a /source/blender/editors | |
parent | 2fc5f3f37860c0e18cba68a5dbef2bdcf82dc8f8 (diff) |
Reduce size of scrollbars that don't contain scale markings
More changes will follow, this is just an initial tweak.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/include/UI_view2d.h | 7 | ||||
-rw-r--r-- | source/blender/editors/interface/view2d.c | 13 |
2 files changed, 14 insertions, 6 deletions
diff --git a/source/blender/editors/include/UI_view2d.h b/source/blender/editors/include/UI_view2d.h index f6e31e0bd22..65c69c7f287 100644 --- a/source/blender/editors/include/UI_view2d.h +++ b/source/blender/editors/include/UI_view2d.h @@ -103,8 +103,11 @@ enum eView2D_Gridlines { /* ------ Defines for Scrollers ----- */ /* scroller area */ -#define V2D_SCROLL_HEIGHT (0.85f * U.widget_unit) -#define V2D_SCROLL_WIDTH (0.85f * U.widget_unit) +#define V2D_SCROLL_HEIGHT (0.55f * U.widget_unit) +#define V2D_SCROLL_WIDTH (0.55f * U.widget_unit) +/* For scrollers with scale markings (text written onto them) */ +#define V2D_SCROLL_HEIGHT_TEXT (0.85f * U.widget_unit) +#define V2D_SCROLL_WIDTH_TEXT (0.85f * U.widget_unit) /* scroller 'handles' hotspot radius for mouse */ #define V2D_SCROLLER_HANDLE_SIZE (0.6f * U.widget_unit) diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index 375711194a3..10be0b52ba5 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -152,18 +152,23 @@ static void view2d_masks(View2D *v2d, bool check_scrollers) * - if they overlap, they must not occupy the corners (which are reserved for other widgets) */ if (scroll) { + const int scroll_width = (v2d->scroll & V2D_SCROLL_SCALE_VERTICAL) ? + V2D_SCROLL_WIDTH_TEXT : V2D_SCROLL_WIDTH; + const int scroll_height = (v2d->scroll & V2D_SCROLL_SCALE_HORIZONTAL) ? + V2D_SCROLL_HEIGHT_TEXT : V2D_SCROLL_HEIGHT; + /* vertical scroller */ if (scroll & V2D_SCROLL_LEFT) { /* on left-hand edge of region */ v2d->vert = v2d->mask; - v2d->vert.xmax = V2D_SCROLL_WIDTH; + v2d->vert.xmax = scroll_width; v2d->mask.xmin = v2d->vert.xmax + 1; } else if (scroll & V2D_SCROLL_RIGHT) { /* on right-hand edge of region */ v2d->vert = v2d->mask; v2d->vert.xmax++; /* one pixel extra... was leaving a minor gap... */ - v2d->vert.xmin = v2d->vert.xmax - V2D_SCROLL_WIDTH; + v2d->vert.xmin = v2d->vert.xmax - scroll_width; v2d->mask.xmax = v2d->vert.xmin - 1; } @@ -171,13 +176,13 @@ static void view2d_masks(View2D *v2d, bool check_scrollers) if (scroll & (V2D_SCROLL_BOTTOM)) { /* on bottom edge of region */ v2d->hor = v2d->mask; - v2d->hor.ymax = V2D_SCROLL_HEIGHT; + v2d->hor.ymax = scroll_height; v2d->mask.ymin = v2d->hor.ymax + 1; } else if (scroll & V2D_SCROLL_TOP) { /* on upper edge of region */ v2d->hor = v2d->mask; - v2d->hor.ymin = v2d->hor.ymax - V2D_SCROLL_HEIGHT; + v2d->hor.ymin = v2d->hor.ymax - scroll_height; v2d->mask.ymax = v2d->hor.ymin - 1; } |