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
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2014-06-27 16:56:31 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-06-27 16:56:31 +0400
commitb9522e557a0346ef7e9f4f5050774bdf3b023204 (patch)
tree432dae8939fd1082b6b06ec29b6e2a8643cc2eeb /source
parentbeedb0b27471f34b321bc44a9a6b07bbb07b3e49 (diff)
UI: use cursor x-location for tooltip placement (T37478)
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/interface/interface_regions.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index a3c3fb5e733..6f076abdd35 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -612,19 +612,29 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
rect_fl.xmax = rect_fl.xmin + fontw + (TIP_BORDER_X * 2);
rect_fl.ymax = but->rect.ymin + ofsy - TIP_BORDER_Y;
rect_fl.ymin = rect_fl.ymax - fonth - TIP_BORDER_Y;
-
-#undef TIP_BORDER_X
-#undef TIP_BORDER_Y
/* since the text has beens caled already, the size of tooltips is defined now */
/* here we try to figure out the right location */
if (butregion) {
+ float mx, my;
float ofsx_fl = rect_fl.xmin, ofsy_fl = rect_fl.ymax;
ui_block_to_window_fl(butregion, but->block, &ofsx_fl, &ofsy_fl);
- BLI_rctf_translate(&rect_fl, ofsx_fl - rect_fl.xmin, ofsy_fl - rect_fl.ymax);
+
+#if 1
+ /* use X mouse location */
+ mx = (win->eventstate->x + (TIP_BORDER_X * 2)) - BLI_rctf_cent_x(&but->rect);
+#else
+ mx = ofsx_fl - rect_fl.xmin;
+#endif
+ my = ofsy_fl - rect_fl.ymax;
+
+ BLI_rctf_translate(&rect_fl, mx, my);
}
BLI_rcti_rctf_copy(&rect_i, &rect_fl);
+#undef TIP_BORDER_X
+#undef TIP_BORDER_Y
+
/* clip with window boundaries */
winx = WM_window_pixels_x(win);