diff --git a/src/core/Global.ttslua b/src/core/Global.ttslua index 03a775f9..404dad01 100644 --- a/src/core/Global.ttslua +++ b/src/core/Global.ttslua @@ -1103,12 +1103,31 @@ function updateDownloadItemList() end contentList.attributes.height = #contentList.children * 27 - UI.setXmlTable(globalXml) + updateGlobalXml(globalXml) -- select the first item Wait.time(onClick_select, 0.2) end +-- this helper function updates the global XML while preserving the visibility of windows +function updateGlobalXml(newXml) + -- preserve visibility settings for these elements + local windowIdList = { + "playAreaGallery", + "downloadWindow", + "optionPanel" + } + + -- get current state and update newXml + for _, windowId in ipairs(windowIdList) do + local element = getXmlTableElementById(newXml, windowId) + element.attributes.active = UI.getAttribute(windowId, "active") + element.attributes.visibility = UI.getAttribute(windowId, "visibility") + end + + UI.setXmlTable(newXml) +end + -- called after the webrequest of downloading an item -- deletes the placeholder and spawns the downloaded item function contentDownloadCallback(request, params) diff --git a/src/core/PlayAreaSelector.ttslua b/src/core/PlayAreaSelector.ttslua index 4b5afc81..8a77b9b0 100644 --- a/src/core/PlayAreaSelector.ttslua +++ b/src/core/PlayAreaSelector.ttslua @@ -88,7 +88,7 @@ function updatePlayAreaGallery() end playareaList.attributes.height = round(#playareaList.children / 2, 0) * 380 - UI.setXmlTable(globalXml) + Global.call("updateGlobalXml", globalXml) Wait.time(highlightTabAndItem, 0.1) end