UIElement*UserInterface::findElem(const glm::vec2 &pnt) { for (auto it = slots.rbegin(); it != slots.rend(); ++it) { if (!(*it)->isVisible()) continue; UIElement *el = (*it)->containPoint(pnt); if (el != nullptr && el->isVisible() && el->isEnabled()) { return el; } } return nullptr; }