Commit: a31807ed7c755e65bd244025bd575fd2b183561a Author: Julian Eisel Date: Thu Apr 26 15:25:59 2018 +0200 Branches: blender2.8 https://developer.blender.org/rBa31807ed7c755e65bd244025bd575fd2b183561a
Reduce size of scrollbars that don't contain scale markings More changes will follow, this is just an initial tweak. =================================================================== M source/blender/editors/include/UI_view2d.h M source/blender/editors/interface/view2d.c =================================================================== 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; } _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs