[Bf-blender-cvs] [3eab8156d36] blender2.8: UI: don't change scrollbar size on mouse move, only fade.

Brecht Van Lommel noreply at git.blender.org
Wed Jul 11 12:36:45 CEST 2018


Commit: 3eab8156d369f40de9d8c23672b1de28491ea920
Author: Brecht Van Lommel
Date:   Wed Jul 11 12:30:48 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB3eab8156d369f40de9d8c23672b1de28491ea920

UI: don't change scrollbar size on mouse move, only fade.

It's not necessary to do both, and trying to hit a target that changes
size is annoying.

===================================================================

M	source/blender/blenloader/intern/readfile.c
M	source/blender/editors/include/UI_view2d.h
M	source/blender/editors/interface/view2d.c
M	source/blender/editors/screen/screen_ops.c
M	source/blender/makesdna/DNA_view2d_types.h

===================================================================

diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index db3c1894e8c..6bc0a634599 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -6528,7 +6528,6 @@ static void direct_link_region(FileData *fd, ARegion *ar, int spacetype)
 	ar->v2d.tab_cur = 0;
 	ar->v2d.sms = NULL;
 	ar->v2d.alpha_hor = ar->v2d.alpha_vert = 255; /* visible by default */
-	ar->v2d.size_hor = ar->v2d.size_vert = 0;
 	BLI_listbase_clear(&ar->panels_category);
 	BLI_listbase_clear(&ar->handlers);
 	BLI_listbase_clear(&ar->uiblocks);
diff --git a/source/blender/editors/include/UI_view2d.h b/source/blender/editors/include/UI_view2d.h
index d407878d063..4c4ee1e01c5 100644
--- a/source/blender/editors/include/UI_view2d.h
+++ b/source/blender/editors/include/UI_view2d.h
@@ -103,8 +103,6 @@ enum eView2D_Gridlines {
 /* ------ Defines for Scrollers ----- */
 
 /* scroller area */
-#define V2D_SCROLL_HEIGHT_MIN  (0.25f * U.widget_unit)
-#define V2D_SCROLL_WIDTH_MIN   (0.25f * U.widget_unit)
 #define V2D_SCROLL_HEIGHT      (0.45f * U.widget_unit)
 #define V2D_SCROLL_WIDTH       (0.45f * U.widget_unit)
 /* For scrollers with scale markings (text written onto them) */
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index bf768f26a93..1b449877abe 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -153,11 +153,10 @@ 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) {
-		int scroll_width  = (v2d->scroll & V2D_SCROLL_SCALE_VERTICAL) ?   V2D_SCROLL_WIDTH_TEXT  : v2d->size_vert;
-		int scroll_height = (v2d->scroll & V2D_SCROLL_SCALE_HORIZONTAL) ? V2D_SCROLL_HEIGHT_TEXT : v2d->size_hor;
-
-		CLAMP_MIN(scroll_width, V2D_SCROLL_WIDTH_MIN);
-		CLAMP_MIN(scroll_height, V2D_SCROLL_HEIGHT_MIN);
+		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) {
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 381a20feca4..09bd7625eac 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -743,7 +743,6 @@ static AZone *area_actionzone_refresh_xy(ScrArea *sa, const int xy[2], const boo
 						if (az->direction == AZ_SCROLL_HOR) {
 							az->alpha = 1.0f;
 							v2d->alpha_hor = 255;
-							v2d->size_hor = V2D_SCROLL_HEIGHT;
 							redraw = true;
 						}
 					}
@@ -751,7 +750,6 @@ static AZone *area_actionzone_refresh_xy(ScrArea *sa, const int xy[2], const boo
 						if (az->direction == AZ_SCROLL_VERT) {
 							az->alpha = 1.0f;
 							v2d->alpha_vert = 255;
-							v2d->size_vert = V2D_SCROLL_WIDTH;
 							redraw = true;
 						}
 					}
@@ -765,9 +763,6 @@ static AZone *area_actionzone_refresh_xy(ScrArea *sa, const int xy[2], const boo
 							alpha = 1.0f - dist_fac;
 
 							v2d->alpha_hor = alpha * 255;
-							v2d->size_hor = round_fl_to_int(
-							        V2D_SCROLL_HEIGHT -
-							        ((V2D_SCROLL_HEIGHT - V2D_SCROLL_HEIGHT_MIN) * dist_fac));
 						}
 						else if (az->direction == AZ_SCROLL_VERT) {
 							dist_fac = BLI_rcti_length_x(&v2d->vert, local_xy[0]) / AZONEFADEIN;
@@ -775,9 +770,6 @@ static AZone *area_actionzone_refresh_xy(ScrArea *sa, const int xy[2], const boo
 							alpha = 1.0f - dist_fac;
 
 							v2d->alpha_vert = alpha * 255;
-							v2d->size_vert = round_fl_to_int(
-							        V2D_SCROLL_WIDTH -
-							        ((V2D_SCROLL_WIDTH - V2D_SCROLL_WIDTH_MIN) * dist_fac));
 						}
 						az->alpha = alpha;
 						redraw = true;
diff --git a/source/blender/makesdna/DNA_view2d_types.h b/source/blender/makesdna/DNA_view2d_types.h
index ebeb639e8aa..e2d8d836368 100644
--- a/source/blender/makesdna/DNA_view2d_types.h
+++ b/source/blender/makesdna/DNA_view2d_types.h
@@ -66,8 +66,7 @@ typedef struct View2D {
 
 	/* Usually set externally (as in, not in view2d files). */
 	char alpha_vert, alpha_hor;		/* alpha of vertical and horizontal scrollbars (range is [0, 255]) */
-	short size_vert, size_hor;		/* Dynamic size for scrollers without scale markers (no V2D_SCROLL_SCALE_FOO) */
-	short pad;
+	short pad[3];
 
 	/* animated smooth view */
 	struct SmoothView2DStore *sms;



More information about the Bf-blender-cvs mailing list