mirror of
https://github.com/britzl/monarch.git
synced 2025-11-27 11:20:55 +01:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
91204ca30b | ||
|
|
6f79bd0326 | ||
|
|
e5214edb22 | ||
|
|
1d4e48c0de |
@@ -715,8 +715,8 @@ local function back_out(screen, next_screen, wait_for_transition, cb)
|
|||||||
log("back_out()", screen.id)
|
log("back_out()", screen.id)
|
||||||
assert(wait_for_transition ~= nil)
|
assert(wait_for_transition ~= nil)
|
||||||
run_coroutine(screen, cb, function()
|
run_coroutine(screen, cb, function()
|
||||||
notify_transition_listeners(M.SCREEN_TRANSITION_OUT_STARTED, { screen = screen.id, next_screen = next_screen and next_screen.id })
|
|
||||||
active_transition_count = active_transition_count + 1
|
active_transition_count = active_transition_count + 1
|
||||||
|
notify_transition_listeners(M.SCREEN_TRANSITION_OUT_STARTED, { screen = screen.id, next_screen = next_screen and next_screen.id })
|
||||||
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)
|
||||||
@@ -863,13 +863,10 @@ function M.show(id, options, data, cb)
|
|||||||
show_in(screen, top, options and options.reload, add_to_stack, WAIT_FOR_TRANSITION, callbacks.track())
|
show_in(screen, top, options and options.reload, add_to_stack, WAIT_FOR_TRANSITION, callbacks.track())
|
||||||
else
|
else
|
||||||
-- show screen
|
-- show screen
|
||||||
local cb = callbacks.track()
|
show_in(screen, top, options and options.reload, add_to_stack, WAIT_FOR_TRANSITION, callbacks.track())
|
||||||
show_in(screen, top, options and options.reload, add_to_stack, DO_NOT_WAIT_FOR_TRANSITION, function()
|
if add_to_stack and top and not top.popup then
|
||||||
if add_to_stack and top and not top.popup then
|
show_out(top, screen, WAIT_FOR_TRANSITION, callbacks.track())
|
||||||
show_out(top, screen, WAIT_FOR_TRANSITION, callbacks.track())
|
end
|
||||||
end
|
|
||||||
cb()
|
|
||||||
end)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
callbacks.when_done(function()
|
callbacks.when_done(function()
|
||||||
@@ -991,12 +988,12 @@ function M.back(options, data, cb)
|
|||||||
local screen = table.remove(stack)
|
local screen = table.remove(stack)
|
||||||
if screen then
|
if screen then
|
||||||
log("back()", screen.id)
|
log("back()", screen.id)
|
||||||
|
local back_cb = callbacks.track()
|
||||||
local top = stack[#stack]
|
local top = stack[#stack]
|
||||||
-- if we go back to the same screen we need to first hide it
|
-- if we go back to the same screen we need to first hide it
|
||||||
-- and wait until it is hidden before we show it again
|
-- and wait until it is hidden before we show it again
|
||||||
local same_screen = top and top.id == screen.id
|
local same_screen = top and top.id == screen.id
|
||||||
if same_screen or (options and options.sequential) then
|
if same_screen or (options and options.sequential) then
|
||||||
local back_cb = callbacks.track()
|
|
||||||
back_out(screen, top, WAIT_FOR_TRANSITION, function()
|
back_out(screen, top, WAIT_FOR_TRANSITION, function()
|
||||||
if data then
|
if data then
|
||||||
top.data = data
|
top.data = data
|
||||||
@@ -1014,16 +1011,16 @@ function M.back(options, data, cb)
|
|||||||
-- we do this to ensure that we do not reset the times step of the screen
|
-- 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
|
-- we go back to until it is no longer obscured by the popup
|
||||||
if screen.popup and not top.popup then
|
if screen.popup and not top.popup then
|
||||||
|
local back_cb = callbacks.track()
|
||||||
back_out(screen, top, WAIT_FOR_TRANSITION, function()
|
back_out(screen, top, WAIT_FOR_TRANSITION, function()
|
||||||
back_in(top, screen, WAIT_FOR_TRANSITION, back_cb)
|
back_in(top, screen, WAIT_FOR_TRANSITION, back_cb)
|
||||||
end)
|
end)
|
||||||
else
|
else
|
||||||
back_in(top, screen, DO_NOT_WAIT_FOR_TRANSITION, function()
|
back_in(top, screen, WAIT_FOR_TRANSITION, callbacks.track())
|
||||||
back_out(screen, top, WAIT_FOR_TRANSITION, back_cb)
|
back_out(screen, top, WAIT_FOR_TRANSITION, callbacks.track())
|
||||||
end)
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
back_out(screen, top, WAIT_FOR_TRANSITION, back_cb)
|
back_out(screen, top, WAIT_FOR_TRANSITION, callbacks.track())
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ return function()
|
|||||||
assert(monarch.data(SCREEN2) == data2, "Expected data on screen2 doesn't match actual data")
|
assert(monarch.data(SCREEN2) == data2, "Expected data on screen2 doesn't match actual data")
|
||||||
|
|
||||||
local data_back = { going = "back" }
|
local data_back = { going = "back" }
|
||||||
monarch.back(data_back)
|
monarch.back(nil, data_back)
|
||||||
assert(wait_until_visible(SCREEN1))
|
assert(wait_until_visible(SCREEN1))
|
||||||
|
|
||||||
assert(monarch.data(SCREEN1) == data_back, "Expected data on screen1 doesn't match actual data")
|
assert(monarch.data(SCREEN1) == data_back, "Expected data on screen1 doesn't match actual data")
|
||||||
|
|||||||
Reference in New Issue
Block a user