temporary fix improvement
This commit is contained in:
parent
fbc6d072e8
commit
417521e94f
@ -1,32 +1,32 @@
|
|||||||
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:
|
local controller = {}
|
||||||
time.post_runnable(function()
|
function controller.resize_menu_bg()
|
||||||
local controller = {}
|
local w, h = unpack(gui.get_viewport())
|
||||||
function controller.resize_menu_bg()
|
if menubg then
|
||||||
local w, h = unpack(gui.get_viewport())
|
menubg.region = {0, math.floor(h / 48), math.floor(w / 48), 0}
|
||||||
if menubg then
|
menubg.pos = {0, 0}
|
||||||
menubg.region = {0, math.floor(h / 48), math.floor(w / 48), 0}
|
|
||||||
menubg.pos = {0, 0}
|
|
||||||
end
|
|
||||||
return w, h
|
|
||||||
end
|
end
|
||||||
gui.root.root:add(
|
return w, h
|
||||||
"<image id='menubg' src='gui/menubg' size-func='DATA.resize_menu_bg' "..
|
end
|
||||||
"z-index='-1' interactive='true'/>", controller)
|
local bgid = random.uuid()
|
||||||
menubg = gui.root.menubg
|
gui.root.root:add(string.format(
|
||||||
controller.resize_menu_bg()
|
"<image id='%s' src='gui/menubg' size-func='DATA.resize_menu_bg' "..
|
||||||
end)
|
"z-index='-1' interactive='true'/>", bgid), controller)
|
||||||
|
menubg = gui.root[bgid]
|
||||||
|
controller.resize_menu_bg()
|
||||||
|
end
|
||||||
|
|
||||||
|
function on_menu_setup()
|
||||||
|
setup_backround()
|
||||||
menu.page = "main"
|
menu.page = "main"
|
||||||
menu.visible = true
|
menu.visible = true
|
||||||
end
|
end
|
||||||
|
|||||||
@ -390,9 +390,14 @@ 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) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user