combine layout and layout_item

This commit is contained in:
BlackMATov
2020-02-11 04:02:07 +07:00
parent ea38121608
commit d9b1f173a2
7 changed files with 106 additions and 297 deletions

View File

@@ -7,11 +7,9 @@
},{
"prototype" : "../prefabs/layout_prefab.json",
"children" : [{
"prototype" : "../prefabs/layout_prefab.json",
"components" : {
"named" : {
"name" : "layout_item"
},
"layout_item" : {
"layout" : {
"size" : [66,113]
}
},
@@ -24,11 +22,9 @@
}
}]
},{
"prototype" : "../prefabs/layout_prefab.json",
"components" : {
"named" : {
"name" : "layout_item"
},
"layout_item" : {
"layout" : {
"size" : [66,113]
}
},
@@ -41,11 +37,9 @@
}
}]
},{
"prototype" : "../prefabs/layout_prefab.json",
"components" : {
"named" : {
"name" : "layout_item"
},
"layout_item" : {
"layout" : {
"size" : [66,113]
}
},

View File

@@ -1,9 +1,3 @@
-- -----------------------------------------------------------------------------
--
-- layout
--
-- -----------------------------------------------------------------------------
---@class layout
local layout = {
---@type boolean
@@ -22,7 +16,16 @@ local layout = {
halign = layout.haligns.center,
---@type layout_valigns
valign = layout.valigns.center
valign = layout.valigns.center,
---@type v2f
size = v2f.zero(),
---@type v2f
margin = v2f.zero(),
---@type v2f
padding = v2f.zero()
}
---@class layout_modes
@@ -57,49 +60,5 @@ function layout.enable(self) end
---@param self layout
function layout.disable(self) end
-- -----------------------------------------------------------------------------
--
-- layout_item
--
-- -----------------------------------------------------------------------------
---@class layout_item
local layout_item = {
---@type boolean
enabled = true,
---@type boolean
disabled = false,
---@type boolean
dirty = false,
---@type v2f
size = v2f.unit(),
---@type v2f
margin = v2f.zero(),
---@type v2f
padding = v2f.zero()
}
---@overload fun(self: layout_item)
---@param self layout_item
function layout_item.enable(self) end
---@overload fun(self: layout_item)
---@param self layout_item
function layout_item.disable(self) end
-- -----------------------------------------------------------------------------
--
-- global
--
-- -----------------------------------------------------------------------------
---@type layout
_G.layout = _G.layout or layout
---@type layout_item
_G.layout_item = _G.layout_item or layout_item

View File

@@ -33,9 +33,6 @@ local gobject = {
---@type layout
layout = nil,
---@type layout_item
layout_item = nil,
---@type model_renderer
model_renderer = nil,