From 107eade2fa22c392443500343ea7d7da6ffeb88a Mon Sep 17 00:00:00 2001 From: Calic Date: Mon, 1 Jun 2026 20:04:55 +0200 Subject: [PATCH] feat(map-editor): wire Window toggles to hide side panel + palette Both render and click handlers are now gated by the is_layers_panel_shown / is_palette_shown predicates, so the new Window menu toggles produce visible effects in the editor. Co-Authored-By: Claude Opus 4.7 (1M context) --- init.lua | 46 +++++++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/init.lua b/init.lua index a94ccd0..fbf1d19 100644 --- a/init.lua +++ b/init.lua @@ -1280,8 +1280,12 @@ local ui = (function() end draw_top_toolbar(mx, my) draw_mode_pill() - draw_side_panel(mx, my) - draw_palette(mx, my) + if state.is_layers_panel_shown() then + draw_side_panel(mx, my) + end + if state.is_palette_shown() then + draw_palette(mx, my) + end draw_status(mx, my) local mid = state.get_modal_open() if mid and MODALS[mid] then @@ -1490,30 +1494,34 @@ local ui = (function() end -- Bottom palette swatches: left = select slot - for _, sw in ipairs(palette_swatches_layout()) do - if in_rect(mx, my, sw.x, sw.y, sw.w, sw.h) then - if button == "left" then - actions.set_active_tile(sw.slot_id) + if state.is_palette_shown() then + for _, sw in ipairs(palette_swatches_layout()) do + if in_rect(mx, my, sw.x, sw.y, sw.w, sw.h) then + if button == "left" then + actions.set_active_tile(sw.slot_id) + end + return true end - return true end end -- Side-panel layer rows: left = set active; right = toggle visibility - for _, row in ipairs(side_panel_rows_layout()) do - if in_rect(mx, my, row.eye_x, row.eye_y, row.eye_w, row.eye_h) then - if button == "left" then - actions.toggle_layer_visible(row.name) + if state.is_layers_panel_shown() then + for _, row in ipairs(side_panel_rows_layout()) do + if in_rect(mx, my, row.eye_x, row.eye_y, row.eye_w, row.eye_h) then + if button == "left" then + actions.toggle_layer_visible(row.name) + end + return true end - return true - end - if in_rect(mx, my, row.x, row.y, row.w, row.h) then - if button == "left" then - actions.set_active_layer(row.name) - elseif button == "right" then - actions.toggle_layer_visible(row.name) + if in_rect(mx, my, row.x, row.y, row.w, row.h) then + if button == "left" then + actions.set_active_layer(row.name) + elseif button == "right" then + actions.toggle_layer_visible(row.name) + end + return true end - return true end end