Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarley Acheson <harley.acheson@gmail.com>2021-01-25 02:16:05 +0300
committerHarley Acheson <harley.acheson@gmail.com>2021-01-25 02:16:05 +0300
commitcf6d17a6aa421e0038fc1f8e60e3f1f708887c3e (patch)
tree30eeb91c88f0c3c4552fcf2255582d439e69b899 /source/blender/editors/gizmo_library
parent2fec46c3e614c10cadef945855747d0f3f251fd4 (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/gizmo_library')
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c
index eb40500d011..cbca230da7e 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c
@@ -320,6 +320,16 @@ static int gizmo_button2d_cursor_get(wmGizmo *gz)
return WM_CURSOR_DEFAULT;
}
+static void gizmo_button2d_bounds(bContext *C, wmGizmo *gz, rcti *r_bounding_box)
+{
+ ScrArea *area = CTX_wm_area(C);
+ float rad = CIRCLE_RESOLUTION * U.dpi_fac / 2.0f;
+ 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;
+}
+
static void gizmo_button2d_free(wmGizmo *gz)
{
ButtonGizmo2D *shape = (ButtonGizmo2D *)gz;
@@ -346,6 +356,7 @@ static void GIZMO_GT_button_2d(wmGizmoType *gzt)
gzt->draw_select = gizmo_button2d_draw_select;
gzt->test_select = gizmo_button2d_test_select;
gzt->cursor_get = gizmo_button2d_cursor_get;
+ gzt->screen_bounds_get = gizmo_button2d_bounds;
gzt->free = gizmo_button2d_free;
gzt->struct_size = sizeof(ButtonGizmo2D);