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:
9
init.lua
9
init.lua
@@ -330,6 +330,7 @@ local actions = (function()
|
||||
function M.set_mode(m) state.set_mode(m) end
|
||||
function M.open_cheatsheet() state.open_modal("cheatsheet") end
|
||||
function M.close_modal() state.close_modal() end
|
||||
function M.close_menu() state.close_menu() end
|
||||
|
||||
-- 0.2.0c actions
|
||||
function M.toggle_flip() state.toggle_flip() end
|
||||
@@ -1004,11 +1005,17 @@ function update(ctx, dt)
|
||||
end
|
||||
end
|
||||
|
||||
-- Quit
|
||||
-- Esc precedence: modal → dropdown → quit
|
||||
if input.was_action_pressed("quit") then
|
||||
if state.is_modal_open() then
|
||||
actions.close_modal()
|
||||
elseif state.get_menu_open() then
|
||||
actions.close_menu()
|
||||
else
|
||||
engine.exit()
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
-- Update mouse-cell tracking for status chip
|
||||
local mx, my = engine.input.get_mouse_pos()
|
||||
|
||||
Reference in New Issue
Block a user