diff --git a/src/ui/Tooltip.cpp b/src/ui/Tooltip.cpp index 7e734875..07f1bdcc 100644 --- a/src/ui/Tooltip.cpp +++ b/src/ui/Tooltip.cpp @@ -1,5 +1,6 @@ #include #include +#include #include @@ -13,6 +14,8 @@ void Tooltip::step() { box.size.y = bndLabelHeight(APP->window->vg, -1, text.c_str(), INFINITY); // Position near cursor. This assumes that `this` is added to the root widget. box.pos = APP->window->mousePos.plus(math::Vec(15, 15)); + // Ensure that it fits within the window. + box = box.nudge(APP->scene->box); Widget::step(); }