add clear() to PageView

This commit is contained in:
Hersi 2022-04-24 01:38:28 +02:00
parent 9cab4201c6
commit eb55b8ffa0
1 changed files with 9 additions and 5 deletions

View File

@ -51,11 +51,7 @@ end
---Replace the current pageStack with a new root page ---Replace the current pageStack with a new root page
---@param rootPage Page ---@param rootPage Page
function PageView:replace(rootPage) function PageView:replace(rootPage)
--clear pageStack self:clear()
while self:get() do
self:back()
end
self:navigate(rootPage) self:navigate(rootPage)
end end
@ -70,6 +66,14 @@ function PageView:back()
popStack(self.pageStack) popStack(self.pageStack)
end end
---Clear the pageStack
function PageView:clear()
--clear pageStack
while self:get() do
self:back()
end
end
---@param deltaTime number # frametime in seconds ---@param deltaTime number # frametime in seconds
function PageView:render(deltaTime) function PageView:render(deltaTime)
if self:get() then if self:get() then