3
0
mirror of https://github.com/britzl/monarch.git synced 2025-06-27 10:27:49 +02:00

Removed one-frame delay during show/back-in

If the screen had a transition the delay caused the screen to render in its initial position for one frame before the transition was applied
This commit is contained in:
Björn Ritzl 2021-07-01 15:04:52 +02:00
parent 4927d6e766
commit 9e81b3a327

View File

@ -49,7 +49,7 @@ local transition_listeners = {}
-- monarch is considered busy while there are active transitions -- monarch is considered busy while there are active transitions
local active_transition_count = 0 local active_transition_count = 0
local function log(...) end local function log(...) end
function M.debug() function M.debug()
log = print log = print
@ -604,9 +604,6 @@ local function show_in(screen, previous_screen, reload, add_to_stack, wait_for_t
notify_transition_listeners(M.SCREEN_TRANSITION_FAILED, { screen = screen.id }) notify_transition_listeners(M.SCREEN_TRANSITION_FAILED, { screen = screen.id })
return return
end end
-- wait until screen has had a chance to render
cowait(0)
cowait(0)
reset_timestep(screen) reset_timestep(screen)
transition(screen, M.TRANSITION.SHOW_IN, { previous_screen = previous_screen and previous_screen.id }, wait_for_transition) transition(screen, M.TRANSITION.SHOW_IN, { previous_screen = previous_screen and previous_screen.id }, wait_for_transition)
screen.visible = true screen.visible = true
@ -631,9 +628,6 @@ local function back_in(screen, previous_screen, wait_for_transition, cb)
notify_transition_listeners(M.SCREEN_TRANSITION_FAILED, { screen = screen.id }) notify_transition_listeners(M.SCREEN_TRANSITION_FAILED, { screen = screen.id })
return return
end end
-- wait until screen has had a chance to render
cowait(0)
cowait(0)
reset_timestep(screen) reset_timestep(screen)
if previous_screen and not previous_screen.popup then if previous_screen and not previous_screen.popup then
transition(screen, M.TRANSITION.BACK_IN, { previous_screen = previous_screen.id }, wait_for_transition) transition(screen, M.TRANSITION.BACK_IN, { previous_screen = previous_screen.id }, wait_for_transition)