3
0
mirror of https://github.com/britzl/monarch.git synced 2025-11-26 19:00:53 +01:00

Compare commits

..

2 Commits
3.4.5 ... 3.5.0

Author SHA1 Message Date
Björn Ritzl
bcc6264cd4 Remove screen from stack when unregistered
Fixes #87
2022-05-29 14:47:34 +02:00
Björn Ritzl
1dec704047 Delay reset of timestep when going back from popup
Fixes #84
2022-02-23 12:46:04 +01:00

View File

@@ -298,6 +298,12 @@ function M.unregister(id)
log("unregister()", id) log("unregister()", id)
local screen = screens[id] local screen = screens[id]
screens[id] = nil screens[id] = nil
-- remove screen from stack
for i = #stack, 1, -1 do
if stack[i].id == id then
table.remove(stack, i)
end
end
end end
local function acquire_input(screen) local function acquire_input(screen)
@@ -650,10 +656,10 @@ local function back_out(screen, next_screen, wait_for_transition, cb)
change_context(screen) change_context(screen)
release_input(screen, next_screen) release_input(screen, next_screen)
focus_lost(screen, next_screen) focus_lost(screen, next_screen)
transition(screen, M.TRANSITION.BACK_OUT, { next_screen = next_screen and next_screen.id }, wait_for_transition)
if next_screen and screen.popup then if next_screen and screen.popup then
reset_timestep(next_screen) reset_timestep(next_screen)
end end
transition(screen, M.TRANSITION.BACK_OUT, { next_screen = next_screen and next_screen.id }, wait_for_transition)
screen.visible = false screen.visible = false
unload(screen) unload(screen)
active_transition_count = active_transition_count - 1 active_transition_count = active_transition_count - 1
@@ -921,9 +927,20 @@ function M.back(data, cb)
if data then if data then
top.data = data top.data = data
end end
-- if the screen we are backing out from is a popup and the screen we go
-- back to is not a popup we need to let the popup completely hide before
-- we start working on the screen we go back to
-- we do this to ensure that we do not reset the times step of the screen
-- we go back to until it is no longer obscured by the popup
if screen.popup and not top.popup then
back_out(screen, top, WAIT_FOR_TRANSITION, function()
back_in(top, screen, WAIT_FOR_TRANSITION, back_cb)
end)
else
back_in(top, screen, DO_NOT_WAIT_FOR_TRANSITION, function() back_in(top, screen, DO_NOT_WAIT_FOR_TRANSITION, function()
back_out(screen, top, WAIT_FOR_TRANSITION, back_cb) back_out(screen, top, WAIT_FOR_TRANSITION, back_cb)
end) end)
end
else else
back_out(screen, top, WAIT_FOR_TRANSITION, back_cb) back_out(screen, top, WAIT_FOR_TRANSITION, back_cb)
end end