diff --git a/res/project_client.lua b/res/project_client.lua
index 0b21a834..16f60766 100644
--- a/res/project_client.lua
+++ b/res/project_client.lua
@@ -1,32 +1,32 @@
local menubg
function on_menu_clear()
- print("menu clear")
if menubg then
menubg:destruct()
menubg = nil
end
end
-function on_menu_setup()
- -- //TODO:
- time.post_runnable(function()
- local controller = {}
- function controller.resize_menu_bg()
- local w, h = unpack(gui.get_viewport())
- if menubg then
- menubg.region = {0, math.floor(h / 48), math.floor(w / 48), 0}
- menubg.pos = {0, 0}
- end
- return w, h
+local function setup_backround()
+ local controller = {}
+ function controller.resize_menu_bg()
+ local w, h = unpack(gui.get_viewport())
+ if menubg then
+ menubg.region = {0, math.floor(h / 48), math.floor(w / 48), 0}
+ menubg.pos = {0, 0}
end
- gui.root.root:add(
- "", controller)
- menubg = gui.root.menubg
- controller.resize_menu_bg()
- end)
+ return w, h
+ end
+ local bgid = random.uuid()
+ gui.root.root:add(string.format(
+ "", bgid), controller)
+ menubg = gui.root[bgid]
+ controller.resize_menu_bg()
+end
+function on_menu_setup()
+ setup_backround()
menu.page = "main"
menu.visible = true
end
diff --git a/src/graphics/ui/elements/UINode.cpp b/src/graphics/ui/elements/UINode.cpp
index e62ff1df..cbcb1c90 100644
--- a/src/graphics/ui/elements/UINode.cpp
+++ b/src/graphics/ui/elements/UINode.cpp
@@ -390,9 +390,14 @@ void UINode::getIndices(
const std::string& id = node->getId();
if (!id.empty()) {
const auto& found = map.find(id);
- if (found == map.end() || found->second.expired()) {
- map[id] = node;
+
+ if (found != map.end()) {
+ auto prev = found->second.lock();
+ if (prev && prev->getParent()) {
+ return;
+ }
}
+ map[id] = node;
}
auto container = std::dynamic_pointer_cast(node);
if (container) {