From e8c914e84e6ae3c09373bf65c558fc3b04b80beb Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 6 May 2020 00:59:29 +0800 Subject: [PATCH] fix on resize for mconfdialog --- src/ltui/mconfdialog.lua | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/src/ltui/mconfdialog.lua b/src/ltui/mconfdialog.lua index 8061285..b5ddb68 100644 --- a/src/ltui/mconfdialog.lua +++ b/src/ltui/mconfdialog.lua @@ -311,15 +311,25 @@ end -- on resize function mconfdialog:on_resize() - self:helpdialog():bounds_set(self:bounds()) - self:resultdialog():bounds_set(self:bounds()) - self:inputdialog():bounds_set(rect{0, 0, math.min(80, self:width() - 8), math.min(8, self:height())}) - self:choicedialog():bounds_set(rect{0, 0, math.min(80, self:width() - 8), math.min(20, self:height())}) - self:searchdialog():bounds_set(rect{0, 0, math.min(80, self:width() - 8), math.min(8, self:height())}) - self:center(self:resultdialog(), {centerx = true, centery = true}) - self:center(self:inputdialog(), {centerx = true, centery = true}) - self:center(self:choicedialog(), {centerx = true, centery = true}) - self:center(self:searchdialog(), {centerx = true, centery = true}) + if self._HELPDIALOG then + self:helpdialog():bounds_set(self:bounds()) + end + if self._RESULTDIALOG then + self:resultdialog():bounds_set(self:bounds()) + self:center(self:resultdialog(), {centerx = true, centery = true}) + end + if self._INPUTDIALOG then + self:inputdialog():bounds_set(rect{0, 0, math.min(80, self:width() - 8), math.min(8, self:height())}) + self:center(self:inputdialog(), {centerx = true, centery = true}) + end + if self._CHOICEDIALOG then + self:choicedialog():bounds_set(rect{0, 0, math.min(80, self:width() - 8), math.min(20, self:height())}) + self:center(self:choicedialog(), {centerx = true, centery = true}) + end + if self._SEARCHDIALOG then + self:searchdialog():bounds_set(rect{0, 0, math.min(80, self:width() - 8), math.min(8, self:height())}) + self:center(self:searchdialog(), {centerx = true, centery = true}) + end boxdialog.on_resize(self) end