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) <noreply@anthropic.com>
This commit is contained in:
Calic
2026-06-01 20:04:55 +02:00
parent f2123ba79c
commit 107eade2fa

View File

@@ -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