@@ -46,6 +46,10 @@ void Menu::step() { | |||||
for (widget::Widget *child : children) { | for (widget::Widget *child : children) { | ||||
child->box.size.x = box.size.x; | child->box.size.x = box.size.x; | ||||
} | } | ||||
// Fit inside parent | |||||
assert(parent); | |||||
box = box.nudge(parent->box.zeroPos()); | |||||
} | } | ||||
void Menu::draw(const DrawArgs &args) { | void Menu::draw(const DrawArgs &args) { | ||||
@@ -9,11 +9,6 @@ void MenuOverlay::step() { | |||||
// Adopt parent's size | // Adopt parent's size | ||||
box.size = parent->box.size; | box.size = parent->box.size; | ||||
// Fit all children in the box | |||||
for (widget::Widget *child : children) { | |||||
child->box = child->box.nudge(box.zeroPos()); | |||||
} | |||||
Widget::step(); | Widget::step(); | ||||
} | } | ||||
@@ -13,6 +13,10 @@ void Tooltip::step() { | |||||
box.size.y = bndLabelHeight(APP->window->vg, -1, text.c_str(), INFINITY); | 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. | // Position near cursor. This assumes that `this` is added to the root widget. | ||||
box.pos = APP->window->mousePos.plus(math::Vec(15, 15)); | box.pos = APP->window->mousePos.plus(math::Vec(15, 15)); | ||||
// Fit inside parent | |||||
assert(parent); | |||||
box = box.nudge(parent->box.zeroPos()); | |||||
Widget::step(); | Widget::step(); | ||||
} | } | ||||