Skip to content

Commit

Permalink
fix: ui
Browse files Browse the repository at this point in the history
  • Loading branch information
MihailRis committed Jun 16, 2024
1 parent 51db6a1 commit 41b5c5a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
12 changes: 6 additions & 6 deletions res/layouts/pages/content.xml.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@ end
function move_pack(id)
-- cancel pack addition
if table.has(add_packs, id) then
document["pack_"..id]:move_into(document.packs_add)
document["pack_"..id]:moveInto(document.packs_add)
table.remove_value(add_packs, id)
-- cancel pack removal
elseif table.has(rem_packs, id) then
document["pack_"..id]:move_into(document.packs_cur)
document["pack_"..id]:moveInto(document.packs_cur)
table.remove_value(rem_packs, id)
-- add pack
elseif table.has(packs_installed, id) then
document["pack_"..id]:move_into(document.packs_add)
document["pack_"..id]:moveInto(document.packs_add)
table.insert(rem_packs, id)
-- remove pack
else
document["pack_"..id]:move_into(document.packs_cur)
document["pack_"..id]:moveInto(document.packs_cur)
table.insert(add_packs, id)
end
refresh_changes()
Expand Down Expand Up @@ -120,12 +120,12 @@ end
function apply_movements(packs_cur, packs_add)
for i,id in ipairs(packs_installed) do
if table.has(rem_packs, id) then
document["pack_"..id]:move_into(packs_add)
document["pack_"..id]:moveInto(packs_add)
end
end
for i,id in ipairs(packs_available) do
if table.has(add_packs, id) then
document["pack_"..id]:move_into(packs_cur)
document["pack_"..id]:moveInto(packs_cur)
end
end
end
5 changes: 3 additions & 2 deletions src/logic/scripting/lua/libgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ static int l_container_add(lua::State* L) {

static int l_node_destruct(lua::State* L) {
auto docnode = getDocumentNode(L);
auto node = std::dynamic_pointer_cast<Container>(docnode.node);
auto node = docnode.node;
engine->getGUI()->postRunnable([node]() {
auto parent = node->getParent();
if (auto container = dynamic_cast<Container*>(parent)) {
Expand Down Expand Up @@ -339,7 +339,8 @@ static int l_gui_getattr(lua::State* L) {
{"interactive", p_is_interactive},
{"visible", p_is_visible},
{"enabled", p_is_enabled},
{"move_into", p_move_into},
{"move_into", p_move_into}, // deprecated
{"moveInto", p_move_into},
{"add", p_get_add},
{"destruct", p_get_destruct},
{"clear", p_get_clear},
Expand Down

0 comments on commit 41b5c5a

Please sign in to comment.