UI: Position of Tooltips for Labels

Move tooltip position to mouse position rather than bottom of the
region for labels that are taller than one line.

Pull Request: https://projects.blender.org/blender/blender/pulls/117879
This commit is contained in:
Harley Acheson 2024-03-14 21:35:11 +01:00 • committed by Harley Acheson
parent e3f030cce6
commit 3d85765e14

View file

@ -1441,6 +1441,10 @@ ARegion *UI_tooltip_create_from_button_or_extra_icon(
}
BLI_rcti_rctf_copy_round(&init_rect, &overlap_rect_fl);
}
else if (but->type == UI_BTYPE_LABEL && BLI_rctf_size_y(&but->rect) > UI_UNIT_Y) {
init_position[0] = win->eventstate->xy[0];
init_position[1] = win->eventstate->xy[1] - (UI_POPUP_MARGIN / 2);
}
else {
init_position[0] = BLI_rctf_cent_x(&but->rect);
init_position[1] = but->rect.ymin;