cleaned up rendering mode swapping

This commit is contained in:
Michael Freno
2025-12-12 00:08:25 -05:00
parent 9d8f6aa60d
commit ec73d8c7c8
11 changed files with 1270 additions and 46 deletions

View File

@@ -38,7 +38,18 @@ function Context.registerElement(element)
end
function Context.clearFrameElements()
Context._zIndexOrderedElements = {}
-- Preserve retained-mode elements
if Context._immediateMode then
local retainedElements = {}
for _, element in ipairs(Context._zIndexOrderedElements) do
if element._elementMode == "retained" then
table.insert(retainedElements, element)
end
end
Context._zIndexOrderedElements = retainedElements
else
Context._zIndexOrderedElements = {}
end
end
--- Sort elements by z-index (called after all elements are registered)