Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/ui.cc')
-rw-r--r--src/ui/ui.cc20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/ui/ui.cc b/src/ui/ui.cc
index 7fb25dd..c1558b1 100644
--- a/src/ui/ui.cc
+++ b/src/ui/ui.cc
@@ -283,12 +283,19 @@ void UI::frame()
ui_mouse_focus = f;
// show tooltip if the timeout has expired
- if (ui_mouse_focus && ui_mouse_focus->tooltip() && ui_mouse_focus->tooltip()->hidden())
+ if (ui_mouse_focus && ui_mouse_focus->tooltip() && ui_mouse_focus->tooltip()->text().size() && ui_mouse_focus->tooltip()->hidden())
{
assert(ui_tooltiptimeout != nullptr);
unsigned long timeout = (unsigned long) ui_tooltiptimeout->value();
if (ui_tooltip_timestamp + timeout < core::application()->timestamp()) {
+ // move the tooltip below the mouse cursor
+ math::Vector2f p(
+ ui_mouse_focus->tooltip()->parent() ?
+ ui_mouse_focus->tooltip()->parent()->to_local_coords(mouse_cursor) :
+ mouse_cursor);
+
+ ui_mouse_focus->tooltip()->set_location(p.x() - ui_mouse_focus->tooltip()->width() * 0.5f, p.y() + pointer_size * 0.5f);
ui_mouse_focus->tooltip()->show();
}
}
@@ -299,12 +306,13 @@ void UI::frame()
// draw the widget stack
event_draw();
- // draw tooltip
- Tooltip::event_draw_global();
-
- // draw the mouse pointer
- if (visible())
+ if (visible()) {
+ // draw tooltip
+ Tooltip::event_draw_global();
+
+ // draw the mouse pointer
draw_pointer();
+ }
}
/* -- global event handlers ---------------------------------------- */