Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-10-06 18:17:28 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-10-06 18:17:28 +0400
commitd256ec9d2405416c7a8a26862fa2196f13dabb6b (patch)
tree69d0790ed2a5e56addbd163e4d3d3557f299e272 /source/blender/editors/interface/interface_regions.c
parentca44eb3abd4ac2729c0d276b561ed2d3b49efe3f (diff)
bugfix [#23311] Half a colour picker appears
all popups which are positioned based on an existing button are now clamped to window bounds.
Diffstat (limited to 'source/blender/editors/interface/interface_regions.c')
-rw-r--r--source/blender/editors/interface/interface_regions.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index 50b85360196..ff079a4b9e0 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -1116,6 +1116,7 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
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 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
// 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 */