temporary fix improvement

This commit is contained in:
MihailRis 2025-12-02 22:59:56 +03:00 committed by ShiftyX1
parent fbc6d072e8
commit 417521e94f
2 changed files with 25 additions and 20 deletions

View File

@ -1,16 +1,13 @@
local menubg local menubg
function on_menu_clear() function on_menu_clear()
print("menu clear")
if menubg then if menubg then
menubg:destruct() menubg:destruct()
menubg = nil menubg = nil
end end
end end
function on_menu_setup() local function setup_backround()
-- //TODO:
time.post_runnable(function()
local controller = {} local controller = {}
function controller.resize_menu_bg() function controller.resize_menu_bg()
local w, h = unpack(gui.get_viewport()) local w, h = unpack(gui.get_viewport())
@ -20,13 +17,16 @@ function on_menu_setup()
end end
return w, h return w, h
end end
gui.root.root:add( local bgid = random.uuid()
"<image id='menubg' src='gui/menubg' size-func='DATA.resize_menu_bg' ".. gui.root.root:add(string.format(
"z-index='-1' interactive='true'/>", controller) "<image id='%s' src='gui/menubg' size-func='DATA.resize_menu_bg' "..
menubg = gui.root.menubg "z-index='-1' interactive='true'/>", bgid), controller)
menubg = gui.root[bgid]
controller.resize_menu_bg() controller.resize_menu_bg()
end) end
function on_menu_setup()
setup_backround()
menu.page = "main" menu.page = "main"
menu.visible = true menu.visible = true
end end

View File

@ -390,10 +390,15 @@ void UINode::getIndices(
const std::string& id = node->getId(); const std::string& id = node->getId();
if (!id.empty()) { if (!id.empty()) {
const auto& found = map.find(id); 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<gui::Container>(node); auto container = std::dynamic_pointer_cast<gui::Container>(node);
if (container) { if (container) {
for (const auto& subnode : container->getNodes()) { for (const auto& subnode : container->getNodes()) {