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