[Bf-blender-cvs] [b9522e5] master: UI: use cursor x-location for tooltip placement (T37478)
Campbell Barton
noreply at git.blender.org
Fri Jun 27 14:57:26 CEST 2014
Commit: b9522e557a0346ef7e9f4f5050774bdf3b023204
Author: Campbell Barton
Date: Fri Jun 27 22:56:31 2014 +1000
https://developer.blender.org/rBb9522e557a0346ef7e9f4f5050774bdf3b023204
UI: use cursor x-location for tooltip placement (T37478)
===================================================================
M source/blender/editors/interface/interface_regions.c
===================================================================
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index a3c3fb5..6f076ab 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);
More information about the Bf-blender-cvs
mailing list