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:
46
init.lua
46
init.lua
@@ -1280,8 +1280,12 @@ local ui = (function()
|
|||||||
end
|
end
|
||||||
draw_top_toolbar(mx, my)
|
draw_top_toolbar(mx, my)
|
||||||
draw_mode_pill()
|
draw_mode_pill()
|
||||||
draw_side_panel(mx, my)
|
if state.is_layers_panel_shown() then
|
||||||
draw_palette(mx, my)
|
draw_side_panel(mx, my)
|
||||||
|
end
|
||||||
|
if state.is_palette_shown() then
|
||||||
|
draw_palette(mx, my)
|
||||||
|
end
|
||||||
draw_status(mx, my)
|
draw_status(mx, my)
|
||||||
local mid = state.get_modal_open()
|
local mid = state.get_modal_open()
|
||||||
if mid and MODALS[mid] then
|
if mid and MODALS[mid] then
|
||||||
@@ -1490,30 +1494,34 @@ local ui = (function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Bottom palette swatches: left = select slot
|
-- Bottom palette swatches: left = select slot
|
||||||
for _, sw in ipairs(palette_swatches_layout()) do
|
if state.is_palette_shown() then
|
||||||
if in_rect(mx, my, sw.x, sw.y, sw.w, sw.h) then
|
for _, sw in ipairs(palette_swatches_layout()) do
|
||||||
if button == "left" then
|
if in_rect(mx, my, sw.x, sw.y, sw.w, sw.h) then
|
||||||
actions.set_active_tile(sw.slot_id)
|
if button == "left" then
|
||||||
|
actions.set_active_tile(sw.slot_id)
|
||||||
|
end
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
return true
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Side-panel layer rows: left = set active; right = toggle visibility
|
-- Side-panel layer rows: left = set active; right = toggle visibility
|
||||||
for _, row in ipairs(side_panel_rows_layout()) do
|
if state.is_layers_panel_shown() then
|
||||||
if in_rect(mx, my, row.eye_x, row.eye_y, row.eye_w, row.eye_h) then
|
for _, row in ipairs(side_panel_rows_layout()) do
|
||||||
if button == "left" then
|
if in_rect(mx, my, row.eye_x, row.eye_y, row.eye_w, row.eye_h) then
|
||||||
actions.toggle_layer_visible(row.name)
|
if button == "left" then
|
||||||
|
actions.toggle_layer_visible(row.name)
|
||||||
|
end
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
return true
|
if in_rect(mx, my, row.x, row.y, row.w, row.h) then
|
||||||
end
|
if button == "left" then
|
||||||
if in_rect(mx, my, row.x, row.y, row.w, row.h) then
|
actions.set_active_layer(row.name)
|
||||||
if button == "left" then
|
elseif button == "right" then
|
||||||
actions.set_active_layer(row.name)
|
actions.toggle_layer_visible(row.name)
|
||||||
elseif button == "right" then
|
end
|
||||||
actions.toggle_layer_visible(row.name)
|
return true
|
||||||
end
|
end
|
||||||
return true
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user