diff options
author | Lukas Toenne <lukas.toenne@googlemail.com> | 2011-11-22 21:49:06 +0400 |
---|---|---|
committer | Lukas Toenne <lukas.toenne@googlemail.com> | 2011-11-22 21:49:06 +0400 |
commit | b450d3c3b6585cefe52d007c0088c4dc7b2e78ec (patch) | |
tree | fc4cb80a0b3c3940b8529b8620dd7bff49a10467 /source/blender/editors/interface/interface_handlers.c | |
parent | 470cfd4aeb010b4a674d27ace3cfffad2ca6c4f0 (diff) |
Fix for long-standing TODO item: Clicking on overlapping nodes would activate buttons below.
This patch adds a new CLIP_EVENTS flag for uiBlock, which will prevent the ui_but_find_mouse_over search function from looking into "lower" uiBlocks (i.e. those further back in the list). The order of block creation for nodes has also been updated to use the z-ordering (just the nodetree->nodes list).
In order for this to work, the bounding box values of the uiBlocks have to be set explicitely to fit the node size, those are usually either zero or calculated from the internal buttons.
Diffstat (limited to 'source/blender/editors/interface/interface_handlers.c')
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 688e8f95ac7..1ba6acf367a 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -5063,6 +5063,14 @@ static uiBut *ui_but_find_mouse_over(ARegion *ar, int x, int y) if(ui_but_contains_pt(but, mx, my)) butover= but; } + + /* CLIP_EVENTS prevents the event from reaching other blocks */ + if (block->flag & UI_BLOCK_CLIP_EVENTS) { + /* check if mouse is inside block */ + if(block->minx <= mx && block->maxx >= mx && + block->miny <= my && block->maxy >= my) + break; + } } return butover; |