[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [56688] trunk/blender/source/blender/ editors/interface/interface_regions.c: Bug fix #35307

Ton Roosendaal ton at blender.org
Sat May 11 17:29:57 CEST 2013


Revision: 56688
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=56688
Author:   ton
Date:     2013-05-11 15:29:57 +0000 (Sat, 11 May 2013)
Log Message:
-----------
Bug fix #35307

Popup menus in nodes, with nodes outside window boundary, were clipped very badly, even
causing it to fill entire window.

Now the clip code nicely translates the menu horizontally to be in view.

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	2013-05-11 14:40:03 UTC (rev 56687)
+++ trunk/blender/source/blender/editors/interface/interface_regions.c	2013-05-11 15:29:57 UTC (rev 56688)
@@ -1553,6 +1553,7 @@
 static void ui_popup_block_clip(wmWindow *window, uiBlock *block)
 {
 	uiBut *bt;
+	float xofs = 0.0f;
 	int width = UI_SCREEN_MARGIN;
 	int winx, winy;
 
@@ -1563,10 +1564,18 @@
 	winx = WM_window_pixels_x(window);
 	winy = WM_window_pixels_y(window);
 	
-	if (block->rect.xmin < width)
-		block->rect.xmin = width;
-	if (block->rect.xmax > winx - width)
-		block->rect.xmax = winx - width;
+	/* shift menus to right if outside of view */
+	if (block->rect.xmin < width) {
+		xofs = (width - block->rect.xmin);
+		block->rect.xmin += xofs;
+		block->rect.xmax += xofs;
+	}
+	/* or shift to left if outside of view */
+	if (block->rect.xmax > winx - width) {
+		xofs = winx - width - block->rect.xmax;
+		block->rect.xmin += xofs;
+		block->rect.xmax += xofs;
+	}
 	
 	if (block->rect.ymin < width)
 		block->rect.ymin = width;
@@ -1575,10 +1584,8 @@
 	
 	/* ensure menu items draw inside left/right boundary */
 	for (bt = block->buttons.first; bt; bt = bt->next) {
-		if (bt->rect.xmin < block->rect.xmin)
-			bt->rect.xmin = block->rect.xmin;
-		if (bt->rect.xmax > block->rect.xmax)
-			bt->rect.xmax = block->rect.xmax;
+		bt->rect.xmin += xofs;
+		bt->rect.xmax += xofs;
 	}
 
 }




More information about the Bf-blender-cvs mailing list