Page MenuHome

Fix T83935: Superimposed icon's hotspot is misaligned
ClosedPublic

Authored by Yevgeny Makarov (jenkm) on Dec 27 2020, 11:50 AM.

Details

Summary

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.

Current state:


After the patch:


Before and after:

Diff Detail

Repository
rB Blender

Event Timeline

Yevgeny Makarov (jenkm) requested review of this revision.Dec 27 2020, 11:50 AM
Yevgeny Makarov (jenkm) created this revision.
Julian Eisel (Severin) requested changes to this revision.Dec 27 2020, 5:57 PM

Didn't test but looks reasonable. And thanks a lot for the attached graphics.
Just requesting two minor/small changes.

source/blender/editors/interface/interface_widgets.c
2262

Use BLI_listbase_is_empty().

2280

Think this shouldn't assume that UI_BUT_ICON_LEFT was enabled. It should check if it was previously enabled and only set it again if so.

This revision now requires changes to proceed.Dec 27 2020, 5:57 PM
Yevgeny Makarov (jenkm) marked 2 inline comments as done.
source/blender/editors/interface/interface_widgets.c
2263

Where does this come from? Would be good to note in a comment even if it's just eyeballed.
Or even better, add a define if it's used more often.

2280

flags could be any kind of flag. Better call it old_drawflags.

@Yevgeny Makarov (jenkm) do you have the time to address the two minor points raised?

Yevgeny Makarov (jenkm) marked an inline comment as done.
rect->xmax -= 0.2 * icon_size;

Where does this come from? Would be good to note in a comment even if it's just eyeballed.

I'm not sure how to comment on this. In widget_draw_extra_icons, it is just some offset to look good,
and in ui_but_extra_operator_icon_mouse_over_get, respectively, the same offset is needed.

I know that these factors are often eye balled, but if it's the same one as in`widget_draw_extra_icons()` and that is noted in a comment, that's fine with me.

This revision is now accepted and ready to land.Jan 28 2021, 12:18 PM