diff --git a/game/engines/default/engine/ui/Dialog.lua b/game/engines/default/engine/ui/Dialog.lua index df8f40c43569ae67ad270c686a3828fd508246bb..2eee1f1460b5d30a66d47bd55e9f89180eb25fd1 100644 --- a/game/engines/default/engine/ui/Dialog.lua +++ b/game/engines/default/engine/ui/Dialog.lua @@ -457,11 +457,23 @@ function _M:setupUI(resizex, resizey, on_resize, addmw, addmh) local regenerate = false if ui.calc_width then - ui.ui.w = self.iw - (ui.right + ui.left) + if ui.left and ui.right then + ui.ui.w = self.iw - (ui.right + ui.left) + elseif ui.left and ui.hcenter then + ui.ui.w = self.iw + 2 * (ui.hcenter - ui.left) + elseif ui.hcenter and ui.right then + ui.ui.w = self.iw + 2 * (-ui.hcenter - ui.right) + end regenerate = true end if ui.calc_height then - ui.ui.h = self.ih - (ui.top + ui.bottom) + if ui.top and ui.bottom then + ui.ui.h = self.ih - (ui.bottom + ui.top) + elseif ui.top and ui.vcenter then + ui.ui.h = self.ih + 2 * (ui.vcenter - ui.top) + elseif ui.vcenter and ui.bottom then + ui.ui.h = self.ih + 2 * (-ui.vcenter - ui.bottom) + end regenerate = true end if regenerate then