Skip to content

Commit 91204ca

Browse files
authored
Wait for both in and out transitions (#97)
1 parent 6f79bd0 commit 91204ca

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

monarch/monarch.lua

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -863,13 +863,10 @@ function M.show(id, options, data, cb)
863863
show_in(screen, top, options and options.reload, add_to_stack, WAIT_FOR_TRANSITION, callbacks.track())
864864
else
865865
-- show screen
866-
local cb = callbacks.track()
867-
show_in(screen, top, options and options.reload, add_to_stack, DO_NOT_WAIT_FOR_TRANSITION, function()
868-
if add_to_stack and top and not top.popup then
869-
show_out(top, screen, WAIT_FOR_TRANSITION, callbacks.track())
870-
end
871-
cb()
872-
end)
866+
show_in(screen, top, options and options.reload, add_to_stack, WAIT_FOR_TRANSITION, callbacks.track())
867+
if add_to_stack and top and not top.popup then
868+
show_out(top, screen, WAIT_FOR_TRANSITION, callbacks.track())
869+
end
873870
end
874871

875872
callbacks.when_done(function()
@@ -1014,16 +1011,16 @@ function M.back(options, data, cb)
10141011
-- we do this to ensure that we do not reset the times step of the screen
10151012
-- we go back to until it is no longer obscured by the popup
10161013
if screen.popup and not top.popup then
1014+
local back_cb = callbacks.track()
10171015
back_out(screen, top, WAIT_FOR_TRANSITION, function()
10181016
back_in(top, screen, WAIT_FOR_TRANSITION, back_cb)
10191017
end)
10201018
else
1021-
back_in(top, screen, DO_NOT_WAIT_FOR_TRANSITION, function()
1022-
back_out(screen, top, WAIT_FOR_TRANSITION, back_cb)
1023-
end)
1019+
back_in(top, screen, WAIT_FOR_TRANSITION, callbacks.track())
1020+
back_out(screen, top, WAIT_FOR_TRANSITION, callbacks.track())
10241021
end
10251022
else
1026-
back_out(screen, top, WAIT_FOR_TRANSITION, back_cb)
1023+
back_out(screen, top, WAIT_FOR_TRANSITION, callbacks.track())
10271024
end
10281025
end
10291026
end

0 commit comments

Comments
 (0)