1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-22 03:38:48 +02:00

close button tab

This commit is contained in:
MewMew 2019-10-22 08:27:00 +02:00
parent 3a0097ed45
commit dd0f5dd8a1

View File

@ -58,9 +58,18 @@ local function main_frame(player)
end
end
comfy_panel_refresh_active_tab(player)
local tab = tabbed_pane.add({type = "tab", name = "comfy_panel_close", caption = "X"})
tab.style.maximal_width = 32
local frame = tabbed_pane.add({type = "frame", name = name, direction = "vertical"})
tabbed_pane.add_tab(tab, frame)
return tabs
for _, child in pairs(tabbed_pane.children) do
child.style.padding = 8
child.style.left_padding = 2
child.style.right_padding = 2
end
comfy_panel_refresh_active_tab(player)
end
function comfy_panel_call_tab(player, name)
@ -93,6 +102,11 @@ local function on_gui_click(event)
end
end
if event.element.caption == "X" and event.element.name == "comfy_panel_close" then
player.gui.left.comfy_panel.destroy()
return
end
if not event.element.caption then return end
if event.element.type ~= "tab" then return end
comfy_panel_refresh_active_tab(player)