[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32348] trunk/blender/source/blender/ editors/interface/interface_regions.c: bugfix [#23311] Half a colour picker appears

Campbell Barton ideasman42 at gmail.com
Wed Oct 6 16:17:28 CEST 2010


Revision: 32348
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32348
Author:   campbellbarton
Date:     2010-10-06 16:17:28 +0200 (Wed, 06 Oct 2010)

Log Message:
-----------
bugfix [#23311] Half a colour picker appears

all popups which are positioned based on an existing button are now clamped to window bounds.

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

Modified: trunk/blender/source/blender/editors/interface/interface_regions.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_regions.c	2010-10-06 13:55:50 UTC (rev 32347)
+++ trunk/blender/source/blender/editors/interface/interface_regions.c	2010-10-06 14:17:28 UTC (rev 32348)
@@ -1116,6 +1116,7 @@
 	if(but) {
 		int left=0, right=0, top=0, down=0;
 		int winx, winy;
+		int offscreen;
 
 		wm_window_get_size(window, &winx, &winy);
 
@@ -1206,6 +1207,12 @@
 		// apply requested offset in the block
 		xof += block->xofs/block->aspect;
 		yof += block->yofs/block->aspect;
+
+		/* clamp to window bounds, could be made into an option if its ever annoying */
+		if(     (offscreen= (block->miny+yof)) < 0)      yof -= offscreen; /* bottom */
+		else if((offscreen= (block->maxy+yof)-winy) > 0) yof -= offscreen; /* top */
+		if(     (offscreen= (block->minx+xof)) < 0)      xof -= offscreen; /* left */
+		else if((offscreen= (block->maxx+xof)-winx) > 0) xof -= offscreen; /* right */
 	}
 	
 	/* apply */





More information about the Bf-blender-cvs mailing list