summaryrefslogtreecommitdiff
path: root/xmake/core/ui/group.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2017-12-25 22:25:57 +0800
committerruki <[email protected]>2017-12-25 08:35:44 +0800
commit994f26116837e8502af2ea8ce81ce7aa2f3d9f94 (patch)
tree4d1fc547db18fcd480589530e52b5441622873ee /xmake/core/ui/group.lua
parent34df1cdc819a181872aa987c3ea9f2ba0810127c (diff)
improve group.insert
Diffstat (limited to 'xmake/core/ui/group.lua')
-rw-r--r--xmake/core/ui/group.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/xmake/core/ui/group.lua b/xmake/core/ui/group.lua
index 73236627d..fada01444 100644
--- a/xmake/core/ui/group.lua
+++ b/xmake/core/ui/group.lua
@@ -90,7 +90,7 @@ function group:current()
end
-- insert view
-function group:insert(v)
+function group:insert(v, opt)
-- check
assert(not v:parent() or v:parent() == self)
@@ -103,10 +103,10 @@ function group:insert(v)
-- center this view if centerx or centery are set
local bounds = v:bounds()
local org = point {bounds.sx, bounds.sy}
- if v:option("centerx") then
+ if opt and opt.centerx then
org.x = math.floor((self:width() - v:width()) / 2)
end
- if v:option("centery") then
+ if opt and opt.centery then
org.y = math.floor((self:height() - v:height()) / 2)
end
bounds:move(org.x - bounds.sx, org.y - bounds.sy)