diff options
author | Yevgeny Makarov <jenkm> | 2021-01-28 14:33:46 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2021-01-28 14:33:46 +0300 |
commit | 6f054f5ac73a1a6bff434efb1e15aea40c2e0647 (patch) | |
tree | 84ededb0f6877e6bbdc94ae57ff542e1e0772e0a /source/blender/editors/interface/interface_handlers.c | |
parent | c0d2b10c5947f49b316d39b66fb18ff6ab21a82a (diff) |
Fix T83935: Superimposed icon's hotspot is misaligned
Now the icon's rect are drawn wider than it should be, and with
overlapping, probably in order to compensate for the icon's offsets
inside the rect. The solution is to draw icon's rect of the correct
size and center the icon itself.
And make the hotspot exactly match the icon's rect. The last/right
button's hotspot also covers the extra padding on the right.
Differential Revision: https://developer.blender.org/D9936
Reviewed by: Julian Eisel
Diffstat (limited to 'source/blender/editors/interface/interface_handlers.c')
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 1d2393ece8d..d246dfadefa 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -4193,9 +4193,17 @@ static uiButExtraOpIcon *ui_but_extra_operator_icon_mouse_over_get(uiBut *but, return NULL; } + /* Same as in 'widget_draw_extra_icons', icon padding from the right edge. */ + xmax -= 0.2 * icon_size; + + /* Handle the padding space from the right edge as the last button. */ + if (x > xmax) { + return but->extra_op_icons.last; + } + /* Inverse order, from right to left. */ LISTBASE_FOREACH_BACKWARD (uiButExtraOpIcon *, op_icon, &but->extra_op_icons) { - if ((x > (xmax - icon_size)) && x < xmax) { + if ((x > (xmax - icon_size)) && x <= xmax) { return op_icon; } xmax -= icon_size; |