[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [50939] trunk/blender/source/blender/ editors/interface/view2d_ops.c: fix [#31476] DopeSheet GreasePencil Mode Window won't scroll up

Campbell Barton ideasman42 at gmail.com
Fri Sep 28 11:12:02 CEST 2012


Revision: 50939
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50939
Author:   campbellbarton
Date:     2012-09-28 09:12:02 +0000 (Fri, 28 Sep 2012)
Log Message:
-----------
fix [#31476] DopeSheet GreasePencil Mode Window won't scroll up

Modified Paths:
--------------
    trunk/blender/source/blender/editors/interface/view2d_ops.c

Modified: trunk/blender/source/blender/editors/interface/view2d_ops.c
===================================================================
--- trunk/blender/source/blender/editors/interface/view2d_ops.c	2012-09-28 09:00:42 UTC (rev 50938)
+++ trunk/blender/source/blender/editors/interface/view2d_ops.c	2012-09-28 09:12:02 UTC (rev 50939)
@@ -1478,6 +1478,7 @@
 	View2DScrollers *scrollers;
 	ARegion *ar = CTX_wm_region(C);
 	View2D *v2d = &ar->v2d;
+	rctf tot_cur_union;
 	float mask_size;
 	
 	/* set custom-data for operator */
@@ -1497,14 +1498,20 @@
 	 */
 	scrollers = UI_view2d_scrollers_calc(C, v2d, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
 
+	/* use a union of 'cur' & 'tot' incase the current view is far outside 'tot'.
+	 * In this cases moving the scroll bars has far too little effect and the view can get stuck [#31476] */
+	tot_cur_union = v2d->tot;
+	BLI_rctf_union(&tot_cur_union, &v2d->cur);
 
 	if (in_scroller == 'h') {
 		/* horizontal scroller - calculate adjustment factor first */
 		mask_size = (float)BLI_rcti_size_x(&v2d->hor);
-		vsm->fac = BLI_rctf_size_x(&v2d->tot) / mask_size;
+		vsm->fac = BLI_rctf_size_x(&tot_cur_union) / mask_size;
 		
 		/* get 'zone' (i.e. which part of scroller is activated) */
-		vsm->zone = mouse_in_scroller_handle(event->mval[0], v2d->hor.xmin, v2d->hor.xmax, scrollers->hor_min, scrollers->hor_max);
+		vsm->zone = mouse_in_scroller_handle(event->mval[0],
+		                                     v2d->hor.xmin, v2d->hor.xmax,
+		                                     scrollers->hor_min, scrollers->hor_max);
 		
 		if ((v2d->keepzoom & V2D_LOCKZOOM_X) && ELEM(vsm->zone, SCROLLHANDLE_MIN, SCROLLHANDLE_MAX)) {
 			/* default to scroll, as handles not usable */
@@ -1517,10 +1524,12 @@
 	else {
 		/* vertical scroller - calculate adjustment factor first */
 		mask_size = (float)BLI_rcti_size_y(&v2d->vert);
-		vsm->fac = BLI_rctf_size_y(&v2d->tot) / mask_size;
+		vsm->fac = BLI_rctf_size_y(&tot_cur_union) / mask_size;
 		
 		/* get 'zone' (i.e. which part of scroller is activated) */
-		vsm->zone = mouse_in_scroller_handle(event->mval[1], v2d->vert.ymin, v2d->vert.ymax, scrollers->vert_min, scrollers->vert_max);
+		vsm->zone = mouse_in_scroller_handle(event->mval[1],
+		                                     v2d->vert.ymin, v2d->vert.ymax,
+		                                     scrollers->vert_min, scrollers->vert_max);
 			
 		if ((v2d->keepzoom & V2D_LOCKZOOM_Y) && ELEM(vsm->zone, SCROLLHANDLE_MIN, SCROLLHANDLE_MAX)) {
 			/* default to scroll, as handles not usable */




More information about the Bf-blender-cvs mailing list