diff options
author | Harley Acheson <harley.acheson@gmail.com> | 2021-01-25 02:16:05 +0300 |
---|---|---|
committer | Harley Acheson <harley.acheson@gmail.com> | 2021-01-25 02:16:05 +0300 |
commit | cf6d17a6aa421e0038fc1f8e60e3f1f708887c3e (patch) | |
tree | 30eeb91c88f0c3c4552fcf2255582d439e69b899 /source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c | |
parent | 2fec46c3e614c10cadef945855747d0f3f251fd4 (diff) |
UI: Gizmo Tooltip Positioning
Position Gizmo tooltips below their bounds so they do not obscure the content.
Differential Revision: https://developer.blender.org/D9793
Reviewed by Julian Eisel
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c b/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c index 59cafd9367f..5a1b24d18cc 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c @@ -352,6 +352,16 @@ static int gizmo_axis_cursor_get(wmGizmo *UNUSED(gz)) return WM_CURSOR_DEFAULT; } +static void gizmo_axis_bounds(bContext *C, wmGizmo *gz, rcti *r_bounding_box) +{ + ScrArea *area = CTX_wm_area(C); + const float rad = (40.0f * U.dpi_fac); + r_bounding_box->xmin = gz->matrix_basis[3][0] + area->totrct.xmin - rad; + r_bounding_box->ymin = gz->matrix_basis[3][1] + area->totrct.ymin - rad; + r_bounding_box->xmax = r_bounding_box->xmin + rad; + r_bounding_box->ymax = r_bounding_box->ymin + rad; +} + void VIEW3D_GT_navigate_rotate(wmGizmoType *gzt) { /* identifiers */ @@ -361,6 +371,7 @@ void VIEW3D_GT_navigate_rotate(wmGizmoType *gzt) gzt->draw = gizmo_axis_draw; gzt->test_select = gizmo_axis_test_select; gzt->cursor_get = gizmo_axis_cursor_get; + gzt->screen_bounds_get = gizmo_axis_bounds; gzt->struct_size = sizeof(wmGizmo); } |