[Bf-blender-cvs] [7213553c84a] master: UI: Clamp scrollbar offset to lower view boundaries

Julian Eisel noreply at git.blender.org
Mon Apr 9 18:57:17 CEST 2018


Commit: 7213553c84a34256322ce7f113a601ee442736fd
Author: Julian Eisel
Date:   Mon Apr 9 18:52:03 2018 +0200
Branches: master
https://developer.blender.org/rB7213553c84a34256322ce7f113a601ee442736fd

UI: Clamp scrollbar offset to lower view boundaries

Fixes the "emtpy scrolling" glitch by clamping the scroller offset to
the boundary of the view when it's smaller than the previous.

Fixes T45197. Patch by @januz.

Differential Revision: D1580

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

M	source/blender/editors/screen/area.c

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

diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index caae803100b..a53a16906d3 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -1939,15 +1939,29 @@ void ED_region_panels(const bContext *C, ARegion *ar, const char *context, int c
 		/* before setting the view */
 		if (vertical) {
 			/* we always keep the scroll offset - so the total view gets increased with the scrolled away part */
-			if (v2d->cur.ymax < - 0.001f)
-				y = min_ii(y, v2d->cur.ymin);
-			
+			if (v2d->cur.ymax < -FLT_EPSILON) {
+				/* Clamp to lower view boundary */
+				if (v2d->tot.ymin < -v2d->winy) {
+					y = min_ii(y, 0);
+				}
+				else {
+					y = min_ii(y, v2d->cur.ymin);
+				}
+			}
+
 			y = -y;
 		}
 		else {
 			/* don't jump back when panels close or hide */
-			if (!is_context_new)
-				x = max_ii(x, v2d->cur.xmax);
+			if (!is_context_new) {
+				if (v2d->tot.xmax > v2d->winx) {
+					x = max_ii(x, 0);
+				}
+				else {
+					x = max_ii(x, v2d->cur.xmax);
+				}
+			}
+
 			y = -y;
 		}



More information about the Bf-blender-cvs mailing list