Skip to content
Snippets Groups Projects
Commit 742d0d47 authored by DarkGod's avatar DarkGod
Browse files

Merge branch 'steamtech-uifix' into 'master'

Steamtech UI fix fix

Seems like I managed to break exactly one, not-so-often used dialog, namely "Load Premade", because resized dialogs cannot handle interdependent UI elements. Well, now they can, as good as possible without making overly complex linear equation solvers.
parents f61cb70c ebf68569
No related branches found
No related tags found
No related merge requests found
......@@ -396,27 +396,30 @@ function _M:setupUI(resizex, resizey, on_resize, addmw, addmh)
for i, ui in ipairs(self.uis) do
if not ui.absolute then
if ui.top and type(ui.top) == "table" then ui.top = self.ui_by_ui[ui.top].top + self.ui_by_ui[ui.top].ui.h + padding end
if ui.bottom and type(ui.bottom) == "table" then ui.bottom = self.ui_by_ui[ui.bottom].bottom + self.ui_by_ui[ui.bottom].ui.h + padding end
if ui.left and type(ui.left) == "table" then ui.left = self.ui_by_ui[ui.left].left + self.ui_by_ui[ui.left].ui.w + padding end
if ui.right and type(ui.right) == "table" then ui.right = self.ui_by_ui[ui.right].right + self.ui_by_ui[ui.right].ui.w + padding end
if ui.top then mh = math.max(mh, ui.top + ui.ui.h + (ui.padding_h or 0))
elseif ui.bottom then addh = math.max(addh, ui.bottom + ui.ui.h + (ui.padding_h or 0))
end
end
-- print("ui", ui.left, ui.right, ui.ui.w)
if not ui.absolute then
if ui.left then mw = math.max(mw, ui.left + ui.ui.w + (ui.padding_w or 0))
elseif ui.right then addw = math.max(addw, ui.right + ui.ui.w + (ui.padding_w or 0))
end
end
end
-- print("===", mw, addw)
mw = mw + addw + 5 * 2 + (addmw or 0)
mw = mw + addw + 5 * 2 + (addmw or 0) + padding
-- print("===", mw, addw)
local tw, th = 0, 0
if self.title then tw, th = self.font_bold:size(self.title) end
mw = math.max(tw + 6, mw)
mh = mh + addh + 5 + 22 + 3 + (addmh or 0) + th
mh = mh + addh + 5 + 22 + 3 + (addmh or 0) + th + padding
if on_resize then on_resize(resizex and mw or self.w, resizey and mh or self.h) end
self:resize(resizex and mw or self.w, resizey and mh or self.h)
......
......@@ -938,7 +938,7 @@ function _M:loadPremadeUI()
local sel = nil
local sep = Separator.new{dir="horizontal", size=400}
local desc = TextzoneList.new{width=220, height=400}
local list = List.new{width=600 - desc.w - sep.w, list=lss, height=400,
local list = List.new{width=350, list=lss, height=400,
fct=function(item)
local oldsel, oldscroll = list.sel, list.scroll
if sel == item then self:loadPremade(sel) game:unregisterDialog(d) end
......@@ -966,8 +966,8 @@ function _M:loadPremadeUI()
d:loadUI{
{left=0, top=0, ui=list},
{left=list.w, top=0, ui=sep},
{left=sep, right=0, top=0, ui=desc},
{left=list, top=0, ui=sep},
{right=0, top=0, ui=desc},
{left=0, bottom=0, ui=load},
{right=0, bottom=0, ui=del},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment