From f2849b0fb82ad16ab088b984f2ffa72fa5499110 Mon Sep 17 00:00:00 2001 From: grilledham Date: Sun, 24 Feb 2019 23:07:15 +0000 Subject: [PATCH] visible_fixes --- features/gui/camera.lua | 4 ++-- utils/gui.lua | 15 ++++----------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/features/gui/camera.lua b/features/gui/camera.lua index fb279a8d..e9ac50fc 100644 --- a/features/gui/camera.lua +++ b/features/gui/camera.lua @@ -58,7 +58,7 @@ local function create_camera(args, player) if not mainframe then mainframe = mainframeflow.add {type = 'frame', name = mainframeid, direction = 'vertical', style = 'captionless_frame'} - mainframe.style.visible = true + mainframe.visible = true end local headerframe = mainframe.headerframe @@ -122,7 +122,7 @@ local function update_camera_render(target, targetframe, zoom, size, visible) camera.position = position camera.surface_index = surface_index camera.zoom = zoom - camera.style.visible = visible + camera.visible = visible camera.style.minimal_width = preview_size camera.style.minimal_height = preview_size camera.style.maximal_width = preview_size diff --git a/utils/gui.lua b/utils/gui.lua index 7ff901aa..d8c76e2f 100644 --- a/utils/gui.lua +++ b/utils/gui.lua @@ -230,14 +230,9 @@ Gui.on_click( local name = top_elements[i] local ele = top[name] if ele and ele.valid then - local style = ele.style - - -- if visible is not set it has the value of nil. - -- Hence nil is treated as is visible. - local v = style.visible - if v or v == nil then + if ele.visible then custom_raise(on_pre_hidden_handlers, ele, player) - style.visible = false + ele.visible = false end end end @@ -249,10 +244,8 @@ Gui.on_click( local name = top_elements[i] local ele = top[name] if ele and ele.valid then - local style = ele.style - - if not style.visible then - style.visible = true + if not ele.visible then + ele.visible = true custom_raise(on_visible_handlers, ele, player) end end