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:
authorTon Roosendaal <ton@blender.org>2013-05-11 19:29:57 +0400
committerTon Roosendaal <ton@blender.org>2013-05-11 19:29:57 +0400
commitcda9407177c36793fa05ce3d3a5579c837665bc2 (patch)
tree5a7420159935e1faca7202a57ca52fc0957e537c /source/blender/editors
parent55f929ab3d01eb885904e37eee8fbb254fe53d1c (diff)
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.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/interface/interface_regions.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index f9523c28048..887f1cb32ad 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -1553,6 +1553,7 @@ static void ui_block_region_draw(const bContext *C, ARegion *ar)
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 @@ static void ui_popup_block_clip(wmWindow *window, uiBlock *block)
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 @@ static void ui_popup_block_clip(wmWindow *window, uiBlock *block)
/* 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;
}
}