Browse Source

Nudge tooltips to fit within the window

pull/1397/head
Tim Moore 5 years ago
parent
commit
6a552eae6f
No known key found for this signature in database GPG Key ID: 99561A757E742D31
1 changed files with 3 additions and 0 deletions
  1. +3
    -0
      src/ui/Tooltip.cpp

+ 3
- 0
src/ui/Tooltip.cpp View File

@@ -1,5 +1,6 @@
#include <ui/Tooltip.hpp>
#include <app.hpp>
#include <app/Scene.hpp>
#include <window.hpp>


@@ -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();
}



Loading…
Cancel
Save