gui: added UINode.zindex

This commit is contained in:
MihailRis
2024-02-13 12:46:06 +03:00
parent e1b2d8f7e4
commit b6f675a540
6 changed files with 25 additions and 0 deletions
+7
View File
@@ -144,6 +144,12 @@ void Container::setSize(glm::vec2 size) {
refresh();
}
void Container::refresh() {
std::stable_sort(nodes.begin(), nodes.end(), [](const auto& a, const auto& b) {
return a->getZIndex() < b->getZIndex();
});
}
const std::vector<std::shared_ptr<UINode>>& Container::getNodes() const {
return nodes;
}
@@ -190,6 +196,7 @@ void Panel::add(std::shared_ptr<UINode> node) {
}
void Panel::refresh() {
UINode::refresh();
float x = padding.x;
float y = padding.y;
vec2 size = getSize();