1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2024-12-12 10:04:40 +02:00

Merge pull request #929 from grilledham/remove_debug_data_from_gui_data

don't show the debugger's gui data in gui data
This commit is contained in:
grilledham 2019-05-31 12:28:09 +01:00 committed by GitHub
commit 211d0ca18a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -109,11 +109,16 @@ function Public.show(container)
end
local function draw_element_headers(element_panel, values, selected_index)
local copy = {}
for k, v in pairs(values) do
copy[k] = v
end
local selected_header = nil
local element_map = Gui.element_map()
local name_map = Gui.names
for ei, stored_data in pairs(values) do
for ei, stored_data in pairs(copy) do
local ele = element_map[ei]
local ele_name = ''
if ele and ele.valid then
@ -125,6 +130,10 @@ local function draw_element_headers(element_panel, values, selected_index)
ele_name = gui_name
end
if ele_name:match('%d* %- features/gui/debug') then
goto continue
end
local middle_header =
element_panel.add({type = 'flow'}).add {
type = 'label',
@ -137,6 +146,8 @@ local function draw_element_headers(element_panel, values, selected_index)
if ei == selected_index then
selected_header = middle_header
end
::continue::
end
return selected_header
@ -171,12 +182,7 @@ Gui.on_click(
return
end
local copy = {}
for k, v in pairs(values) do
copy[k] = v
end
draw_element_headers(element_panel, copy)
draw_element_headers(element_panel, values)
end
)
@ -260,12 +266,7 @@ Gui.on_click(
local player_header_data = Gui.get_data(selected_player_header)
local values = player_header_data.values
local copy = {}
for k, v in pairs(values) do
copy[k] = v
end
local selected_element_header = draw_element_headers(element_panel, copy, selected_element_index)
local selected_element_header = draw_element_headers(element_panel, values, selected_element_index)
data.selected_element_header = selected_element_header
if selected_element_header then
selected_element_header.style.font_color = Color.orange