diff options
| author | ruki <[email protected]> | 2018-01-11 22:41:52 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2018-01-11 10:11:18 +0800 |
| commit | 3d4fcf847c7a7f365f84d4c4064597c66e124d4c (patch) | |
| tree | bc22704502f196dd43ab8e2d36ddcc207cb022c5 | |
| parent | 749b1822cdc2dbcc3d1f12de614f397607d29b90 (diff) | |
fix button bounds
| -rw-r--r-- | xmake/core/ui/dialog.lua | 5 | ||||
| -rw-r--r-- | xmake/core/ui/rect.lua | 5 |
2 files changed, 9 insertions, 1 deletions
diff --git a/xmake/core/ui/dialog.lua b/xmake/core/ui/dialog.lua index dd9b06d1c..6a48046a1 100644 --- a/xmake/core/ui/dialog.lua +++ b/xmake/core/ui/dialog.lua @@ -41,8 +41,11 @@ function dialog:init(name, bounds, title) window.init(self, name, bounds, title, true) -- init buttons - local button_yes = button:new("dialog.button.yes", rect {0, self:panel():height() - 1, 7, 1}, "< Yes >") + local button_yes = button:new("dialog.button.yes", rect:new(0, self:panel():height() - 1, 7, 1), "< Yes >") self:panel():insert(button_yes, {centerx = true}) + +-- local button_no = button:new("dialog.button.no", rect:new(0, self:panel():height() - 1, 7, 1), "< No >") +-- self:panel():insert(button_no, {centerx = true}) end -- return module diff --git a/xmake/core/ui/rect.lua b/xmake/core/ui/rect.lua index 223065d90..623dc8ee6 100644 --- a/xmake/core/ui/rect.lua +++ b/xmake/core/ui/rect.lua @@ -35,6 +35,11 @@ local object = require("ui/object") -- define module local rect = rect or object { _init = {"sx", "sy", "ex", "ey"} } +-- make rect +function rect:new(x, y, w, h) + return rect { x, y, x + w, y + h } +end + -- get rect size function rect:size() return point { self.ex - self.sx, self.ey - self.sy } |
