feat(map-editor): Esc cascades modal -> menu -> quit
Esc no longer immediately exits the editor; it first dismisses any open modal, then any open dropdown menu, and only falls through to engine.exit() when no overlay is up. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
13
init.lua
13
init.lua
@@ -330,6 +330,7 @@ local actions = (function()
|
|||||||
function M.set_mode(m) state.set_mode(m) end
|
function M.set_mode(m) state.set_mode(m) end
|
||||||
function M.open_cheatsheet() state.open_modal("cheatsheet") end
|
function M.open_cheatsheet() state.open_modal("cheatsheet") end
|
||||||
function M.close_modal() state.close_modal() end
|
function M.close_modal() state.close_modal() end
|
||||||
|
function M.close_menu() state.close_menu() end
|
||||||
|
|
||||||
-- 0.2.0c actions
|
-- 0.2.0c actions
|
||||||
function M.toggle_flip() state.toggle_flip() end
|
function M.toggle_flip() state.toggle_flip() end
|
||||||
@@ -1004,10 +1005,16 @@ function update(ctx, dt)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Quit
|
-- Esc precedence: modal → dropdown → quit
|
||||||
if input.was_action_pressed("quit") then
|
if input.was_action_pressed("quit") then
|
||||||
engine.exit()
|
if state.is_modal_open() then
|
||||||
return
|
actions.close_modal()
|
||||||
|
elseif state.get_menu_open() then
|
||||||
|
actions.close_menu()
|
||||||
|
else
|
||||||
|
engine.exit()
|
||||||
|
return
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Update mouse-cell tracking for status chip
|
-- Update mouse-cell tracking for status chip
|
||||||
|
|||||||
Reference in New Issue
Block a user